The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Namespaces | Classes | Typedefs | Functions | Variables
gui2 Namespace Reference

Generic file dialog. More...

Namespaces

 dialogs
 
 event
 
 implementation
 
 iteration
 
 policy
 Contains the policies for the generator class.
 
 settings
 This namespace contains the 'global' settings.
 
 tip_of_the_day
 

Classes

class  addon_list
 
struct  addon_list_definition
 
struct  builder_grid
 
struct  builder_widget
 Contains the info needed to instantiate a widget. More...
 
class  builder_window
 
class  button
 Simple push button. More...
 
struct  button_definition
 
class  canvas
 A simple canvas which can be drawn upon. More...
 
class  chatbox
 
struct  chatbox_definition
 
class  circle_shape
 Definition of a circle shape. More...
 
class  clickable_item
 Small concept class. More...
 
class  container_base
 A generic container base class. More...
 
class  control_NEW
 
class  drawing
 A widget to draw upon. More...
 
struct  drawing_definition
 
class  event_executor
 Event execution calls. More...
 
class  executor
 Helper to make removing a timer in a callback safe. More...
 
class  field
 Template class to implement the generic field implementation. More...
 
class  field_base
 Abstract base class for the fields. More...
 
class  field_bool
 Specialized field class for boolean. More...
 
class  field_label
 Specialized field class for a styled_widget, used for labels and images. More...
 
class  field_text
 Specialized field class for text. More...
 
class  game_tip
 The tips of day structure. More...
 
class  generator
 Basic template class to generate new items. More...
 
class  generator_base
 Abstract base class for the generator. More...
 
class  grid
 Base container class. More...
 
struct  grid_implementation
 Helper to implement private functions without modifying the header. More...
 
class  group
 
class  gui_definition
 A GUI definiton. More...
 
class  horizontal_scrollbar
 A horizontal scrollbar. More...
 
struct  horizontal_scrollbar_definition
 
class  image
 An image. More...
 
struct  image_definition
 
class  image_shape
 Definition of an image shape. More...
 
class  integer_selector
 Small abstract helper class. More...
 
struct  key_type
 Key type for the cache. More...
 
class  label
 Label showing a text. More...
 
struct  label_definition
 
struct  layout_exception_height_resize_failed
 Exception thrown when the height resizing has failed. More...
 
struct  layout_exception_resize_failed
 Basic exception when the layout doesn't fit. More...
 
struct  layout_exception_width_modified
 Exception thrown when the width has been modified during resizing. More...
 
struct  layout_exception_width_resize_failed
 Exception thrown when the width resizing has failed. More...
 
class  legacy_menu_item
 Implements simple parsing of legacy GUI1 item markup. More...
 
class  line_shape
 Definition of a line shape. More...
 
struct  linked_group_definition
 
class  listbox
 The listbox class. More...
 
struct  listbox_definition
 
struct  lobby_chat_window
 
class  matrix
 The matrix class. More...
 
struct  matrix_definition
 
class  menu_button
 Simple push button. More...
 
struct  menu_button_definition
 
class  minimap
 The basic minimap class. More...
 
struct  minimap_definition
 
class  multi_page
 The multi page class. More...
 
struct  multi_page_definition
 
class  multimenu_button
 Simple push button. More...
 
struct  multimenu_button_definition
 
class  notifiee
 Helper class to implement callbacks with lifetime management. More...
 
class  notifier
 Helper class to implement callbacks with lifetime management. More...
 
class  pane
 
struct  pane_implementation
 Helper to implement private functions without modifying the header. More...
 
class  panel
 Visible container to hold multiple widgets. More...
 
struct  panel_definition
 
class  password_box
 
class  placer_base
 Base class for the placement helper. More...
 
struct  point
 Holds a 2D point. More...
 
class  progress_bar
 
struct  progress_bar_definition
 
class  rectangle_shape
 Definition of a rectangle shape. More...
 
struct  registered_widget_parser
 
class  repeating_button
 
struct  repeating_button_definition
 
struct  resolution_definition
 Base class of a resolution, contains the common keys for a resolution. More...
 
class  round_rectangle_shape
 Definition of a rounded rectangle shape. More...
 
class  scroll_label
 Label showing a text. More...
 
struct  scroll_label_definition
 
class  scrollbar_base
 Base class for a scroll bar. More...
 
class  scrollbar_container
 Base class for creating containers with one or two scrollbar(s). More...
 
struct  scrollbar_container_implementation
 Helper to implement private functions without modifying the header. More...
 
class  scrollbar_panel
 Visible container to hold multiple widgets. More...
 
struct  scrollbar_panel_definition
 
class  selectable_item
 Small abstract helper class. More...
 
class  size_lock
 
struct  size_lock_definition
 
class  slider
 A slider. More...
 
struct  slider_definition
 
class  spacer
 An empty widget. More...
 
struct  spacer_definition
 
class  stacked_widget
 
struct  stacked_widget_definition
 
struct  stacked_widget_implementation
 
class  state_default
 
struct  state_definition
 Contains the state info for a resolution. More...
 
class  styled_widget
 Base class for all visible items. More...
 
struct  styled_widget_definition
 
class  text_box
 Class for a single line text area. More...
 
class  text_box_base
 Abstract base class for text items. More...
 
struct  text_box_definition
 
class  text_history
 Class for text input history. More...
 
class  text_shape
 Definition of a text shape. More...
 
struct  timer
 
class  toggle_button
 Class for a toggle button. More...
 
struct  toggle_button_definition
 
class  toggle_panel
 Class for a toggle button. More...
 
struct  toggle_panel_definition
 
class  tree_view
 
struct  tree_view_definition
 
class  tree_view_node
 
struct  tree_view_node_implementation
 
class  typed_formula
 Template class can hold a value or a formula to calculate the value. More...
 
class  unit_preview_pane
 
struct  unit_preview_pane_definition
 
class  unit_test_access_only
 Special helper class to get the list of registered windows. More...
 
struct  value_type
 Value type for the cache. More...
 
class  vertical_scrollbar
 A vertical scrollbar. More...
 
struct  vertical_scrollbar_definition
 
class  viewport
 
struct  viewport_implementation
 Helper to implement private functions without modifying the header. More...
 
class  widget
 Base class for all widgets. More...
 
class  window
 base class of top level items, the only item which needs to store the final canvases to draw on More...
 
struct  window_builder_invalid_id
 Helper struct to signal that get_window_builder failed. More...
 
struct  window_definition
 
struct  window_implementation
 Helper to implement private functions without modifying the header. More...
 

Typedefs

typedef field< int,
integer_selector
field_integer
 
typedef std::shared_ptr
< resolution_definition
resolution_definition_ptr
 
typedef std::shared_ptr< const
resolution_definition
resolution_definition_const_ptr
 
typedef std::shared_ptr
< styled_widget_definition
styled_widget_definition_ptr
 
typedef std::shared_ptr
< builder_widget
builder_widget_ptr
 
typedef std::shared_ptr< const
builder_widget
builder_widget_const_ptr
 
using widget_builder_func_t = std::function< builder_widget_ptr(config)>
 
typedef std::shared_ptr
< builder_grid
builder_grid_ptr
 
typedef std::shared_ptr< const
builder_grid
builder_grid_const_ptr
 
using generator_sort_array = std::array< generator_base::order_func, 2 >
 
typedef control_NEW
< state_default
tbase
 
typedef std::map< key_type,
value_type
tcache
 The cache. More...
 
using registered_widget_map = std::map< std::string, registered_widget_parser >
 
using widget_parser_t = std::function< styled_widget_definition_ptr(const config &)>
 Function type alias for register_widget. More...
 

Functions

template<class T >
bool sort (const pane::item &lhs, const pane::item &rhs, const std::string &tag, const bool ascending)
 
bool contains (const pane::item &item, const std::string &tag, const text_box &text_box)
 A filter testing whether a search string is used in a text. More...
 
template<class T >
T & get_parent (widget &child)
 Returns the first parent of a widget with a certain type. More...
 
template<class T >
T * find_widget (utils::const_clone_ptr< widget, T > widget, const std::string &id, const bool must_be_active, const bool must_exist)
 Gets a widget with the wanted id. More...
 
template<class T >
T & find_widget (utils::const_clone_ptr< widget, T > widget, const std::string &id, const bool must_be_active)
 Gets a widget with the wanted id. More...
 
void remove_from_window_stack (window *window)
 Removes a entry from the open_window_stack list. More...
 
bool is_in_dialog ()
 Is a dialog open? More...
 
std::vector
< linked_group_definition
parse_linked_group_definitions (const config &cfg)
 
std::ostream & operator<< (std::ostream &stream, const point &point)
 
static std::map< size_t, timer > & get_timers ()
 The active timers. More...
 
static Uint32 timer_callback (Uint32, void *id)
 
size_t add_timer (const Uint32 interval, const std::function< void(size_t id)> &callback, const bool repeat=false)
 Adds a new timer. More...
 
bool remove_timer (const size_t id)
 Removes a timer. More...
 
bool execute_timer (const size_t id)
 Executes a timer. More...
 
template<class T >
const T & cast (resolution_definition_const_ptr ptr)
 Casts a resolution_definition_const_ptr to another type. More...
 
static std::map< std::string,
widget_builder_func_t > & 
builder_widget_lookup ()
 
windowbuild (CVideo &video, const builder_window::window_resolution *res)
 Builds a window. More...
 
windowbuild (CVideo &video, const std::string &type)
 Builds a window. More...
 
void register_builder_widget (const std::string &id, widget_builder_func_t functor)
 Registers a widget to be build. More...
 
builder_widget_ptr create_builder_widget (const config &cfg)
 Create a widget builder. More...
 
widgetbuild_single_widget_instance_helper (const std::string &type, const config &cfg)
 Helper function to implement build_single_widget_instance. More...
 
template<typename T >
T * build_single_widget_instance (const std::string &type, const config &cfg=config())
 Builds a single widget instance of the given type with the specified attributes. More...
 
void show_message (CVideo &video, const std::string &title, const std::string &message, const std::string &button_caption="", const bool auto_close=true, const bool message_use_markup=false, const bool title_use_markup=false)
 Shows a message to the user. More...
 
int show_message (CVideo &video, const std::string &title, const std::string &message, const dialogs::message::button_style button_style, bool message_use_markup=false, bool title_use_markup=false)
 Shows a message to the user. More...
 
void show_error_message (CVideo &video, const std::string &message, bool message_use_markup=false)
 Shows an error message to the user. More...
 
void show_transient_message (CVideo &video, const std::string &title, const std::string &message, const std::string &image=std::string(), const bool message_use_markup=false, const bool title_use_markup=false, const bool restore_background=false)
 Shows a transient message to the user. More...
 
void show_transient_error_message (CVideo &video, const std::string &message, const std::string &image=std::string(), const bool message_use_markup=false)
 Shows a transient error message to the user. More...
 
void set_single_child (grid &grid, widget *widget)
 Sets the single child in a grid. More...
 
bool init ()
 Initializes the gui subsystems. More...
 
SDL_Rect create_rect (const point &origin, const point &size)
 Creates a rectangle. More...
 
font::pango_text::FONT_STYLE decode_font_style (const std::string &style)
 Converts a font style string to a font style. More...
 
color_t decode_color (const std::string &color)
 Converts a color string to a color. More...
 
PangoAlignment decode_text_alignment (const std::string &alignment)
 Converts a text alignment string to a text alignment. More...
 
std::string encode_text_alignment (const PangoAlignment alignment)
 Converts a text alignment to its string representation. More...
 
t_string missing_widget (const std::string &id)
 Returns a default error message if a mandatory widget is omitted. More...
 
void get_screen_size_variables (wfl::map_formula_callable &variable)
 Gets a formula object with the screen size. More...
 
wfl::map_formula_callable get_screen_size_variables ()
 Gets a formula object with the screen size. More...
 
point get_mouse_position ()
 Returns the current mouse position. More...
 
std::string debug_truncate (const std::string &text)
 Returns a truncated version of the text. More...
 
static bool operator< (const key_type &lhs, const key_type &rhs)
 
static bool compare (const std::pair< unsigned, tcache::iterator > &lhs, const std::pair< unsigned, tcache::iterator > &rhs)
 
static void shrink_cache ()
 
static void set_scrollbar_mode (grid *scrollbar_grid, scrollbar_base *scrollbar, scrollbar_container::scrollbar_mode &scrollbar_mode, const unsigned items, const unsigned visible_items, grid *content_grid)
 
static bool is_inserted_before (unsigned insertion_pos, unsigned old_item_count, unsigned old_position, unsigned visible_items)
 
static void adjust_scrollbar_mode (grid *scrollbar_grid, scrollbar_base *scrollbar, scrollbar_container::scrollbar_mode &scrollbar_mode, const unsigned items_before, const unsigned items_after, const int insertion_pos, const unsigned visible_items)
 
static std::set< std::string > & registered_window_types ()
 Notes on the registered widget and window lists. More...
 
static registered_widget_mapregistered_widget_types ()
 Returns the list of registered widgets. More...
 
void register_window (const std::string &id)
 Registers a window. More...
 
void load_settings ()
 Loads the setting for the theme. More...
 
void register_widget (const std::string &id, widget_parser_t f, const char *key=nullptr)
 Registers a widget. More...
 
resolution_definition_ptr get_control (const std::string &control_type, const std::string &definition)
 
const
builder_window::window_resolution
get_window_builder (const std::string &type)
 Returns an reference to the requested builder. More...
 
bool add_single_widget_definition (const std::string &widget_type, const std::string &definition_id, const config &cfg)
 
void remove_single_widget_definition (const std::string &widget_type, const std::string &definition_id)
 
void load_widget_definitions (gui_definition &gui, const std::string &definition_type, const std::vector< styled_widget_definition_ptr > &definitions)
 Loads the definitions of a widget. More...
 
static t_string default_value_label_generator (const std::vector< t_string > &value_labels, int item_position, int max)
 
template<typename T >
static utils::enable_if_t
< std::is_base_of
< selectable_item, T >::value,
std::string > 
default_status_value_getter (T &w)
 Default value getter for selectable widgets (like toggle buttons) More...
 
template<typename T >
static utils::enable_if_t
< std::is_base_of
< integer_selector, T >::value,
std::string > 
default_status_value_getter (T &w)
 Default value getter for integer-based widgets (like sliders) More...
 
template<typename W >
std::function< void()> bind_status_label (widget *find_in, const std::string &source_id, const std::function< std::string(W &)> value_getter=default_status_value_getter< W >, const std::string &label_id="")
 Creates a bound status label that will reflect the label state of a widget. More...
 
static tree_view_nodeadd_name_tree_node (tree_view_node &header_node, const std::string &type, const t_string &label, const t_string &tooltip="")
 
static std::string get_hp_tooltip (const utils::string_map &res, const std::function< int(const std::string &, bool)> &get)
 
static std::string get_mp_tooltip (int total_movement, std::function< int(t_translation::terrain_code)> get)
 
void swap_grid (grid *g, grid *content_grid, widget *widget, const std::string &id)
 Swaps an item in a grid for another one. More...
 
static bool is_active (const widget *wgt)
 
std::set< std::string > & unit_test_registered_window_list ()
 

Variables

std::vector< window * > open_window_stack {}
 Keeps track of any open windows of any type (modal, non-modal, or tooltip) in the order in which they were opened. More...
 
lg::log_domain log_gui_draw ("gui/draw")
 
lg::log_domain log_gui_event ("gui/event")
 
lg::log_domain log_gui_general ("gui/general")
 
lg::log_domain log_gui_iterator ("gui/iterator")
 
lg::log_domain log_gui_lifetime ("gui/lifetime")
 
lg::log_domain log_gui_layout ("gui/layout")
 
lg::log_domain log_gui_parse ("gui/parse")
 
static size_t next_timer_id = 0
 Ids for the timers. More...
 
static size_t executing_id = 0
 The id of the event being executed, 0 if none. More...
 
static bool executing_id_removed = false
 Did somebody try to remove the timer during its execution? More...
 
static color_t color_outdated {255, 127, 0}
 
static bool initialized_ = false
 
static const size_t cache_max_size = 100
 Maximum number of items in the cache (multiple of 4). More...
 
static const ::configterrain = nullptr
 The terrain used to create the cache. More...
 
static tcache cache
 
bool new_widgets = false
 Do we wish to use the new library or not. More...
 
static std::map< std::string,
gui_definition
guis
 Map with all known GUIs. More...
 
static auto current_gui = guis.end()
 Points to the current GUI. More...
 
static auto default_gui = guis.end()
 Points to the default GUI. More...
 

Detailed Description

Generic file dialog.

A class inherited from text_box that displays its input as stars.

Todo:
The items below are not implemented yet.
Note
it might be that tooltips will be shown independent of a window and in their own window, therefore the code will be cleaned up after that has been determined.

This provides UI elements for browsing the filesystem and choosing a file path to open or create, and optionally allows creating new directories or deleting existing files and directories.

Because of the sheer amount of unrelated options provided by this dialog, no parameter-based constructors or static execute() functions are provided. Use individual property setters after construction and before invoking show(), instead.

Todo:
This implementation is quite a hack that needs to be rewritten cleanly

Typedef Documentation

typedef std::shared_ptr< const builder_grid > gui2::builder_grid_const_ptr

Definition at line 157 of file window_builder.hpp.

typedef std::shared_ptr<builder_grid> gui2::builder_grid_ptr

Definition at line 156 of file window_builder.hpp.

typedef std::shared_ptr<const builder_widget> gui2::builder_widget_const_ptr

Definition at line 74 of file window_builder.hpp.

typedef std::shared_ptr<builder_widget> gui2::builder_widget_ptr

Definition at line 73 of file window_builder.hpp.

Definition at line 36 of file field-fwd.hpp.

Definition at line 382 of file generator.hpp.

using gui2::registered_widget_map = typedef std::map<std::string, registered_widget_parser>

Definition at line 92 of file settings.cpp.

Definition at line 74 of file widget_definition.hpp.

Definition at line 71 of file widget_definition.hpp.

Definition at line 112 of file widget_definition.hpp.

Definition at line 96 of file matrix.hpp.

typedef std::map<key_type, value_type> gui2::tcache

The cache.

Definition at line 136 of file minimap.cpp.

using gui2::widget_builder_func_t = typedef std::function<builder_widget_ptr(config)>

Definition at line 76 of file window_builder.hpp.

using gui2::widget_parser_t = typedef std::function<styled_widget_definition_ptr(const config&)>

Function type alias for register_widget.

Definition at line 71 of file settings.hpp.

Function Documentation

static tree_view_node& gui2::add_name_tree_node ( tree_view_node &  header_node,
const std::string &  type,
const t_string label,
const t_string tooltip = "" 
)
inlinestatic
bool gui2::add_single_widget_definition ( const std::string &  widget_type,
const std::string &  definition_id,
const config cfg 
)

Definition at line 643 of file settings.cpp.

References default_gui, and registered_widget_types().

Referenced by lua_gui2::intf_add_widget_definition().

size_t gui2::add_timer ( const Uint32  interval,
const std::function< void(size_t id)> &  callback,
const bool  repeat = false 
)

Adds a new timer.

Parameters
intervalThe timer interval in ms.
callbackThe function to call when the timer expires, the id send as parameter is the id of the timer.
repeatIf true the timer will restart after it expires.
Returns
The id of the timer.
Return values
[0]Failed to create a timer.

Definition at line 111 of file timer.cpp.

References gui2::timer::callback, DBG_GUI_E, gui2::event::find(), get_timers(), gui2::timer::interval, next_timer_id, gui2::timer::sdl_id, timer_callback(), and WRN_GUI_E.

Referenced by gui2::dialogs::outro::draw_callback(), gui2::dialogs::story_viewer::draw_floating_image(), gui2::dialogs::plugin_executor::plugin_executor(), gui2::dialogs::mp_staging::pre_show(), gui2::dialogs::mp_join_game::pre_show(), gui2::dialogs::loading_screen::pre_show(), gui2::dialogs::mp_lobby::pre_show(), gui2::repeating_button::signal_handler_left_button_down(), gui2::event::mouse_motion::start_hover_timer(), and gui2::text_box_base::toggle_cursor_timer().

static void gui2::adjust_scrollbar_mode ( grid *  scrollbar_grid,
scrollbar_base *  scrollbar,
scrollbar_container::scrollbar_mode &  scrollbar_mode,
const unsigned  items_before,
const unsigned  items_after,
const int  insertion_pos,
const unsigned  visible_items 
)
static
template<typename W >
std::function<void()> gui2::bind_status_label ( widget *  find_in,
const std::string &  source_id,
const std::function< std::string(W &)>  value_getter = default_status_value_getter<W>,
const std::string &  label_id = "" 
)

Creates a bound status label that will reflect the label state of a widget.

The initial label value is set here, and then again any time the widget is modified. A function is also returned that can be called to update the label manually.

This relies on hooking into the NOTIFY_MODIFIED event, so can only be used with widgets that fire that event.

Parameters
find_inThe containing widget (usually a window or grid) in which to find the source and status label widgets.
source_idThe ID of the source widget.
value_getterFunctor to process the value of the source widget.
label_idThe ID of the status label widget.
Returns
The callback function used to update the status label's value.

Definition at line 64 of file status_label_helper.hpp.

References gui2::event::connect_signal_notify_modified().

window * gui2::build ( CVideo video,
const builder_window::window_resolution *  definition 
)
window * gui2::build ( CVideo video,
const std::string &  type 
)

Builds a window.

Parameters
videoThe frame buffer to draw upon.
typeThe type id string of the window, this window must be registered at startup.

Definition at line 105 of file window_builder.cpp.

References build(), get_window_builder(), and gui2::widget::set_id().

template<typename T >
T* gui2::build_single_widget_instance ( const std::string &  type,
const config cfg = config() 
)

Builds a single widget instance of the given type with the specified attributes.

This should be used in place of creating a widget object directly, as it allows the widget-specific builder code to be executed.

Template Parameters
TThe final widget type. The widget pointer will be cast to this.
Parameters
typeString ID of the widget type.
cfgData config to pass to the widget's builder.

Definition at line 122 of file window_builder.hpp.

References build_single_widget_instance_helper().

widget * gui2::build_single_widget_instance_helper ( const std::string &  type,
const config cfg 
)

Helper function to implement build_single_widget_instance.

This keeps the main logic in the implementation despite said function being a template and therefor needing to be fully implemented in the declaration.

Definition at line 206 of file window_builder.cpp.

References builder_widget_lookup(), and VALIDATE.

Referenced by build_single_widget_instance().

static std::map<std::string, widget_builder_func_t>& gui2::builder_widget_lookup ( )
static
template<class T >
const T& gui2::cast ( resolution_definition_const_ptr  ptr)

Casts a resolution_definition_const_ptr to another type.

Template Parameters
TThe type to cast to, the non const version.
Parameters
ptrThe pointer to cast.
Returns
A reference to type casted to.

Definition at line 86 of file widget_definition.hpp.

static bool gui2::compare ( const std::pair< unsigned, tcache::iterator > &  lhs,
const std::pair< unsigned, tcache::iterator > &  rhs 
)
static

Definition at line 139 of file minimap.cpp.

Referenced by shrink_cache().

bool gui2::contains ( const pane::item &  item,
const std::string &  tag,
const text_box &  text_box 
)
inline

A filter testing whether a search string is used in a text.

The comparison is a lower-case comparison.

The function is expected to be used as a functor for gui2::pane::filter().

Parameters
itemThe pane item to search in.
tagThe tag of the field containing the text to search in.
Note
This text field should already contain lower-cased text only.
Parameters
text_boxA text box object whose text is the search string. The text in the text box will be converted to lower-cased text before the comparison is done.
Returns
Whether or not the comparison found a match.

Definition at line 64 of file filter.hpp.

References utf8::lowercase(), gui2::pane::item::tags, and gui2::text_box_base::text().

Referenced by arrow::path_contains().

builder_widget_ptr gui2::create_builder_widget ( const config cfg)

Create a widget builder.

This object holds the instance builder for a single widget.

Parameters
cfgThe config object holding the information regarding the widget instance.
Returns
The builder for the widget instance.

Definition at line 126 of file window_builder.cpp.

References config::all_children_range(), builder_widget_lookup(), c, config::child(), FAIL, config::ordered_begin(), TRY, and VALIDATE.

Referenced by gui2::builder_grid::builder_grid(), and gui2::implementation::builder_size_lock::builder_size_lock().

SDL_Rect gui2::create_rect ( const point &  origin,
const point &  size 
)

Creates a rectangle.

Parameters
originThe top left corner.
sizeThe width (x) and height (y).
Returns
SDL_Rect with the proper rectangle.

Definition at line 46 of file helper.cpp.

References gui2::point::x, and gui2::point::y.

Referenced by gui2::widget::get_rectangle().

std::string gui2::debug_truncate ( const std::string &  text)

Returns a truncated version of the text.

For debugging it's sometimes useful to get a part of the label of the widget. This function shows the first part.

Parameters
textThe text to truncate.
Returns
The truncated text.

Definition at line 139 of file helper.cpp.

Referenced by gui2::styled_widget::calculate_best_size(), font::pango_text::calculate_size(), gui2::styled_widget::get_best_text_size(), gui2::styled_widget::impl_draw_background(), and gui2::styled_widget::request_reduce_width().

color_t gui2::decode_color ( const std::string &  color)

Converts a color string to a color.

Parameters
colorA color string see http://www.wesnoth.org/wiki/GUIVariable for more info.
Returns
The color.

Definition at line 73 of file helper.cpp.

References color_t::from_rgba_string().

font::pango_text::FONT_STYLE gui2::decode_font_style ( const std::string &  style)

Converts a font style string to a font style.

Parameters
styleA font style string see http://www.wesnoth.org/wiki/GUIVariable for more info.
Returns
The font style.

Definition at line 51 of file helper.cpp.

References ERR_GUI_G, font::pango_text::STYLE_BOLD, font::pango_text::STYLE_ITALIC, font::pango_text::STYLE_LIGHT, font::pango_text::STYLE_NORMAL, and font::pango_text::STYLE_UNDERLINE.

PangoAlignment gui2::decode_text_alignment ( const std::string &  alignment)

Converts a text alignment string to a text alignment.

Parameters
alignmentAn alignment string see http://www.wesnoth.org/wiki/GUIVariable for more info.
Returns
The text alignment.

Definition at line 78 of file helper.cpp.

References ERR_GUI_E.

Referenced by gui2::typed_formula< T >::convert(), gui2::dialogs::story_viewer::display_part(), gui2::typed_formula< T >::execute(), and gui2::styled_widget::set_members().

template<typename T >
static utils::enable_if_t<std::is_base_of<selectable_item, T>::value, std::string> gui2::default_status_value_getter ( T &  w)
inlinestatic

Default value getter for selectable widgets (like toggle buttons)

Definition at line 32 of file status_label_helper.hpp.

References _().

template<typename T >
static utils::enable_if_t<std::is_base_of<integer_selector, T>::value, std::string> gui2::default_status_value_getter ( T &  w)
inlinestatic

Default value getter for integer-based widgets (like sliders)

Definition at line 42 of file status_label_helper.hpp.

static t_string gui2::default_value_label_generator ( const std::vector< t_string > &  value_labels,
int  item_position,
int  max 
)
static

Definition at line 312 of file slider.cpp.

Referenced by gui2::slider::set_value_labels().

std::string gui2::encode_text_alignment ( const PangoAlignment  alignment)

Converts a text alignment to its string representation.

Parameters
alignmentAn alignment.
Returns
An alignment string see http://www.wesnoth.org/wiki/GUIVariable for more info.

Definition at line 93 of file helper.cpp.

Referenced by gui2::styled_widget::update_canvas().

bool gui2::execute_timer ( const size_t  id)

Executes a timer.

Note
this function is only meant to be executed by the event handling system.
Parameters
idThe id of the timer to execute, this is the id returned by add_timer.
Returns
Status, false if the timer couldn't be executed.

Definition at line 174 of file timer.cpp.

References DBG_GUI_E, get_timers(), and LOG_GUI_E.

Referenced by gui2::event::sdl_event_handler::handle_event().

template<class T >
T* gui2::find_widget ( utils::const_clone_ptr< widget, T >  widget,
const std::string &  id,
const bool  must_be_active,
const bool  must_exist 
)

Gets a widget with the wanted id.

This template function doesn't return a pointer to a generic widget but returns the wanted type and tests for its existence if required.

Parameters
widgetThe widget test or find a child with the wanted id.
idThe id of the widget to find.
must_be_activeThe widget should be active, not all widgets have an active flag, those who don't ignore flag.
must_existThe widget should be exist, the function will fail if the widget doesn't exist or is inactive and must be active. Upon failure a wml_error is thrown.
Returns
The widget with the id.

Definition at line 68 of file find_widget.hpp.

References missing_widget(), and VALIDATE.

template<class T >
T& gui2::find_widget ( utils::const_clone_ptr< widget, T >  widget,
const std::string &  id,
const bool  must_be_active 
)

Gets a widget with the wanted id.

This template function doesn't return a reference to a generic widget but returns a reference to the wanted type

Parameters
widgetThe widget test or find a child with the wanted id.
idThe id of the widget to find.
must_be_activeThe widget should be active, not all widgets have an active flag, those who don't ignore flag.
Returns
The widget with the id.

Definition at line 95 of file find_widget.hpp.

resolution_definition_ptr gui2::get_control ( const std::string &  control_type,
const std::string &  definition 
)
static std::string gui2::get_hp_tooltip ( const utils::string_map res,
const std::function< int(const std::string &, bool)> &  get 
)
inlinestatic
point gui2::get_mouse_position ( )
static std::string gui2::get_mp_tooltip ( int  total_movement,
std::function< int(t_translation::terrain_code)>  get 
)
inlinestatic
template<class T >
T& gui2::get_parent ( widget &  child)

Returns the first parent of a widget with a certain type.

Parameters
childThe widget to get the parent from,
Template Parameters
TThe class of the widget to return.
Returns
The parent widget.

Definition at line 34 of file find_widget.hpp.

References gui2::widget::parent(), and w.

void gui2::get_screen_size_variables ( wfl::map_formula_callable variable)

Gets a formula object with the screen size.

Parameters
variableA formula object in which the screen_width, screen_height, gamemap_width and gamemap_height variable will set to the current values of these in settings. It modifies the object send.

Definition at line 114 of file helper.cpp.

References wfl::map_formula_callable::add(), gui2::settings::gamemap_height, gui2::settings::gamemap_width, gui2::settings::gamemap_x_offset, gui2::settings::screen_height, and gui2::settings::screen_width.

Referenced by gui2::implementation::builder_size_lock::build(), gui2::implementation::builder_drawing::build(), gui2::spacer::calculate_best_size(), gui2::canvas::draw(), get_screen_size_variables(), and gui2::window::layout().

wfl::map_formula_callable gui2::get_screen_size_variables ( )

Gets a formula object with the screen size.

Returns
Formula object with the screen_width, screen_height, gamemap_width and gamemap_height variable set to the current values of these in settings.

Definition at line 123 of file helper.cpp.

References get_screen_size_variables().

static std::map<size_t, timer>& gui2::get_timers ( )
static

The active timers.

Definition at line 42 of file timer.cpp.

Referenced by add_timer(), execute_timer(), remove_timer(), and timer_callback().

const builder_window::window_resolution & gui2::get_window_builder ( const std::string &  type)

Returns an reference to the requested builder.

The builder is determined by the type and the current screen resolution.

Precondition
There is a valid builder for type at the current resolution.
Exceptions
window_builder_invalid_idWhen the precondition is violated.
Parameters
typeThe type of builder window to get.
Returns
An iterator to the requested builder.

Definition at line 602 of file settings.cpp.

References current_gui, default_gui, gui2::window::update_screen_size(), VALIDATE, gui2::builder_window::window_resolution::window_height, and gui2::builder_window::window_resolution::window_width.

Referenced by build().

bool gui2::init ( )
static bool gui2::is_active ( const widget *  wgt)
static
bool gui2::is_in_dialog ( )

Is a dialog open?

Note
added as backwards compatibility for gui::is_in_dialog.

Definition at line 1039 of file handler.cpp.

References open_window_stack.

Referenced by gui::dialog_manager::dialog_manager(), gui::in_dialog(), and gui::dialog_manager::~dialog_manager().

static bool gui2::is_inserted_before ( unsigned  insertion_pos,
unsigned  old_item_count,
unsigned  old_position,
unsigned  visible_items 
)
static

Definition at line 350 of file scrollbar_container.cpp.

Referenced by adjust_scrollbar_mode().

void gui2::load_settings ( )
void gui2::load_widget_definitions ( gui_definition &  gui,
const std::string &  definition_type,
const std::vector< styled_widget_definition_ptr > &  definitions 
)

Loads the definitions of a widget.

Parameters
guiThe gui definition the widget definition belongs to.
definition_typeThe type of the widget whose definitions are to be loaded.
definitionsThe definitions serialized from a config object.
t_string gui2::missing_widget ( const std::string &  id)

Returns a default error message if a mandatory widget is omitted.

Parameters
idThe id of the omitted widget.
Returns
The error message.

Definition at line 109 of file helper.cpp.

References vgettext().

Referenced by gui2::dialogs::mp_options_helper::add_node_and_get_widget(), and find_widget().

static bool gui2::operator< ( const key_type &  lhs,
const key_type &  rhs 
)
static

Definition at line 90 of file minimap.cpp.

References gui2::key_type::h, gui2::key_type::map_data, and gui2::key_type::w.

std::ostream & gui2::operator<< ( std::ostream &  stream,
const point &  point 
)

Definition at line 38 of file point.cpp.

References gui2::point::x, and gui2::point::y.

std::vector< linked_group_definition > gui2::parse_linked_group_definitions ( const config cfg)
void gui2::register_builder_widget ( const std::string &  id,
widget_builder_func_t  functor 
)

Registers a widget to be build.

Warning
This function runs before main() so needs to be careful regarding the static initialization problem.
Parameters
idThe id of the widget as used in WML.
functorThe functor to create the widget.

Definition at line 121 of file window_builder.cpp.

References builder_widget_lookup().

void gui2::register_widget ( const std::string &  id,
widget_parser_t  f,
const char *  key = nullptr 
)

Registers a widget.

This function registers the available widgets defined in WML. All widgets need to register themselves before gui2::init) is called.

Warning
This function runs before main() so needs to be careful regarding the static initialization problem.
Parameters
idThe id of the widget to register.
fThe function to parse the definition config.
keyThe tagname from which to read the widget's definition in the game config. If nullptr the default [<id>_definition] is used.

Definition at line 490 of file settings.cpp.

References f, and registered_widget_types().

void gui2::register_window ( const std::string &  id)

Registers a window.

This function registers the available windows defined in WML. All windows need to register themselves before gui2::init) is called.

Warning
This function runs before main() so needs to be careful regarding the static initialization problem.
Note
Double registering a window can't hurt, but no way to probe for it, this can be added if needed. The same for an unregister function.
Parameters
idThe id of the window to register.

Definition at line 434 of file settings.cpp.

References registered_window_types(), and WRN_GUI_P.

static registered_widget_map& gui2::registered_widget_types ( )
static

Returns the list of registered widgets.

Definition at line 95 of file settings.cpp.

Referenced by add_single_widget_definition(), gui2::gui_definition::read(), and register_widget().

static std::set<std::string>& gui2::registered_window_types ( )
static

Notes on the registered widget and window lists.

These lists are GUI-independent. They represent the widgets and windows registered from the C++ interface with register_widget or .

Also note these cannot be free-standing static data members within this file since that causes a crash for some reason.Returns the list of registered windows.

Definition at line 80 of file settings.cpp.

Referenced by gui2::unit_test_access_only::get_registered_window_list(), gui2::gui_definition::read(), and register_window().

void gui2::remove_from_window_stack ( window *  window)

Removes a entry from the open_window_stack list.

This should be used instead of pop_back.

Definition at line 1029 of file handler.cpp.

References next, and open_window_stack.

Referenced by gui2::dialogs::modeless_dialog::hide().

void gui2::remove_single_widget_definition ( const std::string &  widget_type,
const std::string &  definition_id 
)

Definition at line 660 of file settings.cpp.

References default_gui.

Referenced by lua_kernel_base::~lua_kernel_base().

bool gui2::remove_timer ( const size_t  id)

Removes a timer.

It's save to remove a timer in its own callback, only the value returned might not be accurate. The destruction is postponed until the execution is finished and the return value is whether the postponing was successful.

Parameters
idThe id of the timer to remove, this is the id returned by add_timer.
Returns
Status, false if the timer couldn't be removed.

Definition at line 143 of file timer.cpp.

References DBG_GUI_E, get_timers(), and LOG_GUI_E.

Referenced by gui2::dialogs::loading_screen::clear_timer(), gui2::dialogs::mp_staging::post_show(), gui2::dialogs::outro::post_show(), gui2::dialogs::mp_join_game::post_show(), gui2::dialogs::mp_lobby::post_show(), gui2::repeating_button::set_state(), gui2::repeating_button::signal_handler_left_button_up(), gui2::event::mouse_motion::stop_hover_timer(), gui2::text_box_base::toggle_cursor_timer(), gui2::executor::~executor(), gui2::dialogs::mp_join_game::~mp_join_game(), gui2::dialogs::mp_lobby::~mp_lobby(), gui2::dialogs::mp_staging::~mp_staging(), gui2::dialogs::plugin_executor::~plugin_executor(), gui2::repeating_button::~repeating_button(), and gui2::dialogs::story_viewer::~story_viewer().

static void gui2::set_scrollbar_mode ( grid *  scrollbar_grid,
scrollbar_base *  scrollbar,
scrollbar_container::scrollbar_mode &  scrollbar_mode,
const unsigned  items,
const unsigned  visible_items,
grid *  content_grid 
)
static
void gui2::set_single_child ( grid &  grid,
widget *  widget 
)

Sets the single child in a grid.

The function initializes the grid to 1 x 1 and adds the widget with the grow to client flags.

Parameters
gridThe grid to add the child to.
widgetThe widget to add as child to the grid.

Definition at line 1106 of file grid.cpp.

References gui2::grid::HORIZONTAL_GROW_SEND_TO_CLIENT, gui2::grid::set_child(), gui2::grid::set_rows_cols(), and gui2::grid::VERTICAL_GROW_SEND_TO_CLIENT.

void gui2::show_error_message ( CVideo video,
const std::string &  message,
bool  message_use_markup = false 
)

Shows an error message to the user.

Parameters
videoThe video which contains the surface to draw upon.
messageThe message to show in the dialog.
message_use_markupUse markup for the message?

Definition at line 207 of file message.cpp.

References _(), lg::err(), lg::general(), LOG_STREAM, gui2::dialogs::message::ok_button, and show_message().

Referenced by ad_hoc_addon_fetch_session(), editor::context_manager::apply_mask_dialog(), savegame::savegame::check_filename(), savegame::loadgame::check_version_compatibility(), gui2::dialogs::game_cache_options::clean_cache_callback(), editor::context_manager::create_mask_to_dialog(), editor::editor_controller::custom_tods_dialog(), gui2::dialogs::addon_manager::delete_addon(), gui2::dialogs::mp_lobby::do_game_join(), sp::enter_create_mode(), enter_lobby_mode(), gui2::dialogs::addon_manager::fetch_addons_list(), editor::context_manager::generate_map_dialog(), game_launcher::init_lua_script(), addons_client::install_addon(), game_launcher::launch_game(), playsingle_controller::hotkey_handler::load_autosave(), game_launcher::load_game(), savegame::loadgame::load_game(), savegame::loadgame::load_game_ingame(), savegame::loadgame::load_multiplayer_game(), campaign_controller::play_game(), game_launcher::play_multiplayer(), gui2::dialogs::title_screen::pre_show(), gui2::dialogs::addon_manager::publish_addon(), gui2::dialogs::game_cache_options::purge_cache_callback(), savegame::savegame::save_game(), wml_exception::show(), addons_client::try_fetch_addon(), and gui2::dialogs::addon_manager::uninstall_addon().

void gui2::show_message ( CVideo video,
const std::string &  title,
const std::string &  message,
const std::string &  button_caption = "",
const bool  auto_close = true,
const bool  message_use_markup = false,
const bool  title_use_markup = false 
)

Shows a message to the user.

Normally the dialog won't have a button only when the text doesn't fit in the dialog and a scrollbar is used the button will be shown.

Parameters
videoThe video which contains the surface to draw upon.
titleThe title of the dialog.
messageThe message to show in the dialog.
button_captionThe caption of the close button.
auto_closeWhen true the window will hide the ok button when the message doesn't need a scrollbar to show itself.
message_use_markupUse markup for the message?
title_use_markupUse markup for the title?

Definition at line 152 of file message.cpp.

References gui2::dialogs::message::ok, gui2::dialogs::message::set_button_caption(), and gui2::dialogs::modal_dialog::show().

Referenced by gui2::dialogs::preferences_dialog::add_hotkey_callback(), savegame::savegame::check_overwrite(), savegame::loadgame::check_version_compatibility(), gui2::dialogs::game_cache_options::clean_cache_callback(), editor::context_manager::confirm_discard(), gui2::dialogs::file_dialog::confirm_overwrite(), gui2::dialogs::addon_manager::delete_addon(), gui2::dialogs::unit_recall::dismiss_unit(), addons_client::do_check_before_overwriting_addon(), addons_client::do_resolve_addon_dependencies(), events::menu_handler::do_search(), events::console_handler::do_undiscover(), events::console_handler::do_unsafe_lua(), events::menu_handler::end_turn(), gui2::dialogs::addon_manager::execute_default_action(), gui2::dialogs::handle_addon_requirements_gui(), gui2::dialogs::file_dialog::on_file_delete_cmd(), open_connection(), campaign_controller::play_game(), gui2::dialogs::addon_manager::publish_addon(), gui2::dialogs::game_cache_options::purge_cache_callback(), show_error_message(), lua_gui2::show_message_box(), quit_confirmation::show_prompt(), gui2::label::signal_handler_left_button_click(), and gui2::label::signal_handler_right_button_click().

int gui2::show_message ( CVideo video,
const std::string &  title,
const std::string &  message,
const dialogs::message::button_style  button_style,
bool  message_use_markup = false,
bool  title_use_markup = false 
)

Shows a message to the user.

Note
this function is rather untested, and the API might change in the near future.
Parameters
videoThe video which contains the surface to draw upon.
titleThe title of the dialog.
messageThe message to show in the dialog.
button_styleThe style of the button(s) shown.
message_use_markupUse markup for the message?
title_use_markupUse markup for the title?
Returns
The retval of the dialog shown.

Definition at line 165 of file message.cpp.

References _(), gui2::dialogs::message::auto_close, gui2::dialogs::message::cancel, gui2::dialogs::message::cancel_button, gui2::dialogs::message::close_button, gui2::dialogs::modal_dialog::get_retval(), gui2::dialogs::message::ok, gui2::dialogs::message::ok_button, gui2::dialogs::message::ok_cancel_buttons, gui2::dialogs::message::set_button_caption(), gui2::dialogs::message::set_button_visible(), gui2::dialogs::modal_dialog::show(), gui2::widget::visible, and gui2::dialogs::message::yes_no_buttons.

void gui2::show_transient_error_message ( CVideo video,
const std::string &  message,
const std::string &  image = std::string(),
const bool  message_use_markup = false 
)

Shows a transient error message to the user.

This shows a dialog with a short message which can be dismissed with a single click.

Parameters
videoThe video which contains the surface to draw upon.
messageThe message to show in the dialog.
imageAn image to show in the dialog.
message_use_markupUse markup for the message?

Definition at line 74 of file transient_message.cpp.

References _(), lg::err(), lg::general(), LOG_STREAM, and show_transient_message().

Referenced by gui2::dialogs::mp_create_game::dialog_exit_hook(), savegame::loadgame::load_multiplayer_game(), gui2::dialogs::file_dialog::on_dir_create_cmd(), gui2::dialogs::file_dialog::on_file_delete_cmd(), gui2::dialogs::file_dialog::process_submit_common(), gui2::dialogs::preferences_dialog::remove_friend_list_entry(), and events::menu_handler::save_map().

void gui2::show_transient_message ( CVideo video,
const std::string &  title,
const std::string &  message,
const std::string &  image = std::string(),
const bool  message_use_markup = false,
const bool  title_use_markup = false,
const bool  restore_background = false 
)

Shows a transient message to the user.

This shows a dialog with a short message which can be dismissed with a single click.

Note
The message should be small enough to fit on the window, the text can contain newlines and will wrap when needed.
Parameters
videoThe video which contains the surface to draw upon.
titleThe title of the dialog.
messageThe message to show in the dialog.
imageAn image to show in the dialog.
message_use_markupUse markup for the message?
title_use_markupUse markup for the title?
restore_backgroundRestore the background to the state it was before the message appeared

Definition at line 59 of file transient_message.cpp.

References gui2::dialogs::modal_dialog::set_restore(), and gui2::dialogs::modal_dialog::show().

Referenced by gui2::dialogs::preferences_dialog::add_friend_list_entry(), editor::context_manager::apply_mask_dialog(), editor::context_manager::check_switch_open_map(), editor::context_manager::create_mask_to_dialog(), gui2::dialogs::preferences_dialog::default_hotkey_callback(), gui2::dialogs::addon_manager::delete_addon(), events::menu_handler::do_recruit(), events::console_handler::do_show_var(), events::menu_handler::end_turn(), gui2::dialogs::game_stats::execute(), gui2::dialogs::game_load::execute(), gui2::dialogs::unit_list::execute(), editor::context_manager::generate_map_dialog(), help::help_browser::handle_event(), gui2::dialogs::addon_manager::load_addon_list(), editor::context_manager::load_map(), savegame::loadgame::load_multiplayer_game(), editor::editor_controller::main_loop(), events::mouse_handler::move_unit_along_route(), gui2::dialogs::mp_join_game::network_handler(), game_launcher::play_multiplayer(), playsingle_controller::play_scenario(), playsingle_controller::play_scenario_init(), gui2::dialogs::mp_create_game::pre_show(), gui2::dialogs::addon_manager::publish_addon(), events::menu_handler::recall(), events::menu_handler::recruit(), gui2::dialogs::preferences_dialog::remove_friend_list_entry(), savegame::savegame::save_game(), events::menu_handler::save_map(), editor::context_manager::save_map_as(), editor::context_manager::save_scenario_as(), events::mouse_handler::show_attack_dialog(), campaign_controller::show_carryover_message(), help::show_help(), play_controller::show_objectives(), lua_gui2::show_popup_dialog(), preferences::show_theme_dialog(), show_transient_error_message(), playsingle_controller::show_turn_dialog(), editor::context_manager::write_map(), and editor::context_manager::write_scenario().

static void gui2::shrink_cache ( )
static

Definition at line 145 of file minimap.cpp.

References cache, cache_max_size, compare(), DBG_GUI_D, and mp_ui_alerts::items.

Referenced by gui2::minimap::get_image().

template<class T >
bool gui2::sort ( const pane::item &  lhs,
const pane::item &  rhs,
const std::string &  tag,
const bool  ascending 
)
inline

Definition at line 31 of file filter.hpp.

References lexical_cast(), and gui2::pane::item::tags.

void gui2::swap_grid ( grid *  g,
grid *  content_grid,
widget *  widget,
const std::string &  id 
)

Swaps an item in a grid for another one.

Definition at line 25 of file widget_helpers.cpp.

References g, gui2::widget::parent(), gui2::widget::set_id(), and gui2::grid::swap_child().

Referenced by gui2::stacked_widget::finalize(), gui2::multi_page::finalize(), and gui2::listbox::finalize().

static Uint32 gui2::timer_callback ( Uint32  ,
void *  id 
)
static

Definition at line 87 of file timer.cpp.

References DBG_GUI_E, get_timers(), and TIMER_EVENT.

Referenced by add_timer().

std::set<std::string>& gui2::unit_test_registered_window_list ( )

Variable Documentation

tcache gui2::cache
static
const size_t gui2::cache_max_size = 100
static

Maximum number of items in the cache (multiple of 4).

No testing on the optimal number is done, just seems a nice number.

Definition at line 124 of file minimap.cpp.

Referenced by gui2::minimap::get_image(), and shrink_cache().

color_t gui2::color_outdated {255, 127, 0}
static

Definition at line 54 of file addon_list.cpp.

Referenced by gui2::addon_list::colorize_addon_state_string().

auto gui2::current_gui = guis.end()
static

Points to the current GUI.

Definition at line 429 of file settings.cpp.

Referenced by get_control(), get_window_builder(), and load_settings().

auto gui2::default_gui = guis.end()
static

Points to the default GUI.

Definition at line 432 of file settings.cpp.

Referenced by add_single_widget_definition(), get_control(), get_window_builder(), load_settings(), and remove_single_widget_definition().

size_t gui2::executing_id = 0
static

The id of the event being executed, 0 if none.

Definition at line 48 of file timer.cpp.

Referenced by gui2::executor::~executor().

bool gui2::executing_id_removed = false
static

Did somebody try to remove the timer during its execution?

Definition at line 51 of file timer.cpp.

std::map<std::string, gui_definition> gui2::guis
static

Map with all known GUIs.

Definition at line 426 of file settings.cpp.

bool gui2::initialized_ = false
static

Definition at line 32 of file helper.cpp.

Referenced by init(), and gui::menu::imgsel_style::load_images().

lg::log_domain gui2::log_gui_draw
lg::log_domain gui2::log_gui_event

Definition at line 33 of file log.hpp.

lg::log_domain gui2::log_gui_general

Definition at line 39 of file log.hpp.

Referenced by gui2::builder_grid::build(), and gui2::container_base::init_grid().

lg::log_domain gui2::log_gui_iterator

Definition at line 45 of file log.hpp.

lg::log_domain gui2::log_gui_layout
lg::log_domain gui2::log_gui_lifetime

Definition at line 62 of file log.hpp.

lg::log_domain gui2::log_gui_parse

Definition at line 67 of file log.hpp.

Referenced by gui2::builder_grid::builder_grid(), and gui2::canvas::parse_cfg().

bool gui2::new_widgets = false

Do we wish to use the new library or not.

Definition at line 35 of file settings.cpp.

Referenced by gui2::window::draw(), game_launcher::game_launcher(), gui2::dialogs::title_screen::pre_show(), and gui2::widget::set_visible().

size_t gui2::next_timer_id = 0
static

Ids for the timers.

Definition at line 39 of file timer.cpp.

Referenced by add_timer().

std::vector< window * > gui2::open_window_stack {}

Keeps track of any open windows of any type (modal, non-modal, or tooltip) in the order in which they were opened.

Currently only used as a helper for is_in_dialog(), but could potentially be useful for other things in the future.

Definition at line 1027 of file handler.cpp.

Referenced by gui2::text_box_base::cursor_timer_callback(), is_in_dialog(), remove_from_window_stack(), and gui2::dialogs::modeless_dialog::show().

const ::config* gui2::terrain = nullptr
static

The terrain used to create the cache.

If another terrain config is used the cache needs to be cleared, this normally doesn't happen a lot so the clearing of the cache is rather unusual.

Definition at line 133 of file minimap.cpp.

Referenced by movetype::terrain_info::data::calc_value(), game_board::change_terrain(), ai::ai_default_rca::move_cost_calculator::cost(), pathfind::shortest_path_calculator::cost(), pathfind::move_type_path_calculator::cost(), create_terrain_maps(), default_map_generator_job::default_generate_map(), editor::terrain_palette::draw_item(), preferences::encounter_map_terrain(), ai::default_recruitment::recruitment::get_average_defense(), editor::editor_map::get_contiguous_terrain_tiles(), gui2::minimap::get_image(), get_mp_tooltip(), terrain_type_data::get_underlying_terrain_string(), image::getMinimap(), unit_animation_component::invalidate(), preferences::manager::manager(), help::unit_topic_generator::operator()(), gamemap::overlay(), terrain_builder::parse_mapstring(), placing_score(), ai::readonly_context_impl::power_projection(), ai::ai_default_rca::aspect_attacks_base::rate_terrain(), ai::default_ai_context_impl::rate_terrain(), t_translation::read_builder_map(), t_translation::read_game_map(), t_translation::read_list(), unit_drawer::redraw_unit(), REPORT_GENERATOR(), editor::terrain_palette::select_bg_item(), editor::terrain_palette::select_fg_item(), gui2::minimap::set_config(), unit_type_data::set_config(), gui2::unit_preview_pane::set_displayed_type(), gui2::unit_preview_pane::set_displayed_unit(), terrain_type_data::underlying_def_terrain(), terrain_type_data::underlying_mvt_terrain(), terrain_type_data::underlying_union_terrain(), unit_box_at(), unit_defense(), unit_moves(), and preferences::manager::~manager().