The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
gui2::gui_definition Class Reference

A GUI theme definiton. 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_t
widget_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_window
window_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 definiton.

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 defintion 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 45 of file gui_definition.hpp.

Member Typedef Documentation

Definition at line 51 of file gui_definition.hpp.

Constructor & Destructor Documentation

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 32 of file gui_definition.cpp.

References config::child(), config::child_range(), DBG_GUI_P, description_, double_click_time_, t_string::empty(), ERR_GUI_P, has_helptip_message_, help_show_time_, id_, 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

void gui2::gui_definition::activate ( ) const

Member Data Documentation

t_string gui2::gui_definition::description_
private

Definition at line 65 of file gui_definition.hpp.

Referenced by gui_definition().

unsigned gui2::gui_definition::double_click_time_
private

Definition at line 70 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

t_string gui2::gui_definition::has_helptip_message_
private

Definition at line 78 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

unsigned gui2::gui_definition::help_show_time_
private

Definition at line 69 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

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

Definition at line 63 of file gui_definition.hpp.

Referenced by gui_definition().

unsigned gui2::gui_definition::popup_show_delay_
private

Definition at line 67 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

unsigned gui2::gui_definition::popup_show_time_
private

Definition at line 68 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

unsigned gui2::gui_definition::repeat_button_repeat_time_
private

Definition at line 71 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

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

Definition at line 73 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

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

Definition at line 76 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

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

Definition at line 74 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

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

Definition at line 75 of file gui_definition.hpp.

Referenced by activate(), and gui_definition().

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

Definition at line 80 of file gui_definition.hpp.

Referenced by activate().

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 54 of file gui_definition.hpp.

Referenced by gui_definition().

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 57 of file gui_definition.hpp.

Referenced by gui_definition().


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