Abstract base class for all modal dialogs. More...
#include <modal_dialog.hpp>
Public Member Functions | |
modal_dialog () | |
virtual | ~modal_dialog () |
bool | show (const unsigned auto_close_time=0) |
Shows the window. More... | |
window * | get_window () const |
Returns a pointer to the dialog's window. More... | |
int | get_retval () const |
Returns the cached window exit code. More... | |
void | set_retval (int retval) |
Convenience wrapper to set the window's exit code. More... | |
void | set_always_save_fields (const bool always_save_fields) |
void | set_restore (const bool restore) |
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_bool * | 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) |
Creates a new boolean field. More... | |
field_bool * | 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) |
Creates a new boolean field. More... | |
field_integer * | 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) |
Creates a new integer field. More... | |
field_integer * | register_integer (const std::string &id, const bool mandatory, int &linked_variable) |
Creates a new integer field. More... | |
field_text * | 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) |
Creates a new text field. More... | |
field_text * | register_text (const std::string &id, const bool mandatory, std::string &linked_variable, const bool capture_focus=false) |
Creates a new text field. More... | |
field_label * | register_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_label * | register_image (const std::string &id, const bool mandatory, const std::string &filename) |
Registers a new styled_widget as image. More... | |
Protected Attributes | |
std::unique_ptr< window > | 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... | |
std::unique_ptr< window > | build_window () const |
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_ |
The window's exit code (return value). 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 | restore_ |
Restore the screen after showing? 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... | |
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.
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.
gui2::dialogs::modal_dialog::modal_dialog | ( | ) |
Definition at line 30 of file modal_dialog.cpp.
|
virtual |
Definition at line 42 of file modal_dialog.cpp.
References local_window, gui2::open_window_stack, and gui2::remove_from_window_stack().
|
private |
Builds the window.
Every dialog shows it's own kind of window, this function should return the window to show.
Definition at line 228 of file modal_dialog.cpp.
References gui2::build(), and window_id().
Referenced by show().
|
privatevirtual |
When the dialog is closed with the OK status saves all fields.
Saving only happens if a callback handler is installed.
window | The window which has been shown. |
save_fields | Does the value in the fields need to be saved? |
Definition at line 263 of file modal_dialog.cpp.
References gui2::field_base::detach_from_window(), fields_, and gui2::field_base::widget_finalize().
Referenced by show().
|
inline |
Returns the cached window exit code.
Definition at line 182 of file modal_dialog.hpp.
References retval_, and set_retval().
Referenced by gui2::dialogs::title_screen::button_callback_multiplayer(), quit_confirmation::default_prompt(), do_gameloop(), manage_addons(), gui2::dialogs::unit_advance::post_show(), gui2::dialogs::unit_recruit::post_show(), gui2::dialogs::label_settings::post_show(), gui2::dialogs::language_selection::post_show(), gui2::dialogs::mp_login::post_show(), gui2::dialogs::mp_create_game::post_show(), gui2::dialogs::faction_select::post_show(), gui2::dialogs::select_orb_colors::post_show(), gui2::dialogs::addon_connect::post_show(), gui2::dialogs::unit_list::post_show(), gui2::dialogs::unit_attack::post_show(), gui2::dialogs::addon_uninstall_list::post_show(), gui2::dialogs::custom_tod::post_show(), gui2::dialogs::mp_method_selection::post_show(), gui2::dialogs::depcheck_select_new::post_show(), gui2::dialogs::theme_list::post_show(), gui2::dialogs::unit_recall::post_show(), gui2::dialogs::game_stats::post_show(), gui2::dialogs::campaign_difficulty::post_show(), gui2::dialogs::network_transmission::post_show(), gui2::dialogs::unit_create::post_show(), gui2::dialogs::simple_item_selector::post_show(), sp::select_campaign(), gui2::show_message(), savegame::savegame::show_save_dialog(), and savegame::oos_savegame::show_save_dialog().
|
inline |
Returns a pointer to the dialog's window.
Will be null if it hasn't been built yet.
Definition at line 176 of file modal_dialog.hpp.
References window_.
Referenced by gui2::dialogs::campaign_selection::add_campaign_to_tree(), gui2::dialogs::statistics_dialog::add_damage_row(), gui2::dialogs::statistics_dialog::add_hits_row(), gui2::dialogs::mp_staging::add_side_to_team_node(), gui2::dialogs::statistics_dialog::add_stat_row(), gui2::dialogs::generator_settings::adjust_minimum_size_by_players(), gui2::dialogs::addon_manager::apply_filters(), gui2::dialogs::title_screen::button_callback_cores(), gui2::dialogs::title_screen::button_callback_multiplayer(), gui2::dialogs::lobby_player_info::check_status_button_callback(), gui2::dialogs::mp_join_game::close_faction_select_dialog_if_open(), gui2::dialogs::custom_tod::color_slider_callback(), gui2::dialogs::mp_connect::current_selection(), gui2::dialogs::unit_attack::damage_calc_callback(), gui2::dialogs::game_load::delete_button_callback(), gui2::dialogs::campaign_selection::difficulty_selected(), gui2::dialogs::unit_recall::dismiss_unit(), gui2::dialogs::mp_create_game::display_games_of_type(), gui2::dialogs::story_viewer::display_part(), gui2::dialogs::game_load::display_savegame(), gui2::dialogs::game_load::display_savegame_internal(), gui2::dialogs::editor_generate_map::do_generator_selected(), gui2::dialogs::outro::draw_callback(), gui2::dialogs::story_viewer::draw_callback(), gui2::dialogs::story_viewer::draw_floating_image(), gui2::dialogs::mp_lobby::enter_game(), gui2::dialogs::addon_manager::execute_action_on_selected_addon(), gui2::dialogs::addon_manager::fetch_addons_list(), gui2::dialogs::unit_recruit::filter_text_changed(), gui2::dialogs::log_settings::filter_text_changed(), gui2::dialogs::unit_recall::filter_text_changed(), gui2::dialogs::game_load::filter_text_changed(), gui2::dialogs::unit_create::filter_text_changed(), gui2::dialogs::story_viewer::flag_stack_as_dirty(), gui2::dialogs::mp_lobby::game_filter_reload(), gui2::dialogs::mp_join_game::generate_side_list(), gui2::dialogs::addon_manager::get_name_filter_visibility(), gui2::dialogs::addon_manager::get_status_filter_visibility(), gui2::dialogs::drop_down_menu::get_toggle_states(), gui2::dialogs::addon_manager::get_type_filter_visibility(), gui2::dialogs::game_load::handle_dir_select(), gui2::dialogs::synched_choice_wait::handle_generic_event(), gui2::dialogs::mp_change_control::handle_nicks_list_item_clicked(), gui2::dialogs::mp_change_control::handle_sides_list_item_clicked(), gui2::dialogs::mp_change_control::highlight_side_nick(), gui2::dialogs::addon_manager::install_addon(), gui2::dialogs::game_load::key_press_callback(), gui2::dialogs::lobby_player_info::kick_ban_button_callback(), gui2::dialogs::lobby_player_info::kick_button_callback(), gui2::dialogs::unit_advance::list_item_clicked(), gui2::dialogs::unit_recruit::list_item_clicked(), gui2::dialogs::unit_list::list_item_clicked(), gui2::dialogs::unit_recall::list_item_clicked(), gui2::dialogs::unit_create::list_item_clicked(), gui2::dialogs::addon_manager::load_addon_list(), gui2::dialogs::mp_login::load_password(), gui2::dialogs::campaign_selection::mod_toggled(), gui2::dialogs::drop_down_menu::mouse_up_callback(), gui2::dialogs::story_viewer::nav_button_callback(), gui2::dialogs::mp_join_game::network_handler(), gui2::dialogs::mp_staging::network_handler(), gui2::dialogs::addon_manager::on_addon_select(), gui2::dialogs::file_dialog::on_bookmark_add_cmd(), gui2::dialogs::file_dialog::on_bookmark_del_cmd(), gui2::dialogs::file_dialog::on_bookmark_selected(), gui2::dialogs::faction_select::on_faction_select(), gui2::dialogs::mp_create_game::on_filter_change(), gui2::dialogs::mp_create_game::on_game_select(), gui2::dialogs::faction_select::on_leader_select(), gui2::dialogs::addon_manager::on_order_changed(), gui2::dialogs::statistics_dialog::on_primary_list_select(), gui2::dialogs::mp_create_game::on_random_faction_mode_select(), gui2::dialogs::file_dialog::on_row_selected(), gui2::dialogs::statistics_dialog::on_scenario_select(), gui2::dialogs::addon_manager::on_selected_version_change(), gui2::dialogs::mp_connect::on_server_add(), gui2::dialogs::mp_connect::on_server_delete(), gui2::dialogs::mp_connect::on_server_select(), gui2::dialogs::game_stats::on_tab_select(), gui2::dialogs::mp_create_game::on_tab_select(), gui2::dialogs::mp_staging::on_team_select(), gui2::dialogs::edit_text::on_text_change(), gui2::dialogs::help_browser::on_topic_select(), gui2::dialogs::addon_manager::order_addons(), gui2::dialogs::game_load::populate_game_list(), gui2::dialogs::campaign_selection::pre_show(), gui2::dialogs::loading_screen::process(), gui2::dialogs::file_dialog::process_fileview_submit(), gui2::dialogs::file_dialog::process_textbox_submit(), gui2::dialogs::faction_select::profile_button_callback(), gui2::dialogs::file_dialog::refresh_fileview(), gui2::dialogs::addon_manager::reload_list_and_reselect_item(), gui2::dialogs::unit_recall::rename_unit(), gui2::dialogs::select_orb_colors::reset_orb_group(), gui2::dialogs::mp_login::save_password(), gui2::dialogs::screenshot_notification::save_screenshot(), gui2::dialogs::mp_connect::select_first_match(), gui2::dialogs::select_orb_colors::setup_orb_group(), gui2::dialogs::mp_create_game::show_description(), gui2::dialogs::mp_lobby::show_preferences_button_callback(), gui2::dialogs::mp_lobby::skip_replay_changed_callback(), gui2::dialogs::campaign_selection::sort_campaigns(), gui2::dialogs::lobby_player_info::start_whisper_button_callback(), gui2::dialogs::lobby_player_info::stopgame_button_callback(), gui2::dialogs::file_dialog::sync_bookmarks_bar(), gui2::dialogs::mp_create_game::sync_with_depcheck(), gui2::dialogs::server_info::tab_switch_callback(), gui2::dialogs::game_version::tab_switch_callback(), gui2::dialogs::campaign_selection::toggle_sorting_selection(), gui2::dialogs::mp_create_game::update_details(), gui2::dialogs::unit_create::update_displayed_type(), gui2::dialogs::editor_resize_map::update_expand_direction(), gui2::dialogs::mp_create_game::update_games_list(), gui2::dialogs::custom_tod::update_lawful_bonus(), gui2::dialogs::faction_select::update_leader_image(), gui2::dialogs::statistics_dialog::update_lists(), gui2::dialogs::mp_create_game::update_map_settings(), gui2::dialogs::mp_lobby::update_selected_game(), gui2::dialogs::custom_tod::update_selected_tod_info(), gui2::dialogs::mp_staging::update_status_label_and_buttons(), gui2::dialogs::title_screen::update_tip(), gui2::dialogs::custom_tod::update_tod_display(), and gui2::dialogs::unit_create::variation_menu_callback().
|
privatevirtual |
Initializes all fields in the dialog and set the keyboard focus.
window | The window which has been shown. |
Definition at line 248 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().
|
privatevirtual |
Actions to be taken directly after the window is build.
At this point the registered fields are not yet registered.
window | The window just created. |
Reimplemented in gui2::dialogs::mp_lobby, and gui2::dialogs::preferences_dialog.
Definition at line 233 of file modal_dialog.cpp.
Referenced by show().
|
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).
window | The window which has been shown. |
Reimplemented in gui2::dialogs::mp_lobby, gui2::dialogs::wml_message_base, gui2::dialogs::message, gui2::dialogs::drop_down_menu, gui2::dialogs::simple_item_selector, gui2::dialogs::campaign_selection, gui2::dialogs::unit_create, gui2::dialogs::loading_screen, gui2::dialogs::preferences_dialog, gui2::dialogs::network_transmission, gui2::dialogs::sp_options_configure, gui2::dialogs::game_cache_options, gui2::dialogs::campaign_difficulty, gui2::dialogs::game_stats, gui2::dialogs::depcheck_select_new, gui2::dialogs::theme_list, gui2::dialogs::unit_recall, gui2::dialogs::mp_method_selection, gui2::dialogs::addon_uninstall_list, gui2::dialogs::custom_tod, gui2::dialogs::core_selection, gui2::dialogs::unit_attack, gui2::dialogs::unit_list, gui2::dialogs::addon_connect, gui2::dialogs::mp_alerts_options, gui2::dialogs::mp_change_control, gui2::dialogs::select_orb_colors, gui2::dialogs::mp_staging, gui2::dialogs::faction_select, gui2::dialogs::mp_create_game, gui2::dialogs::log_settings, gui2::dialogs::lobby_player_info, gui2::dialogs::language_selection, gui2::dialogs::mp_login, gui2::dialogs::mp_join_game, gui2::dialogs::outro, gui2::dialogs::editor_edit_side, gui2::dialogs::label_settings, gui2::dialogs::unit_recruit, and gui2::dialogs::unit_advance.
Definition at line 243 of file modal_dialog.cpp.
Referenced by show().
|
privatevirtual |
Actions to be taken before showing the window.
At this point the registered fields are registered and initialized with their initial values.
window | The window to be shown. |
Reimplemented in gui2::dialogs::file_dialog, gui2::dialogs::wml_message_double, gui2::dialogs::mp_lobby, gui2::dialogs::editor_resize_map, gui2::dialogs::wml_message_base, gui2::dialogs::message, gui2::dialogs::drop_down_menu, gui2::dialogs::simple_item_selector, gui2::dialogs::campaign_selection, gui2::dialogs::title_screen, gui2::dialogs::unit_create, gui2::dialogs::addon_manager, gui2::dialogs::loading_screen, gui2::dialogs::preferences_dialog, gui2::dialogs::game_version, gui2::dialogs::network_transmission, gui2::dialogs::wml_error, gui2::dialogs::sp_options_configure, gui2::dialogs::game_cache_options, gui2::dialogs::campaign_difficulty, gui2::dialogs::editor_edit_label, gui2::dialogs::edit_text, gui2::dialogs::game_stats, gui2::dialogs::screenshot_notification, gui2::dialogs::depcheck_select_new, gui2::dialogs::folder_create, gui2::dialogs::theme_list, gui2::dialogs::unit_recall, gui2::dialogs::mp_method_selection, gui2::dialogs::addon_uninstall_list, gui2::dialogs::custom_tod, gui2::dialogs::core_selection, gui2::dialogs::editor_generate_map, gui2::dialogs::unit_attack, gui2::dialogs::unit_list, gui2::dialogs::addon_connect, gui2::dialogs::game_load, gui2::dialogs::mp_connect, gui2::dialogs::formula_debugger, gui2::dialogs::mp_alerts_options, gui2::dialogs::mp_change_control, gui2::dialogs::select_orb_colors, gui2::dialogs::editor_edit_scenario, gui2::dialogs::mp_staging, gui2::dialogs::gamestate_inspector, gui2::dialogs::faction_select, gui2::dialogs::mp_create_game, gui2::dialogs::story_viewer, gui2::dialogs::log_settings, gui2::dialogs::lobby_player_info, gui2::dialogs::hotkey_bind, gui2::dialogs::language_selection, gui2::dialogs::mp_login, gui2::dialogs::editor_edit_side, gui2::dialogs::mp_join_game, gui2::dialogs::outro, gui2::dialogs::server_info, gui2::dialogs::attack_predictions, gui2::dialogs::unit_recruit, gui2::dialogs::label_settings, gui2::dialogs::mp_match_history, gui2::dialogs::transient_message, gui2::dialogs::end_credits, gui2::dialogs::help_browser, gui2::dialogs::synched_choice_wait, gui2::dialogs::terrain_layers, gui2::dialogs::install_dependencies, gui2::dialogs::addon_license_prompt, gui2::dialogs::statistics_dialog, gui2::dialogs::unit_advance, gui2::dialogs::chat_log, gui2::dialogs::lua_interpreter, and gui2::dialogs::generator_settings.
Definition at line 238 of file modal_dialog.cpp.
Referenced by show().
|
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.
id | Id of the widget, same value as in WML. |
mandatory | Is the widget mandatory or mandatory. |
callback_load_value | The callback function to set the initial value of the widget. |
callback_save_value | The 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_change | When the value of the widget changes this callback is called. |
initial_fire |
Definition at line 128 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().
|
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.
id | Id of the widget, same value as in WML. |
mandatory | Is the widget mandatory or mandatory. |
linked_variable | The variable the widget is linked to. See field::field for more information. |
callback_change | When the value of the widget changes this callback is called. |
initial_fire |
Definition at line 148 of file modal_dialog.cpp.
|
inlineprotected |
Registers a new styled_widget as image.
Definition at line 326 of file modal_dialog.hpp.
References register_label().
|
protected |
Creates a new integer field.
See register_bool for more info.
Definition at line 161 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().
|
protected |
Creates a new integer field.
See register_bool for more info.
Definition at line 174 of file modal_dialog.cpp.
|
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.)
id | Id of the widget, same value as in WML. |
mandatory | Is the widget mandatory or optional. |
text | The text for the label. |
use_markup | Whether or not use markup for the label. |
Definition at line 217 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().
|
protected |
Creates a new text field.
See register_bool for more info.
Definition at line 184 of file modal_dialog.cpp.
References field(), fields_, and focus_.
Referenced by gui2::dialogs::lua_interpreter::pre_show(), gui2::dialogs::editor_generate_map::pre_show(), and set_show_even_without_video().
|
protected |
Creates a new text field.
See register_bool for more info.
Definition at line 202 of file modal_dialog.cpp.
|
inline |
Definition at line 200 of file modal_dialog.hpp.
References allow_plugin_skip_.
Referenced by gui2::dialogs::mp_lobby::mp_lobby().
|
inline |
Definition at line 190 of file modal_dialog.hpp.
References always_save_fields_.
Referenced by gui2::dialogs::mp_lobby::mp_lobby().
|
inline |
Definition at line 195 of file modal_dialog.hpp.
References restore_.
Referenced by gui2::dialogs::campaign_difficulty::campaign_difficulty(), gui2::dialogs::campaign_selection::campaign_selection(), gui2::dialogs::drop_down_menu::drop_down_menu(), gui2::dialogs::game_delete::game_delete(), gui2::dialogs::mp_host_game_prompt::mp_host_game_prompt(), gui2::dialogs::network_transmission::network_transmission(), gui2::dialogs::log_settings::pre_show(), gui2::dialogs::message::pre_show(), gui2::dialogs::wml_message_base::pre_show(), and gui2::show_transient_message().
void gui2::dialogs::modal_dialog::set_retval | ( | int | retval | ) |
Convenience wrapper to set the window's exit code.
Definition at line 121 of file modal_dialog.cpp.
References window_.
Referenced by gui2::dialogs::formula_debugger::callback_continue_button(), gui2::dialogs::formula_debugger::callback_next_button(), gui2::dialogs::formula_debugger::callback_step_button(), gui2::dialogs::formula_debugger::callback_stepout_button(), gui2::dialogs::game_load::delete_button_callback(), gui2::dialogs::unit_recall::dismiss_unit(), get_retval(), gui2::dialogs::title_screen::hotkey_callback_select_tests(), gui2::dialogs::mp_create_game::load_game_callback(), gui2::dialogs::drop_down_menu::mouse_up_callback(), gui2::dialogs::mp_join_game::network_handler(), gui2::dialogs::mp_staging::network_handler(), gui2::dialogs::title_screen::on_resize(), gui2::dialogs::mp_create_game::post_show(), gui2::dialogs::mp_lobby::pre_show(), gui2::dialogs::file_dialog::push_fileview_row(), and gui2::dialogs::hotkey_bind::sdl_event_callback().
|
inline |
Definition at line 205 of file modal_dialog.hpp.
References register_bool(), register_integer(), register_label(), register_text(), and show_even_without_video_.
Referenced by gui2::dialogs::mp_lobby::mp_lobby().
bool gui2::dialogs::modal_dialog::show | ( | const unsigned | auto_close_time = 0 | ) |
Shows the window.
auto_close_time | The time in ms after which the dialog will automatically close, if 0 it doesn't close. |
Definition at line 58 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(), cursor::NORMAL, gui2::OK, plugins_context::play_slice(), post_build(), post_show(), pre_show(), restore_, 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(), ng::depcheck::manager::change_era_dialog(), ng::depcheck::manager::change_scenario_dialog(), editor::context_manager::create_mask_to_dialog(), events::menu_handler::current_unit(), quit_confirmation::default_prompt(), gui2::dialogs::story_viewer::display(), events::console_handler::do_choose_level(), do_gameloop(), 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(), sp::select_campaign(), 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::show_transient_message(), 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().
|
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::drop_down_menu, gui2::dialogs::simple_item_selector, gui2::dialogs::campaign_selection, gui2::dialogs::network_transmission, gui2::dialogs::title_screen, gui2::dialogs::unit_create, gui2::dialogs::addon_manager, gui2::dialogs::loading_screen, gui2::dialogs::preferences_dialog, gui2::dialogs::game_version, gui2::dialogs::wml_error, gui2::dialogs::sp_options_configure, gui2::dialogs::game_cache_options, gui2::dialogs::game_save_oos, gui2::dialogs::campaign_difficulty, gui2::dialogs::editor_edit_label, gui2::dialogs::edit_text, gui2::dialogs::game_stats, gui2::dialogs::screenshot_notification, gui2::dialogs::depcheck_select_new, gui2::dialogs::folder_create, gui2::dialogs::game_load, gui2::dialogs::theme_list, gui2::dialogs::unit_recall, gui2::dialogs::mp_method_selection, gui2::dialogs::addon_uninstall_list, gui2::dialogs::custom_tod, gui2::dialogs::core_selection, gui2::dialogs::editor_generate_map, gui2::dialogs::editor_new_map, gui2::dialogs::unit_attack, gui2::dialogs::edit_label, gui2::dialogs::unit_list, gui2::dialogs::addon_connect, gui2::dialogs::depcheck_confirm_change, gui2::dialogs::editor_edit_side, gui2::dialogs::formula_debugger, gui2::dialogs::game_save_message, gui2::dialogs::gamestate_inspector, gui2::dialogs::mp_connect, gui2::dialogs::mp_join_game_password_prompt, gui2::dialogs::editor_edit_scenario, gui2::dialogs::mp_alerts_options, gui2::dialogs::mp_change_control, gui2::dialogs::select_orb_colors, gui2::dialogs::mp_staging, gui2::dialogs::faction_select, gui2::dialogs::mp_create_game, gui2::dialogs::story_viewer, gui2::dialogs::log_settings, gui2::dialogs::lobby_player_info, gui2::dialogs::hotkey_bind, gui2::dialogs::language_selection, gui2::dialogs::lua_interpreter, gui2::dialogs::mp_login, gui2::dialogs::chat_log, gui2::dialogs::mp_join_game, gui2::dialogs::outro, gui2::dialogs::server_info, gui2::dialogs::attack_predictions, gui2::dialogs::mp_host_game_prompt, gui2::dialogs::unit_recruit, gui2::dialogs::game_delete, gui2::dialogs::game_save, gui2::dialogs::label_settings, gui2::dialogs::mp_match_history, gui2::dialogs::generator_settings, gui2::dialogs::transient_message, gui2::dialogs::end_credits, gui2::dialogs::help_browser, gui2::dialogs::synched_choice_wait, gui2::dialogs::surrender_quit, gui2::dialogs::terrain_layers, gui2::dialogs::install_dependencies, gui2::dialogs::addon_license_prompt, gui2::dialogs::statistics_dialog, and gui2::dialogs::unit_advance.
Referenced by build_window(), and gui2::dialogs::unit_test_mark_as_tested().
|
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 140 of file test_gui2.cpp.
|
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 389 of file modal_dialog.hpp.
Referenced by set_allow_plugin_skip(), and show().
|
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 358 of file modal_dialog.hpp.
Referenced by set_always_save_fields(), and show().
|
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 367 of file modal_dialog.hpp.
Referenced by finalize_fields(), init_fields(), register_bool(), register_integer(), register_label(), and register_text().
|
private |
Contains the widget that should get the focus when the window is shown.
Definition at line 372 of file modal_dialog.hpp.
Referenced by init_fields(), and register_text().
|
private |
Restore the screen after showing?
Most windows should restore the display after showing so this value defaults to true. Toplevel windows (like the titlescreen don't want this behavior so they can change it in pre_show().
Definition at line 381 of file modal_dialog.hpp.
Referenced by set_restore(), and show().
|
private |
The window's exit code (return value).
We keep a copy here so it may be accessed even after the dialog is closed and the window object is destroyed.
This value is initially set to 0 (retval::NONE) meaning the dialog was not shown. After show returns, it will hold the most recent retval of the window object, including any modifications made in post_show.
Definition at line 348 of file modal_dialog.hpp.
Referenced by get_retval(), and show().
|
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 396 of file modal_dialog.hpp.
Referenced by set_show_even_without_video(), and show().
|
protected |
The window object build for this dialog.
Definition at line 335 of file modal_dialog.hpp.
Referenced by get_window(), set_retval(), and show().