The Battle for Wesnoth  1.15.0-dev
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
gui2::dialogs::modal_dialog Class Referenceabstract

Abstract base class for all modal dialogs. More...

#include <modal_dialog.hpp>

Inherited by gui2::dialogs::addon_connect, gui2::dialogs::addon_manager, gui2::dialogs::addon_uninstall_list, gui2::dialogs::attack_predictions, gui2::dialogs::campaign_difficulty, gui2::dialogs::campaign_selection, gui2::dialogs::chat_log, gui2::dialogs::core_selection, gui2::dialogs::custom_tod, gui2::dialogs::depcheck_confirm_change, gui2::dialogs::depcheck_select_new, gui2::dialogs::drop_down_menu, gui2::dialogs::edit_label, gui2::dialogs::edit_text, gui2::dialogs::editor_edit_label, gui2::dialogs::editor_edit_scenario, gui2::dialogs::editor_edit_side, gui2::dialogs::editor_generate_map, gui2::dialogs::editor_new_map, gui2::dialogs::editor_resize_map, gui2::dialogs::editor_set_starting_position, gui2::dialogs::end_credits, gui2::dialogs::faction_select, gui2::dialogs::file_dialog, gui2::dialogs::folder_create, gui2::dialogs::formula_debugger, gui2::dialogs::game_cache_options, gui2::dialogs::game_delete, gui2::dialogs::game_load, gui2::dialogs::game_save, gui2::dialogs::game_save_message, gui2::dialogs::game_save_oos, gui2::dialogs::game_stats, gui2::dialogs::game_version, gui2::dialogs::gamestate_inspector, gui2::dialogs::generator_settings, gui2::dialogs::help_browser, gui2::dialogs::hotkey_bind, gui2::dialogs::install_dependencies, gui2::dialogs::label_settings, gui2::dialogs::language_selection, gui2::dialogs::loading_screen, gui2::dialogs::lobby_player_info, gui2::dialogs::log_settings, gui2::dialogs::lua_interpreter, gui2::dialogs::message, gui2::dialogs::mp_alerts_options, gui2::dialogs::mp_change_control, gui2::dialogs::mp_connect, gui2::dialogs::mp_create_game, gui2::dialogs::mp_host_game_prompt, gui2::dialogs::mp_join_game, gui2::dialogs::mp_join_game_password_prompt, gui2::dialogs::mp_lobby, gui2::dialogs::mp_login, gui2::dialogs::mp_method_selection, gui2::dialogs::mp_staging, gui2::dialogs::network_transmission, gui2::dialogs::outro, gui2::dialogs::preferences_dialog, gui2::dialogs::screenshot_notification, gui2::dialogs::select_orb_colors, gui2::dialogs::simple_item_selector, gui2::dialogs::sp_options_configure, gui2::dialogs::statistics_dialog, gui2::dialogs::story_viewer, gui2::dialogs::surrender_quit, gui2::dialogs::synched_choice_wait, gui2::dialogs::terrain_layers, gui2::dialogs::theme_list, gui2::dialogs::title_screen, gui2::dialogs::transient_message, gui2::dialogs::unit_advance, gui2::dialogs::unit_attack, gui2::dialogs::unit_create, gui2::dialogs::unit_list, gui2::dialogs::unit_recall, gui2::dialogs::unit_recruit, gui2::dialogs::wml_error, and gui2::dialogs::wml_message_base.

Public Member Functions

 modal_dialog ()
 
virtual ~modal_dialog ()
 
bool show (const unsigned auto_close_time=0)
 Shows the window. More...
 
windowget_window () const
 Returns a pointer to the dialog's window. More...
 
int get_retval () const
 
void set_always_save_fields (const bool always_save_fields)
 
void set_allow_plugin_skip (const bool allow_plugin_skip)
 
void set_show_even_without_video (const bool show_even_without_video)
 

Protected Member Functions

field_boolregister_bool (const std::string &id, const bool mandatory, const std::function< bool()> callback_load_value=nullptr, const std::function< void(bool)> callback_save_value=nullptr, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false)
 Creates a new boolean field. More...
 
field_boolregister_bool (const std::string &id, const bool mandatory, bool &linked_variable, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false)
 Creates a new boolean field. More...
 
field_integerregister_integer (const std::string &id, const bool mandatory, const std::function< int()> callback_load_value=nullptr, const std::function< void(int)> callback_save_value=nullptr)
 Creates a new integer field. More...
 
field_integerregister_integer (const std::string &id, const bool mandatory, int &linked_variable)
 Creates a new integer field. More...
 
field_textregister_text (const std::string &id, const bool mandatory, const std::function< std::string()> callback_load_value=nullptr, const std::function< void(const std::string &)> callback_save_value=nullptr, const bool capture_focus=false)
 Creates a new text field. More...
 
field_textregister_text (const std::string &id, const bool mandatory, std::string &linked_variable, const bool capture_focus=false)
 Creates a new text field. More...
 
field_labelregister_label (const std::string &id, const bool mandatory, const std::string &text, const bool use_markup=false)
 Registers a new styled_widget as a label. More...
 
field_labelregister_image (const std::string &id, const bool mandatory, const std::string &filename)
 Registers a new styled_widget as image. More...
 

Protected Attributes

window_ptr_t window_
 The window object build for this dialog. More...
 

Private Member Functions

virtual const std::string & window_id () const =0
 The id of the window to build. More...
 
void build_window ()
 Builds the window. More...
 
virtual void post_build (window &window)
 Actions to be taken directly after the window is build. More...
 
virtual void pre_show (window &window)
 Actions to be taken before showing the window. More...
 
virtual void post_show (window &window)
 Actions to be taken after the window has been shown. More...
 
virtual void init_fields (window &window)
 Initializes all fields in the dialog and set the keyboard focus. More...
 
virtual void finalize_fields (window &window, const bool save_fields)
 When the dialog is closed with the OK status saves all fields. More...
 

Private Attributes

int retval_
 Returns the window exit status, 0 means not shown. More...
 
bool always_save_fields_
 Always save the fields upon closing. More...
 
std::vector< std::unique_ptr< class field_base > > fields_
 Contains the automatically managed fields. More...
 
std::string focus_
 Contains the widget that should get the focus when the window is shown. More...
 
bool allow_plugin_skip_
 Allow plugins to skip through the dialog? Most dialogs install a plugins context to allow plugins to accept whatever the dialog is offering and continue. More...
 
bool show_even_without_video_
 Show the dialog even with –nogui? Some dialogs need to be shown even when –nogui is specified if the game is being driven by a plugin. More...
 

Friends

std::string unit_test_mark_as_tested (const modal_dialog &dialog)
 Special helper function to get the id of the window. More...
 

Detailed Description

Abstract base class for all modal dialogs.

A dialog shows a certain window instance to the user. The subclasses of this class will hold the parameters used for a certain window, eg a server connection dialog will hold the name of the selected server as parameter that way the caller doesn't need to know about the 'contents' of the window.

Usage

Simple dialogs that are shown to query user information it is recommended to add a static member called execute. The parameters to the function are:

The 'in + out parameters' are used as initial value and final value when the OK button is pressed. The 'in parameters' are just extra parameters for showing.

When a function only has 'in parameters' it should return a void value and the function should be called display, if it has 'in + out parameters' it must return a bool value. This value indicates whether or not the OK button was pressed to close the dialog. See editor_new_map::execute for an example.

Definition at line 145 of file modal_dialog.hpp.

Constructor & Destructor Documentation

◆ modal_dialog()

gui2::dialogs::modal_dialog::modal_dialog ( )

Definition at line 29 of file modal_dialog.cpp.

◆ ~modal_dialog()

gui2::dialogs::modal_dialog::~modal_dialog ( )
virtual

Member Function Documentation

◆ build_window()

void gui2::dialogs::modal_dialog::build_window ( )
private

Builds the window.

Every dialog shows its own kind of window. This function handles the building of said window. window_ should be non-null after this is called.

Definition at line 217 of file modal_dialog.cpp.

References gui2::build_window_impl(), window_, and window_id().

Referenced by show().

◆ finalize_fields()

void gui2::dialogs::modal_dialog::finalize_fields ( window window,
const bool  save_fields 
)
privatevirtual

When the dialog is closed with the OK status saves all fields.

Saving only happens if a callback handler is installed.

Parameters
windowThe window which has been shown.
save_fieldsDoes the value in the fields need to be saved?

Definition at line 253 of file modal_dialog.cpp.

References gui2::field_base::detach_from_window(), fields_, and gui2::field_base::widget_finalize().

Referenced by show().

◆ get_retval()

int gui2::dialogs::modal_dialog::get_retval ( ) const
inline

◆ get_window()

window* gui2::dialogs::modal_dialog::get_window ( ) const
inline

◆ init_fields()

void gui2::dialogs::modal_dialog::init_fields ( window window)
privatevirtual

Initializes all fields in the dialog and set the keyboard focus.

Parameters
windowThe window which has been shown.

Definition at line 238 of file modal_dialog.cpp.

References gui2::field_base::attach_to_window(), fields_, gui2::window::find(), focus_, gui2::window::keyboard_capture(), and gui2::field_base::widget_init().

Referenced by show().

◆ post_build()

void gui2::dialogs::modal_dialog::post_build ( window window)
privatevirtual

Actions to be taken directly after the window is build.

At this point the registered fields are not yet registered.

Parameters
windowThe window just created.

Reimplemented in gui2::dialogs::mp_lobby, and gui2::dialogs::preferences_dialog.

Definition at line 223 of file modal_dialog.cpp.

Referenced by show().

◆ post_show()

void gui2::dialogs::modal_dialog::post_show ( window window)
privatevirtual

Actions to be taken after the window has been shown.

At this point the registered fields already stored their values (if the OK has been pressed).

Parameters
windowThe window which has been shown.

Reimplemented in gui2::dialogs::mp_lobby, gui2::dialogs::wml_message_base, gui2::dialogs::message, gui2::dialogs::simple_item_selector, gui2::dialogs::loading_screen, gui2::dialogs::preferences_dialog, gui2::dialogs::drop_down_menu, gui2::dialogs::sp_options_configure, gui2::dialogs::network_transmission, gui2::dialogs::unit_create, gui2::dialogs::unit_recall, gui2::dialogs::game_stats, gui2::dialogs::unit_list, gui2::dialogs::campaign_selection, gui2::dialogs::game_cache_options, gui2::dialogs::campaign_difficulty, gui2::dialogs::theme_list, gui2::dialogs::depcheck_select_new, gui2::dialogs::mp_staging, gui2::dialogs::mp_create_game, gui2::dialogs::addon_uninstall_list, gui2::dialogs::select_orb_colors, gui2::dialogs::mp_method_selection, gui2::dialogs::addon_connect, gui2::dialogs::faction_select, gui2::dialogs::core_selection, gui2::dialogs::lobby_player_info, gui2::dialogs::editor_set_starting_position, gui2::dialogs::mp_join_game, gui2::dialogs::log_settings, gui2::dialogs::outro, gui2::dialogs::unit_attack, gui2::dialogs::custom_tod, gui2::dialogs::mp_change_control, gui2::dialogs::mp_alerts_options, gui2::dialogs::language_selection, gui2::dialogs::unit_recruit, gui2::dialogs::unit_advance, gui2::dialogs::mp_login, and gui2::dialogs::editor_edit_side.

Definition at line 233 of file modal_dialog.cpp.

Referenced by show().

◆ pre_show()

void gui2::dialogs::modal_dialog::pre_show ( window window)
privatevirtual

Actions to be taken before showing the window.

At this point the registered fields are registered and initialized with their initial values.

Parameters
windowThe window to be shown.

Reimplemented in gui2::dialogs::file_dialog, gui2::dialogs::wml_message_double, gui2::dialogs::mp_lobby, gui2::dialogs::wml_message_base, gui2::dialogs::message, gui2::dialogs::editor_resize_map, gui2::dialogs::simple_item_selector, gui2::dialogs::preferences_dialog, gui2::dialogs::loading_screen, gui2::dialogs::drop_down_menu, gui2::dialogs::sp_options_configure, gui2::dialogs::network_transmission, gui2::dialogs::title_screen, gui2::dialogs::addon_manager, gui2::dialogs::game_version, gui2::dialogs::unit_create, gui2::dialogs::unit_recall, gui2::dialogs::game_stats, gui2::dialogs::wml_error, gui2::dialogs::unit_list, gui2::dialogs::campaign_selection, gui2::dialogs::game_cache_options, gui2::dialogs::campaign_difficulty, gui2::dialogs::folder_create, gui2::dialogs::theme_list, gui2::dialogs::depcheck_select_new, gui2::dialogs::editor_edit_label, gui2::dialogs::mp_staging, gui2::dialogs::screenshot_notification, gui2::dialogs::help_browser, gui2::dialogs::mp_create_game, gui2::dialogs::addon_uninstall_list, gui2::dialogs::editor_generate_map, gui2::dialogs::select_orb_colors, gui2::dialogs::mp_method_selection, gui2::dialogs::addon_connect, gui2::dialogs::faction_select, gui2::dialogs::story_viewer, gui2::dialogs::core_selection, gui2::dialogs::lobby_player_info, gui2::dialogs::editor_set_starting_position, gui2::dialogs::game_load, gui2::dialogs::hotkey_bind, gui2::dialogs::mp_join_game, gui2::dialogs::attack_predictions, gui2::dialogs::log_settings, gui2::dialogs::outro, gui2::dialogs::unit_attack, gui2::dialogs::custom_tod, gui2::dialogs::mp_change_control, gui2::dialogs::transient_message, gui2::dialogs::end_credits, gui2::dialogs::label_settings, gui2::dialogs::editor_edit_scenario, gui2::dialogs::mp_alerts_options, gui2::dialogs::synched_choice_wait, gui2::dialogs::terrain_layers, gui2::dialogs::unit_recruit, gui2::dialogs::install_dependencies, gui2::dialogs::formula_debugger, gui2::dialogs::gamestate_inspector, gui2::dialogs::mp_connect, gui2::dialogs::unit_advance, gui2::dialogs::language_selection, gui2::dialogs::statistics_dialog, gui2::dialogs::chat_log, gui2::dialogs::editor_edit_side, gui2::dialogs::lua_interpreter, gui2::dialogs::generator_settings, and gui2::dialogs::mp_login.

Definition at line 228 of file modal_dialog.cpp.

Referenced by show().

◆ register_bool() [1/2]

field_bool * gui2::dialogs::modal_dialog::register_bool ( const std::string &  id,
const bool  mandatory,
const std::function< bool()>  callback_load_value = nullptr,
const std::function< void(bool)>  callback_save_value = nullptr,
const std::function< void(widget &)>  callback_change = nullptr,
const bool  initial_fire = false 
)
protected

Creates a new boolean field.

The field created is owned by modal_dialog, the returned pointer can be used in the child classes as access to a field.

Parameters
idId of the widget, same value as in WML.
mandatoryIs the widget mandatory or mandatory.
callback_load_valueThe callback function to set the initial value of the widget.
callback_save_valueThe callback function to write the resulting value of the widget. Saving will only happen if the widget is enabled and the window closed with ok.
callback_changeWhen the value of the widget changes this callback is called.
Returns
Pointer to the created widget.

Definition at line 117 of file modal_dialog.cpp.

References field(), and fields_.

Referenced by gui2::dialogs::game_delete::game_delete(), gui2::dialogs::mp_host_game_prompt::mp_host_game_prompt(), and set_show_even_without_video().

◆ register_bool() [2/2]

field_bool * gui2::dialogs::modal_dialog::register_bool ( const std::string &  id,
const bool  mandatory,
bool &  linked_variable,
const std::function< void(widget &)>  callback_change = nullptr,
const bool  initial_fire = false 
)
protected

Creates a new boolean field.

The field created is owned by modal_dialog, the returned pointer can be used in the child classes as access to a field.

Parameters
idId of the widget, same value as in WML.
mandatoryIs the widget mandatory or mandatory.
linked_variableThe variable the widget is linked to. See field::field for more information.
callback_changeWhen the value of the widget changes this callback is called.
Returns
Pointer to the created widget.

Definition at line 137 of file modal_dialog.cpp.

References field(), and fields_.

◆ register_image()

field_label* gui2::dialogs::modal_dialog::register_image ( const std::string &  id,
const bool  mandatory,
const std::string &  filename 
)
inlineprotected

Registers a new styled_widget as image.

Definition at line 316 of file modal_dialog.hpp.

References register_label().

◆ register_integer() [1/2]

field_integer * gui2::dialogs::modal_dialog::register_integer ( const std::string &  id,
const bool  mandatory,
const std::function< int()>  callback_load_value = nullptr,
const std::function< void(int)>  callback_save_value = nullptr 
)
protected

Creates a new integer field.

See register_bool for more info.

Definition at line 150 of file modal_dialog.cpp.

References field(), and fields_.

Referenced by gui2::dialogs::editor_edit_label::register_color_component(), and set_show_even_without_video().

◆ register_integer() [2/2]

field_integer * gui2::dialogs::modal_dialog::register_integer ( const std::string &  id,
const bool  mandatory,
int &  linked_variable 
)
protected

Creates a new integer field.

See register_bool for more info.

Definition at line 163 of file modal_dialog.cpp.

References field(), and fields_.

◆ register_label()

field_label * gui2::dialogs::modal_dialog::register_label ( const std::string &  id,
const bool  mandatory,
const std::string &  text,
const bool  use_markup = false 
)
protected

Registers a new styled_widget as a label.

The label is used for a styled_widget to set the 'label' since it calls the styled_widget::set_label it can also be used for the image since there this sets the filename. (The use_markup makes no sense in an image but that's a detail.)

Note
In general it's preferred a widget sets its markup flag in WML, but some generic windows (like messages) may need different versions depending on where used.
Parameters
idId of the widget, same value as in WML.
mandatoryIs the widget mandatory or optional.
textThe text for the label.
use_markupWhether or not use markup for the label.

Definition at line 206 of file modal_dialog.cpp.

References field(), and fields_.

Referenced by gui2::dialogs::network_transmission::network_transmission(), register_image(), and set_show_even_without_video().

◆ register_text() [1/2]

field_text * gui2::dialogs::modal_dialog::register_text ( const std::string &  id,
const bool  mandatory,
const std::function< std::string()>  callback_load_value = nullptr,
const std::function< void(const std::string &)>  callback_save_value = nullptr,
const bool  capture_focus = false 
)
protected

Creates a new text field.

See register_bool for more info.

Definition at line 173 of file modal_dialog.cpp.

References field(), fields_, focus_, and id.

Referenced by gui2::dialogs::lua_interpreter::pre_show(), gui2::dialogs::editor_generate_map::pre_show(), and set_show_even_without_video().

◆ register_text() [2/2]

field_text * gui2::dialogs::modal_dialog::register_text ( const std::string &  id,
const bool  mandatory,
std::string &  linked_variable,
const bool  capture_focus = false 
)
protected

Creates a new text field.

See register_bool for more info.

Definition at line 191 of file modal_dialog.cpp.

References field(), fields_, focus_, and id.

◆ set_allow_plugin_skip()

void gui2::dialogs::modal_dialog::set_allow_plugin_skip ( const bool  allow_plugin_skip)
inline

Definition at line 192 of file modal_dialog.hpp.

References allow_plugin_skip_.

Referenced by gui2::dialogs::mp_lobby::mp_lobby().

◆ set_always_save_fields()

void gui2::dialogs::modal_dialog::set_always_save_fields ( const bool  always_save_fields)
inline

Definition at line 187 of file modal_dialog.hpp.

References always_save_fields_.

◆ set_show_even_without_video()

void gui2::dialogs::modal_dialog::set_show_even_without_video ( const bool  show_even_without_video)
inline

◆ show()

bool gui2::dialogs::modal_dialog::show ( const unsigned  auto_close_time = 0)

Shows the window.

Parameters
auto_close_timeThe time in ms after which the dialog will automatically close, if 0 it doesn't close.
Note
the timeout is a minimum time and there's no guarantee about how fast it closes after the minimum.
Returns
Whether the final retval_ == retval::OK

Definition at line 56 of file modal_dialog.cpp.

References allow_plugin_skip_, always_save_fields_, plugins_manager::any_running(), build_window(), DOUBLE_CLICK_EVENT, finalize_fields(), plugins_manager::get(), CVideo::get_singleton(), init_fields(), gui2::OK, plugins_context::play_slice(), post_build(), post_show(), pre_show(), retval_, plugins_context::set_callback(), show_even_without_video_, and window_.

Referenced by gui2::dialogs::preferences_dialog::add_hotkey_callback(), editor::context_manager::apply_mask_dialog(), BOOST_AUTO_TEST_CASE(), gui2::dialogs::title_screen::button_callback_cores(), gui2::dialogs::title_screen::button_callback_multiplayer(), editor::context_manager::create_mask_to_dialog(), events::menu_handler::current_unit(), quit_confirmation::default_prompt(), gui2::dialogs::story_viewer::display(), gui2::dialogs::preferences_dialog::display(), events::console_handler::do_choose_level(), do_gameloop(), sp::enter_create_mode(), gui2::dialogs::label_settings::execute(), editor::context_manager::generate_map_dialog(), editor::context_manager::load_map_dialog(), manage_addons(), wb::manager::options_dlg(), gui2::dialogs::mp_create_game::post_show(), turn_info::process_network_data(), events::menu_handler::recall(), events::menu_handler::recruit(), events::menu_handler::save_map(), editor::context_manager::save_map_as_dialog(), editor::context_manager::save_scenario_as_dialog(), ng::create_engine::select_campaign_difficulty(), gui2::dialogs::custom_tod::select_file(), events::mouse_handler::show_attack_dialog(), savegame::loadgame::show_difficulty_dialog(), gui2::dialogs::mp_join_game::show_flg_select(), hotkey::command_executor::show_menu(), lua_gui2::show_menu(), gui2::show_message(), savegame::savegame::show_save_dialog(), savegame::oos_savegame::show_save_dialog(), preferences::show_theme_dialog(), gui2::menu_button::signal_handler_left_button_click(), gui2::multimenu_button::signal_handler_left_button_click(), editor::mouse_action_map_label::up_left(), gui2::dialogs::mp_lobby::user_dialog_callback(), and addons_client::wait_for_transfer_done().

◆ window_id()

virtual const std::string& gui2::dialogs::modal_dialog::window_id ( ) const
privatepure virtual

The id of the window to build.

Implemented in gui2::dialogs::file_dialog, gui2::dialogs::wml_message_double, gui2::dialogs::wml_message_right, gui2::dialogs::mp_lobby, gui2::dialogs::message, gui2::dialogs::wml_message_left, gui2::dialogs::editor_resize_map, gui2::dialogs::simple_item_selector, gui2::dialogs::network_transmission, gui2::dialogs::loading_screen, gui2::dialogs::preferences_dialog, gui2::dialogs::drop_down_menu, gui2::dialogs::sp_options_configure, gui2::dialogs::title_screen, gui2::dialogs::addon_manager, gui2::dialogs::game_version, gui2::dialogs::unit_create, gui2::dialogs::unit_recall, gui2::dialogs::game_stats, gui2::dialogs::wml_error, gui2::dialogs::game_save_oos, gui2::dialogs::unit_list, gui2::dialogs::campaign_selection, gui2::dialogs::game_cache_options, gui2::dialogs::campaign_difficulty, gui2::dialogs::edit_text, gui2::dialogs::folder_create, gui2::dialogs::editor_edit_label, gui2::dialogs::theme_list, gui2::dialogs::depcheck_select_new, gui2::dialogs::game_load, gui2::dialogs::mp_staging, gui2::dialogs::screenshot_notification, gui2::dialogs::editor_new_map, gui2::dialogs::help_browser, gui2::dialogs::mp_create_game, gui2::dialogs::addon_uninstall_list, gui2::dialogs::editor_generate_map, gui2::dialogs::select_orb_colors, gui2::dialogs::edit_label, gui2::dialogs::mp_method_selection, gui2::dialogs::addon_connect, gui2::dialogs::faction_select, gui2::dialogs::story_viewer, gui2::dialogs::core_selection, gui2::dialogs::editor_edit_side, gui2::dialogs::game_save_message, gui2::dialogs::lobby_player_info, gui2::dialogs::depcheck_confirm_change, gui2::dialogs::editor_set_starting_position, gui2::dialogs::hotkey_bind, gui2::dialogs::lua_interpreter, gui2::dialogs::mp_join_game, gui2::dialogs::attack_predictions, gui2::dialogs::log_settings, gui2::dialogs::chat_log, gui2::dialogs::formula_debugger, gui2::dialogs::gamestate_inspector, gui2::dialogs::mp_join_game_password_prompt, gui2::dialogs::outro, gui2::dialogs::unit_attack, gui2::dialogs::custom_tod, gui2::dialogs::generator_settings, gui2::dialogs::mp_change_control, gui2::dialogs::transient_message, gui2::dialogs::editor_edit_scenario, gui2::dialogs::end_credits, gui2::dialogs::label_settings, gui2::dialogs::mp_alerts_options, gui2::dialogs::synched_choice_wait, gui2::dialogs::terrain_layers, gui2::dialogs::unit_recruit, gui2::dialogs::install_dependencies, gui2::dialogs::mp_connect, gui2::dialogs::unit_advance, gui2::dialogs::language_selection, gui2::dialogs::statistics_dialog, gui2::dialogs::mp_host_game_prompt, gui2::dialogs::game_delete, gui2::dialogs::surrender_quit, gui2::dialogs::game_save, and gui2::dialogs::mp_login.

Referenced by build_window(), and gui2::dialogs::unit_test_mark_as_tested().

Friends And Related Function Documentation

◆ unit_test_mark_as_tested

std::string unit_test_mark_as_tested ( const modal_dialog dialog)
friend

Special helper function to get the id of the window.

This is used in the unit tests, but these implementation details shouldn't be used in the normal code.

Definition at line 141 of file test_gui2.cpp.

Member Data Documentation

◆ allow_plugin_skip_

bool gui2::dialogs::modal_dialog::allow_plugin_skip_
private

Allow plugins to skip through the dialog? Most dialogs install a plugins context to allow plugins to accept whatever the dialog is offering and continue.

Some dialogs, especially those that install their own plugins context, may want to disable this.

Definition at line 361 of file modal_dialog.hpp.

Referenced by set_allow_plugin_skip(), and show().

◆ always_save_fields_

bool gui2::dialogs::modal_dialog::always_save_fields_
private

Always save the fields upon closing.

Normally fields are only saved when the retval::OK button is pressed. With this flag set is always saves. Be careful with the flag since it also updates upon canceling, which can be a problem when the field sets a preference.

Definition at line 339 of file modal_dialog.hpp.

Referenced by set_always_save_fields(), and show().

◆ fields_

std::vector<std::unique_ptr<class field_base> > gui2::dialogs::modal_dialog::fields_
private

Contains the automatically managed fields.

Since the fields are automatically managed and there are no search functions defined we don't offer access to the vector. If access is needed the creator should store a copy of the pointer.

Definition at line 348 of file modal_dialog.hpp.

Referenced by finalize_fields(), init_fields(), register_bool(), register_integer(), register_label(), and register_text().

◆ focus_

std::string gui2::dialogs::modal_dialog::focus_
private

Contains the widget that should get the focus when the window is shown.

Definition at line 353 of file modal_dialog.hpp.

Referenced by init_fields(), and register_text().

◆ retval_

int gui2::dialogs::modal_dialog::retval_
private

Returns the window exit status, 0 means not shown.

Definition at line 329 of file modal_dialog.hpp.

Referenced by get_retval(), and show().

◆ show_even_without_video_

bool gui2::dialogs::modal_dialog::show_even_without_video_
private

Show the dialog even with –nogui? Some dialogs need to be shown even when –nogui is specified if the game is being driven by a plugin.

Those dialogs allow the plugin to styled_widget them by creating a plugin context in pre_show().

Definition at line 368 of file modal_dialog.hpp.

Referenced by set_show_even_without_video(), and show().

◆ window_

window_ptr_t gui2::dialogs::modal_dialog::window_
protected

The window object build for this dialog.

Definition at line 325 of file modal_dialog.hpp.

Referenced by build_window(), get_window(), and show().


The documentation for this class was generated from the following files: