Abstract base class for the fields. More...
#include <field.hpp>
Public Member Functions | |
field_base (const std::string &id, const bool mandatory) | |
Constructor. More... | |
virtual | ~field_base () |
void | attach_to_window (window &window) |
Attaches the field to a window. More... | |
void | widget_init () |
Initializes the widget. More... | |
void | widget_finalize () |
Finalizes the widget. More... | |
void | detach_from_window () |
Detaches the field from a window. More... | |
virtual void | widget_save ()=0 |
Saves a widget. More... | |
virtual void | widget_restore ()=0 |
Restores a widget. More... | |
void | widget_set_enabled (const bool enable, const bool sync) |
Enables a widget. More... | |
const std::string & | id () const |
bool | is_mandatory () const |
styled_widget * | get_widget () |
const styled_widget * | get_widget () const |
Private Member Functions | |
virtual void | init_generic ()=0 |
See widget_init. More... | |
virtual void | init_specialized () |
See widget_init. More... | |
virtual void | finalize_generic ()=0 |
See widget_finalize. More... | |
virtual void | finalize_specialized () |
See widget_finalize. More... | |
Private Attributes | |
const std::string | id_ |
The id field of the widget, should be unique in a window. More... | |
const bool | mandatory_ |
Is the widget optional or mandatory in this window. More... | |
styled_widget * | widget_ |
The widget attached to the field. More... | |
Abstract base class for the fields.
|
inline |
|
inline |
Attaches the field to a window.
When attached the widget which we're a wrapper around is stored linked in here.
window | The window to be attached to. |
Definition at line 74 of file field.hpp.
References gui2::widget::find_widget(), id(), mandatory_, and widget_.
Referenced by gui2::dialogs::modal_dialog::init_fields().
|
inline |
Detaches the field from a window.
Definition at line 124 of file field.hpp.
References mandatory_, and widget_.
Referenced by gui2::dialogs::modal_dialog::finalize_fields().
|
privatepure virtual |
See widget_finalize.
Implemented in gui2::field< T, W, CT >, gui2::field< bool, selectable_item >, gui2::field< std::string, styled_widget, const std::string & >, and gui2::field< std::string, text_box_base, const std::string & >.
Referenced by widget_finalize().
|
inlineprivatevirtual |
See widget_finalize.
Reimplemented in gui2::field_text.
Definition at line 224 of file field.hpp.
Referenced by widget_finalize().
|
inline |
Definition at line 192 of file field.hpp.
References widget_.
Referenced by gui2::dialogs::generator_settings::adjust_minimum_size_by_players(), gui2::dialogs::game_load::display_savegame(), gui2::dialogs::game_load::display_savegame_internal(), gui2::field_text::finalize_specialized(), gui2::field_bool::init_specialized(), gui2::field_label::init_specialized(), gui2::dialogs::custom_tod::pre_show(), gui2::dialogs::generator_settings::pre_show(), gui2::field< T, W, CT >::restore(), gui2::field< T, W, CT >::save(), gui2::field< T, W, CT >::validate_widget(), and widget_set_enabled().
|
inline |
|
inline |
Definition at line 182 of file field.hpp.
References id_.
Referenced by attach_to_window(), and gui2::dialogs::mp_create_game::pre_show().
|
privatepure virtual |
See widget_init.
Implemented in gui2::field< T, W, CT >, gui2::field< bool, selectable_item >, gui2::field< std::string, styled_widget, const std::string & >, and gui2::field< std::string, text_box_base, const std::string & >.
Referenced by widget_init().
|
inlineprivatevirtual |
See widget_init.
Reimplemented in gui2::field_label, and gui2::field_bool.
Definition at line 216 of file field.hpp.
Referenced by widget_init().
|
inline |
Definition at line 187 of file field.hpp.
References mandatory_.
Referenced by gui2::field< T, W, CT >::validate_widget().
|
inline |
Finalizes the widget.
This routine is called after the dialog is closed with OK. It's called before post_show(). This routine does the following:
Like widget_init it calls two functions with the same purpose.
Definition at line 113 of file field.hpp.
References finalize_generic(), and finalize_specialized().
Referenced by gui2::dialogs::modal_dialog::finalize_fields().
|
inline |
Initializes the widget.
This routine is called before the dialog is shown and the pre_show() is called. So the user can override the values set. This routine does the following:
The function calls two functions
Definition at line 96 of file field.hpp.
References init_generic(), and init_specialized().
Referenced by gui2::dialogs::modal_dialog::init_fields().
|
pure virtual |
Restores a widget.
See widget_save for more info.
Implemented in gui2::field< T, W, CT >, gui2::field< bool, selectable_item >, gui2::field< std::string, styled_widget, const std::string & >, and gui2::field< std::string, text_box_base, const std::string & >.
Referenced by widget_set_enabled().
|
pure virtual |
Saves a widget.
It can be a window must be recreated, in that case the state needs to be saved and restored. This routine does the following:
Implemented in gui2::field< T, W, CT >, gui2::field< bool, selectable_item >, gui2::field< std::string, styled_widget, const std::string & >, and gui2::field< std::string, text_box_base, const std::string & >.
Referenced by widget_set_enabled().
|
inline |
Enables a widget.
enable | If true enables the widget, disables otherwise. |
sync | If the state is changed do we need to synchronize. Upon disabling, write the value of the widget in the variable value_. Upon enabling write the value of value_ in the widget. |
Definition at line 158 of file field.hpp.
References gui2::styled_widget::get_active(), get_widget(), gui2::styled_widget::set_active(), widget_restore(), and widget_save().
Referenced by gui2::dialogs::mp_create_game::pre_show(), and gui2::dialogs::mp_create_game::update_map_settings().
|
private |
|
private |
Is the widget optional or mandatory in this window.
Definition at line 207 of file field.hpp.
Referenced by attach_to_window(), detach_from_window(), and is_mandatory().
|
private |
The widget attached to the field.
Definition at line 210 of file field.hpp.
Referenced by attach_to_window(), detach_from_window(), and get_widget().