The Battle for Wesnoth  1.15.12+dev
Public Member Functions | Private Member Functions | Private Attributes | List of all members
gui2::dialogs::label_settings Class Reference

#include <label_settings.hpp>

Inheritance diagram for gui2::dialogs::label_settings:

Public Member Functions

 label_settings (display_context &dc)
 
- Public Member Functions inherited from gui2::dialogs::modal_dialog
 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
 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)
 

Private Member Functions

virtual const std::string & window_id () const override
 The id of the window to build. More...
 
virtual void pre_show (window &window) override
 Actions to be taken before showing the window. More...
 
virtual void post_show (window &window) override
 Actions to be taken after the window has been shown. More...
 
void toggle_category (widget &box, const std::string &category)
 Callback for toggling a checkbox state. More...
 

Private Attributes

std::map< std::string, bool > all_labels_
 The execute function. More...
 
std::map< std::string, t_stringlabels_display_
 
display_contextviewer_
 

Additional Inherited Members

- Protected Member Functions inherited from gui2::dialogs::modal_dialog
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 inherited from gui2::dialogs::modal_dialog
std::unique_ptr< windowwindow_
 The window object build for this dialog. More...
 

Detailed Description

Definition at line 25 of file label_settings.hpp.

Constructor & Destructor Documentation

◆ label_settings()

gui2::dialogs::label_settings::label_settings ( display_context dc)

Member Function Documentation

◆ post_show()

void gui2::dialogs::label_settings::post_show ( window window)
overrideprivatevirtual

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 from gui2::dialogs::modal_dialog.

Definition at line 123 of file label_settings.cpp.

References all_labels_, gui2::dialogs::modal_dialog::get_retval(), display_context::hidden_label_categories(), gui2::OK, and viewer_.

◆ pre_show()

void gui2::dialogs::label_settings::pre_show ( window window)
overrideprivatevirtual

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 from gui2::dialogs::modal_dialog.

Definition at line 86 of file label_settings.cpp.

References gui2::listbox::add_row(), all_labels_, gui2::event::connect_signal_notify_modified(), preferences::grid(), labels_display_, gui2::styled_widget::set_use_markup(), gui2::toggle_button::set_value(), font::span_color(), game_config::tc_info(), display_context::teams(), toggle_category(), and viewer_.

◆ toggle_category()

void gui2::dialogs::label_settings::toggle_category ( widget box,
const std::string &  category 
)
private

Callback for toggling a checkbox state.

Definition at line 138 of file label_settings.cpp.

References all_labels_.

Referenced by pre_show().

◆ window_id()

virtual const std::string& gui2::dialogs::label_settings::window_id ( ) const
overrideprivatevirtual

The id of the window to build.

Implements gui2::dialogs::modal_dialog.

Member Data Documentation

◆ all_labels_

std::map<std::string, bool> gui2::dialogs::label_settings::all_labels_
private

The execute function.

See modal_dialog for more information.

Definition at line 34 of file label_settings.hpp.

Referenced by post_show(), pre_show(), and toggle_category().

◆ labels_display_

std::map<std::string, t_string> gui2::dialogs::label_settings::labels_display_
private

Definition at line 35 of file label_settings.hpp.

Referenced by pre_show().

◆ viewer_

display_context& gui2::dialogs::label_settings::viewer_
private

Definition at line 37 of file label_settings.hpp.

Referenced by post_show(), and pre_show().


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