The Battle for Wesnoth  1.19.0-dev
Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
gui2::gui_definition Class Reference

A GUI theme definition. More...

#include <gui_definition.hpp>

Public Types

using widget_definition_map_t = std::map< std::string, styled_widget_definition_ptr >
 

Public Member Functions

 gui_definition (const config &cfg)
 Private ctor. More...
 
void activate () const
 Activates this GUI. More...
 

Public Attributes

std::map< std::string, widget_definition_map_twidget_types
 Map of each widget type, by id, and a sub-map of each of the type's definitions, also by id. More...
 
std::map< std::string, builder_windowwindow_types
 Map of all known windows (the builder class builds a window). More...
 

Private Attributes

std::string id_
 
t_string description_
 
unsigned popup_show_delay_
 
unsigned popup_show_time_
 
unsigned help_show_time_
 
unsigned double_click_time_
 
unsigned repeat_button_repeat_time_
 
std::string sound_button_click_
 
std::string sound_toggle_button_click_
 
std::string sound_toggle_panel_click_
 
std::string sound_slider_adjust_
 
t_string has_helptip_message_
 
std::vector< game_tiptips_
 

Detailed Description

A GUI theme definition.

Each theme defines the appearance and layout of widgets and windows. At least one theme (the default) must exist for the game to run. That theme is expected to contain at least one default definition for each widget type and a layout for each window recorded in the static registry. Do note that a widget type may have any number of definitions defined per theme, but a window may only have one layout.

Non-default themes may omit a default widget definition or a window layout, in which case the game will fall back on the default definition (for widgets) or the layout (for windows) specified in the default theme.

Each widget definition and window layout may also define different variations of itself to be used based on the current game resolution.

As of December 2017 only the default theme is provided.

Definition at line 46 of file gui_definition.hpp.

Member Typedef Documentation

◆ widget_definition_map_t

Definition at line 52 of file gui_definition.hpp.

Constructor & Destructor Documentation

◆ gui_definition()

gui2::gui_definition::gui_definition ( const config cfg)
explicit

Private ctor.

Use create to initialize a new definition.

Parse widget definitions of each registered type.

Parse each window.

Todo:
Regarding sounds: Need to evaluate but probably we want the widget definition be able to:
  • Override the default (and clear it). This will allow toggle buttons in a listbox to sound like a toggle panel.
  • Override the default and above per instance of the widget, some buttons can give a different sound.

Definition at line 33 of file gui_definition.cpp.

References config::child_range(), DBG_GUI_P, description_, double_click_time_, t_string::empty(), ERR_GUI_P, has_helptip_message_, help_show_time_, id_, config::mandatory_child(), missing_mandatory_wml_key(), popup_show_delay_, popup_show_time_, gui2::registered_widget_types(), gui2::registered_window_types(), repeat_button_repeat_time_, sound_button_click_, sound_slider_adjust_, sound_toggle_button_click_, sound_toggle_panel_click_, VALIDATE, w, widget_types, and window_types.

Member Function Documentation

◆ activate()

void gui2::gui_definition::activate ( ) const

Member Data Documentation

◆ description_

t_string gui2::gui_definition::description_
private

Definition at line 66 of file gui_definition.hpp.

Referenced by gui_definition().

◆ double_click_time_

unsigned gui2::gui_definition::double_click_time_
private

Definition at line 71 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

◆ has_helptip_message_

t_string gui2::gui_definition::has_helptip_message_
private

Definition at line 79 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

◆ help_show_time_

unsigned gui2::gui_definition::help_show_time_
private

Definition at line 70 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

◆ id_

std::string gui2::gui_definition::id_
private

Definition at line 64 of file gui_definition.hpp.

Referenced by gui_definition().

◆ popup_show_delay_

unsigned gui2::gui_definition::popup_show_delay_
private

Definition at line 68 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

◆ popup_show_time_

unsigned gui2::gui_definition::popup_show_time_
private

Definition at line 69 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

◆ repeat_button_repeat_time_

unsigned gui2::gui_definition::repeat_button_repeat_time_
private

Definition at line 72 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

◆ sound_button_click_

std::string gui2::gui_definition::sound_button_click_
private

Definition at line 74 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

◆ sound_slider_adjust_

std::string gui2::gui_definition::sound_slider_adjust_
private

Definition at line 77 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

◆ sound_toggle_button_click_

std::string gui2::gui_definition::sound_toggle_button_click_
private

Definition at line 75 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

◆ sound_toggle_panel_click_

std::string gui2::gui_definition::sound_toggle_panel_click_
private

Definition at line 76 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

◆ tips_

std::vector<game_tip> gui2::gui_definition::tips_
private

Definition at line 81 of file gui_definition.hpp.

Referenced by activate().

◆ widget_types

std::map<std::string, widget_definition_map_t> gui2::gui_definition::widget_types

Map of each widget type, by id, and a sub-map of each of the type's definitions, also by id.

Definition at line 55 of file gui_definition.hpp.

Referenced by gui_definition().

◆ window_types

std::map<std::string, builder_window> gui2::gui_definition::window_types

Map of all known windows (the builder class builds a window).

Definition at line 58 of file gui_definition.hpp.

Referenced by gui_definition().


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