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 (window &window) |
Initializes the widget. More... | |
void | widget_finalize (window &window) |
Finalizes the widget. More... | |
void | detach_from_window () |
Detaches the field from a window. More... | |
virtual void | widget_save (window &window)=0 |
Saves a widget. More... | |
virtual void | widget_restore (window &window)=0 |
Restores a widget. More... | |
void | widget_set_enabled (window &window, 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 (window &window)=0 |
See widget_init. More... | |
virtual void | init_specialized (window &) |
See widget_init. More... | |
virtual void | finalize_generic (window &window)=0 |
See widget_finalize. More... | |
virtual void | finalize_specialized (window &) |
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 77 of file field.hpp.
References id(), mandatory_, and widget_.
Referenced by gui2::dialogs::modal_dialog::init_fields().
|
inline |
Detaches the field from a window.
Definition at line 131 of file field.hpp.
References mandatory_, widget_, widget_restore(), and widget_save().
Referenced by gui2::dialogs::modal_dialog::finalize_fields().
|
privatepure virtual |
See widget_finalize.
Implemented in gui2::field< T, W, CT >, gui2::field< std::string, text_box_base, const std::string &>, gui2::field< bool, selectable_item >, and gui2::field< std::string, styled_widget, const std::string &>.
Referenced by init_specialized(), and widget_finalize().
|
inlineprivatevirtual |
See widget_finalize.
Reimplemented in gui2::field_text.
Definition at line 238 of file field.hpp.
Referenced by widget_finalize().
|
inline |
Definition at line 206 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::dialogs::generator_settings::pre_show(), and gui2::dialogs::custom_tod::pre_show().
|
inline |
|
inline |
Definition at line 196 of file field.hpp.
References id_.
Referenced by attach_to_window(), gui2::field_label::init_specialized(), gui2::dialogs::mp_create_game::pre_show(), gui2::field< std::string, styled_widget, const std::string &>::restore(), gui2::field< std::string, styled_widget, const std::string &>::save(), and gui2::field< std::string, styled_widget, const std::string &>::validate_widget().
|
privatepure virtual |
See widget_init.
Implemented in gui2::field< T, W, CT >, gui2::field< std::string, text_box_base, const std::string &>, gui2::field< bool, selectable_item >, and gui2::field< std::string, styled_widget, const std::string &>.
Referenced by widget_init().
|
inlineprivatevirtual |
See widget_init.
Reimplemented in gui2::field_label, and gui2::field_bool.
Definition at line 230 of file field.hpp.
References finalize_generic().
Referenced by widget_init().
|
inline |
Definition at line 201 of file field.hpp.
References mandatory_.
Referenced by gui2::field< std::string, styled_widget, const std::string &>::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.
window | The window containing the widget. |
Definition at line 120 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
window | The window containing the widget. |
Definition at line 101 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.
window | The window containing the widget. |
Implemented in gui2::field< T, W, CT >, gui2::field< std::string, text_box_base, const std::string &>, gui2::field< bool, selectable_item >, and gui2::field< std::string, styled_widget, const std::string &>.
Referenced by detach_from_window(), and 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:
window | The window containing the widget. |
Implemented in gui2::field< T, W, CT >, gui2::field< std::string, text_box_base, const std::string &>, gui2::field< bool, selectable_item >, and gui2::field< std::string, styled_widget, const std::string &>.
Referenced by detach_from_window(), and widget_set_enabled().
|
inline |
Enables a widget.
window | The window containing the 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 170 of file field.hpp.
References gui2::window::find(), gui2::styled_widget::get_active(), 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 221 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 224 of file field.hpp.
Referenced by attach_to_window(), detach_from_window(), and get_widget().