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 | 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_text |
Specialized field class for text. More... | |
class | field_label |
Specialized field class for a styled_widget, used for labels and images. More... | |
class | game_tip |
The tips of day structure. More... | |
class | typed_formula |
Template class can hold a value or a formula to calculate the value. More... | |
class | canvas |
A simple canvas which can be drawn upon. More... | |
class | line_shape |
class | rect_bounded_shape |
class | rectangle_shape |
class | round_rectangle_shape |
class | circle_shape |
class | image_shape |
class | text_shape |
class | gui_definition |
A GUI theme definition. More... | |
struct | window_builder_invalid_id |
Helper struct to signal that get_window_builder failed. More... | |
struct | layout_exception_width_modified |
Exception thrown when the width has been modified during resizing. More... | |
struct | layout_exception_resize_failed |
Basic exception when the layout doesn't fit. More... | |
struct | layout_exception_width_resize_failed |
Exception thrown when the width resizing has failed. More... | |
struct | layout_exception_height_resize_failed |
Exception thrown when the height resizing has failed. More... | |
struct | linked_group_definition |
class | notifier |
Helper class to implement callbacks with lifetime management. More... | |
class | notifiee |
Helper class to implement callbacks with lifetime management. More... | |
class | placer_base |
Base class for the placement helper. More... | |
struct | registered_widget_parser |
struct | timer |
class | executor |
Helper to make removing a timer in a callback safe. More... | |
class | top_level_drawable |
A top-level drawable item (TLD), such as a window. More... | |
struct | state_definition |
Contains the state info for a resolution. More... | |
struct | resolution_definition |
struct | styled_widget_definition |
struct | builder_widget |
Contains the info needed to instantiate a widget. More... | |
struct | builder_grid |
class | builder_window |
class | lobby_player_list_helper |
class | player_list_helper |
struct | grow_direction_defines |
class | addon_list |
struct | addon_list_definition |
class | button |
Simple push button. More... | |
struct | button_definition |
struct | lobby_chat_window |
class | chatbox |
struct | chatbox_definition |
class | clickable_item |
Small concept class. More... | |
class | combobox |
Class for a combobox. More... | |
struct | combobox_definition |
class | container_base |
A generic container base class. More... | |
class | drawing |
struct | drawing_definition |
class | event_executor |
Event execution calls. More... | |
class | generator_base |
Abstract base class for the generator. More... | |
class | generator |
Basic template class to generate new items. More... | |
class | grid |
Base container class. More... | |
struct | grid_implementation |
Helper to implement private functions without modifying the header. More... | |
class | group |
class | horizontal_scrollbar |
struct | horizontal_scrollbar_definition |
class | image |
struct | image_definition |
class | integer_selector |
Small abstract helper class. More... | |
class | label |
struct | label_definition |
class | listbox |
The listbox class. More... | |
struct | listbox_definition |
class | state_default |
class | control_NEW |
class | matrix |
struct | matrix_definition |
class | menu_button |
struct | menu_button_definition |
class | minimap |
struct | minimap_definition |
class | multi_page |
struct | multi_page_definition |
class | multiline_text |
struct | multiline_text_definition |
class | multimenu_button |
struct | multimenu_button_definition |
struct | pane_implementation |
Helper to implement private functions without modifying the header. More... | |
class | pane |
A pane is a container where new members can be added and removed during run-time. More... | |
class | panel |
struct | panel_definition |
class | password_box |
class | progress_bar |
struct | progress_bar_definition |
class | repeating_button |
struct | repeating_button_definition |
class | rich_label |
A rich_label takes marked up text and shows it correctly formatted and wrapped but no scrollbars are provided. More... | |
struct | rich_label_definition |
class | scroll_label |
struct | scroll_label_definition |
class | scroll_text |
struct | scroll_text_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 |
struct | scrollbar_panel_definition |
class | selectable_item |
Small abstract helper class. More... | |
class | size_lock |
struct | size_lock_definition |
class | slider |
struct | slider_definition |
class | slider_base |
Base class for a scroll bar. More... | |
class | spacer |
struct | spacer_definition |
class | spinner |
struct | spinner_definition |
struct | stacked_widget_implementation |
class | stacked_widget |
struct | stacked_widget_definition |
class | styled_widget |
class | tab_container |
A container widget that shows one of its pages of widgets depending on which tab the user clicked. More... | |
struct | tab_container_definition |
class | text_history |
Class for text input history. More... | |
class | text_box |
A widget that allows the user to input text in single line. More... | |
struct | text_box_definition |
class | text_box_base |
Abstract base class for text items. More... | |
class | toggle_button |
struct | toggle_button_definition |
class | toggle_panel |
struct | toggle_panel_definition |
class | tree_view |
struct | tree_view_definition |
struct | tree_view_node_implementation |
class | tree_view_node |
class | unit_preview_pane |
struct | unit_preview_pane_definition |
class | vertical_scrollbar |
struct | vertical_scrollbar_definition |
struct | viewport_implementation |
Helper to implement private functions without modifying the header. More... | |
class | viewport |
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_definition |
struct | window_implementation |
Helper to implement private functions without modifying the header. More... | |
Enumerations | |
enum | retval : int { NONE = 0 , OK = -1 , CANCEL = -2 , AUTO_CLOSE = -3 } |
Default window/dialog return values. More... | |
Functions | |
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... | |
resolution_definition_ptr | get_control (const std::string &control_type, const std::string &definition) |
Returns the appropriate config data for a widget instance fom the active GUI definition. More... | |
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) |
Adds a widget definition to the default GUI. More... | |
void | remove_single_widget_definition (const std::string &widget_type, const std::string &definition_id) |
Removes a widget definition from the default GUI. More... | |
std::vector< linked_group_definition > | parse_linked_group_definitions (const config &cfg) |
std::set< std::string > & | registered_window_types () |
Returns the list of registered windows. More... | |
void | register_window (const std::string &id) |
Registers a window. More... | |
std::map< std::string, registered_widget_parser > & | registered_widget_types () |
Returns the list of registered widgets and their parsers. More... | |
void | register_widget (const std::string &type, widget_parser_t f, const char *key=nullptr) |
Registers a widget type. More... | |
std::map< std::string, widget_builder_func_t > & | widget_builder_lookup () |
Returns the list of registered widget builders. More... | |
void | register_widget_builder (const std::string &type, widget_builder_func_t functor) |
Registers a widget builder. More... | |
static std::map< std::size_t, timer > & | get_timers () |
The active timers. More... | |
static uint32_t | timer_callback (uint32_t, void *id) |
std::size_t | add_timer (const std::chrono::milliseconds &interval, const std::function< void(std::size_t id)> &callback, const bool repeat=false) |
Adds a new timer. More... | |
bool | remove_timer (const std::size_t id) |
Removes a timer. More... | |
bool | execute_timer (const std::size_t id) |
Executes a timer. More... | |
builder_widget_ptr | create_widget_builder (const config &cfg) |
Create a widget builder. More... | |
std::unique_ptr< widget > | build_single_widget_instance_helper (const std::string &type, const config &cfg) |
Implementation detail for build_single_widget_instance. More... | |
template<typename T > | |
std::unique_ptr< T > | build_single_widget_instance (const config &cfg={}) |
Builds a single widget instance of the given type with the specified attributes. More... | |
void | show_message (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 (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 (const std::string &message, bool message_use_markup=false) |
Shows an error message to the user. More... | |
void | show_transient_message (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) |
Shows a transient message to the user. More... | |
void | show_transient_error_message (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 | init () |
Initializes the GUI subsystems. More... | |
void | switch_theme (const std::string ¤t_theme) |
Set and activate the given gui2 theme. More... | |
void | set_single_child (grid &grid, std::unique_ptr< widget > widget) |
Sets the single child in a grid. 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... | |
PangoWeight | decode_text_weight (const std::string &weight) |
Converts a text weight string to a PangoWeight. More... | |
PangoStyle | decode_text_style (const std::string &style) |
Converts a text style string to a PangoStyle. 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_view | debug_truncate (std::string_view text) |
Returns a truncated version of the text. More... | |
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 t_string | default_value_label_generator (const std::vector< t_string > &value_labels, int item_position, int max) |
template<typename T > | |
t_string | default_status_value_getter (const T &w) |
template<typename W > | |
std::function< void()> | bind_status_label (widget *find_in, const std::string &source_id, const std::function< t_string(const 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_node & | add_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 &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, std::unique_ptr< widget > widget, const std::string &id) |
Swaps an item in a grid for another one. More... | |
static bool | is_active (const widget *wgt) |
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... | |
gui_theme_map_t | guis |
Map of all known GUIs. More... | |
gui_theme_map_t::iterator | current_gui = guis.end() |
Iterator pointing to the current GUI. More... | |
gui_theme_map_t::iterator | default_gui = guis.end() |
Iterator pointing to the default GUI. 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 std::size_t | next_timer_id = 0 |
Ids for the timers. More... | |
static std::size_t | executing_id = 0 |
The id of the event being executed, 0 if none. More... | |
std::mutex | timers_mutex |
static bool | executing_id_removed = false |
Did somebody try to remove the timer during its execution? More... | |
bool | new_widgets = false |
Do we wish to use the new library or not. More... | |
Generic file dialog.
A class inherited from text_box that displays its input as stars.
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.
using gui2::builder_grid_const_ptr = typedef std::shared_ptr<const builder_grid> |
Definition at line 147 of file window_builder.hpp.
using gui2::builder_grid_map = typedef std::map<std::string, builder_grid_const_ptr> |
Definition at line 148 of file window_builder.hpp.
using gui2::builder_grid_ptr = typedef std::shared_ptr<builder_grid> |
Definition at line 146 of file window_builder.hpp.
using gui2::builder_widget_const_ptr = typedef std::shared_ptr<const builder_widget> |
Definition at line 69 of file window_builder.hpp.
using gui2::builder_widget_ptr = typedef std::shared_ptr<builder_widget> |
Definition at line 68 of file window_builder.hpp.
typedef field<int, integer_selector> gui2::field_integer |
Definition at line 38 of file field-fwd.hpp.
using gui2::generator_sort_array = typedef std::array<generator_base::order_func, 2> |
Definition at line 380 of file generator.hpp.
using gui2::grow_direction = typedef string_enums::enum_base<grow_direction_defines> |
Definition at line 29 of file grow_direction.hpp.
using gui2::gui_theme_map_t = typedef std::map<std::string, gui_definition> |
Definition at line 88 of file gui_definition.hpp.
typedef std::shared_ptr<const resolution_definition> gui2::resolution_definition_const_ptr |
Definition at line 75 of file widget_definition.hpp.
typedef std::shared_ptr<resolution_definition> gui2::resolution_definition_ptr |
Definition at line 72 of file widget_definition.hpp.
typedef std::shared_ptr<styled_widget_definition> gui2::styled_widget_definition_ptr |
Definition at line 95 of file widget_definition.hpp.
typedef control_NEW<state_default> gui2::tbase |
Definition at line 96 of file matrix.hpp.
using gui2::widget_builder_func_t = typedef std::function<builder_widget_ptr(const config&)> |
Function type alias for register_widget_builder.
Definition at line 68 of file static_registry.hpp.
using gui2::widget_data = typedef std::map<std::string, widget_item> |
Definition at line 36 of file widget.hpp.
using gui2::widget_item = typedef std::map<std::string, t_string> |
Definition at line 33 of file widget.hpp.
using gui2::widget_parser_t = typedef std::function<styled_widget_definition_ptr(const config&)> |
Function type alias for register_widget.
Definition at line 45 of file static_registry.hpp.
enum gui2::retval : int |
Default window/dialog return values.
These values are named return values and most are assigned to a widget automatically when using a certain id for that widget (ie, a widget with the id "ok" will be assigned the OK return value.
The automatic return values are always a negative number.
Definition at line 29 of file retval.hpp.
|
inlinestatic |
Definition at line 95 of file unit_preview_pane.cpp.
References gui2::tree_view_node::add_child(), gui2::widget::find_widget(), and gui2::styled_widget::set_tooltip().
Referenced by gui2::unit_preview_pane::print_attack_details(), gui2::unit_preview_pane::set_displayed_type(), and gui2::unit_preview_pane::set_displayed_unit().
bool gui2::add_single_widget_definition | ( | const std::string & | widget_type, |
const std::string & | definition_id, | ||
const config & | cfg | ||
) |
Adds a widget definition to the default GUI.
Definition at line 291 of file gui_definition.cpp.
References current_gui, and registered_widget_types().
Referenced by lua_gui2::intf_add_widget_definition().
std::size_t gui2::add_timer | ( | const std::chrono::milliseconds & | interval, |
const std::function< void(std::size_t id)> & | callback, | ||
const bool | repeat = false |
||
) |
Adds a new timer.
interval | The timer interval in ms. |
callback | The function to call when the timer expires, the id send as parameter is the id of the timer. |
repeat | If true the timer will restart after it expires. |
[0] | Failed to create a timer. |
Definition at line 123 of file timer.cpp.
References gui2::timer::callback, DBG_GUI_E, get_timers(), gui2::timer::interval, next_timer_id, gui2::timer::sdl_id, timer_callback(), timers_mutex, and WRN_GUI_E.
Referenced by gui2::dialogs::story_viewer::draw_floating_image(), controller_base::handle_event(), gui2::dialogs::plugin_executor::plugin_executor(), gui2::dialogs::mp_lobby::pre_show(), gui2::dialogs::mp_join_game::pre_show(), gui2::dialogs::mp_staging::pre_show(), gui2::repeating_button::signal_handler_left_button_down(), gui2::event::mouse_motion::start_hover_timer(), gui2::text_box_base::toggle_cursor_timer(), and gui2::dialogs::outro::update().
|
static |
Definition at line 361 of file scrollbar_container.cpp.
References gui2::scrollbar_container::ALWAYS_INVISIBLE, gui2::scrollbar_container::AUTO_VISIBLE, gui2::scrollbar_base::get_item_count(), gui2::scrollbar_base::get_item_position(), gui2::widget::hidden, gui2::widget::invisible, is_inserted_before(), gui2::scrollbar_base::set_item_count(), gui2::scrollbar_base::set_item_position(), set_scrollbar_mode(), gui2::widget::set_visible(), gui2::scrollbar_base::set_visible_items(), and gui2::widget::visible.
Referenced by gui2::scrollbar_container::content_resize_height(), and gui2::scrollbar_container::content_resize_width().
std::function<void()> gui2::bind_status_label | ( | widget * | find_in, |
const std::string & | source_id, | ||
const std::function< t_string(const 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.
find_in | The containing widget (usually a window or grid) in which to find the source and status label widgets. |
source_id | The ID of the source widget. |
value_getter | Functor to process the value of the source widget. |
label_id | The ID of the status label widget. |
Definition at line 65 of file status_label_helper.hpp.
References gui2::event::connect_signal_notify_modified(), gui2::widget::find_widget(), and gui2::styled_widget::set_label().
std::unique_ptr<T> gui2::build_single_widget_instance | ( | const config & | cfg = {} | ) |
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.
This is equivalent to calling build()
on the result of create_widget_builder.
T | The final widget type. The widget pointer will be cast to this. |
cfg | Data config to pass to the widget's builder. |
Definition at line 111 of file window_builder.hpp.
std::unique_ptr< widget > gui2::build_single_widget_instance_helper | ( | const std::string & | type, |
const config & | cfg | ||
) |
Implementation detail for build_single_widget_instance.
Do not use directly!
type | String ID of the widget type. |
cfg | Data config to pass to the widget's builder. |
Definition at line 96 of file window_builder.cpp.
References VALIDATE, and widget_builder_lookup().
builder_widget_ptr gui2::create_widget_builder | ( | const config & | cfg | ) |
Create a widget builder.
This object holds the instance builder for a single widget.
cfg | The config object holding the information regarding the widget instance. |
Definition at line 58 of file window_builder.cpp.
References config::all_children_count(), FAIL, config::ordered_begin(), VALIDATE, and widget_builder_lookup().
Referenced by gui2::builder_grid::builder_grid(), and gui2::implementation::builder_size_lock::builder_size_lock().
std::string_view gui2::debug_truncate | ( | std::string_view | 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.
text | The text to truncate. |
Definition at line 148 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::rich_label::get_parsed_text(), 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.
color | A color string. |
Definition at line 48 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.
style | A font style string. |
Definition at line 31 of file helper.cpp.
References ERR_GUI_G, font::pango_text::STYLE_BOLD, font::pango_text::STYLE_ITALIC, 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.
alignment | An alignment string. |
Definition at line 89 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().
PangoStyle gui2::decode_text_style | ( | const std::string & | style | ) |
Converts a text style string to a PangoStyle.
style | A style string, possible values: "normal", "italic", "oblique |
Definition at line 74 of file helper.cpp.
References ERR_GUI_E.
Referenced by gui2::text_shape::draw().
PangoWeight gui2::decode_text_weight | ( | const std::string & | weight | ) |
Converts a text weight string to a PangoWeight.
weight | A weight string, possible values: "thin", "light", "normal", "semibold", "bold", "heavy" |
Definition at line 53 of file helper.cpp.
References ERR_GUI_E.
Referenced by gui2::text_shape::draw().
t_string gui2::default_status_value_getter | ( | const T & | w | ) |
Definition at line 28 of file status_label_helper.hpp.
|
static |
Definition at line 236 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.
alignment | An alignment. |
Definition at line 104 of file helper.cpp.
Referenced by gui2::rich_label::default_text_config(), and gui2::styled_widget::update_canvas().
bool gui2::execute_timer | ( | const std::size_t | id | ) |
Executes a timer.
id | The id of the timer to execute, this is the id returned by add_timer. |
Definition at line 197 of file timer.cpp.
References DBG_GUI_E, get_timers(), LOG_GUI_E, and timers_mutex.
Referenced by controller_base::handle_event(), and gui2::event::sdl_event_handler::handle_event().
resolution_definition_ptr gui2::get_control | ( | const std::string & | control_type, |
const std::string & | definition | ||
) |
Returns the appropriate config data for a widget instance fom the active GUI definition.
control_type | The widget type. |
definition | The definition ID. |
Definition at line 203 of file gui_definition.cpp.
References current_gui, default_gui, FAIL, LOG_GUI_G, draw::point(), and VALIDATE.
Referenced by gui2::text_box_base::text_box_base().
|
inlinestatic |
Definition at line 109 of file unit_preview_pane.cpp.
References _(), translation::dgettext(), cursor::get(), draw::line(), unit_helper::resistance_color(), utils::signed_percent(), markup::span_color(), markup::tag(), tooltip, and font::unicode_bullet.
Referenced by gui2::unit_preview_pane::set_displayed_type(), and gui2::unit_preview_pane::set_displayed_unit().
point gui2::get_mouse_position | ( | ) |
Returns the current mouse position.
Definition at line 143 of file helper.cpp.
References sdl::get_mouse_location().
Referenced by gui2::event::sdl_event_handler::handle_event(), gui2::event::init_mouse_location(), gui2::window::layout(), gui2::event::mouse_motion::mouse_enter(), gui2::label::signal_handler_left_button_click(), gui2::rich_label::signal_handler_left_button_click(), gui2::combobox::signal_handler_left_button_down(), gui2::multiline_text::signal_handler_left_button_down(), gui2::scrollbar_base::signal_handler_left_button_down(), gui2::slider_base::signal_handler_left_button_down(), gui2::text_box::signal_handler_left_button_down(), gui2::scrollbar_base::signal_handler_left_button_up(), gui2::slider_base::signal_handler_left_button_up(), gui2::scrollbar_base::signal_handler_mouse_enter(), gui2::slider_base::signal_handler_mouse_enter(), gui2::label::signal_handler_right_button_click(), and gui2::combobox::update_mouse_cursor().
|
inlinestatic |
Definition at line 148 of file unit_preview_pane.cpp.
References _(), t_translation::ALL_OFF_MAP, t_translation::FOGGED, cursor::get(), prefs::get(), i, lg::info(), help::load_terrain_types_data(), game_config::red_to_green(), markup::span_color(), markup::tag(), t_translation::terrain_matches(), tooltip, font::unicode_bullet, font::unicode_figure_dash, and t_translation::VOID_TERRAIN.
Referenced by gui2::unit_preview_pane::set_displayed_type(), and gui2::unit_preview_pane::set_displayed_unit().
wfl::map_formula_callable gui2::get_screen_size_variables | ( | ) |
Gets a formula object with the screen size.
Definition at line 135 of file helper.cpp.
References get_screen_size_variables().
void gui2::get_screen_size_variables | ( | wfl::map_formula_callable & | variable | ) |
Gets a formula object with the screen size.
variable | A 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 125 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, gui2::settings::screen_pitch_microns, and gui2::settings::screen_width.
Referenced by gui2::implementation::builder_drawing::build(), gui2::size_lock::calculate_best_size(), gui2::spacer::calculate_best_size(), get_screen_size_variables(), gui2::styled_widget::get_text_font_size(), gui2::window::layout(), and gui2::canvas::update_size_variables().
|
static |
The active timers.
Definition at line 40 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.
type
at the current resolution.window_builder_invalid_id | When the precondition is violated. |
type | The type of builder window to get. |
Definition at line 256 of file gui_definition.cpp.
References current_gui, default_gui, draw::point(), gui2::settings::update_screen_size_variables(), VALIDATE, gui2::builder_window::window_resolution::window_height, and gui2::builder_window::window_resolution::window_width.
void gui2::init | ( | ) |
Initializes the GUI subsystems.
Definition at line 34 of file gui.cpp.
References _(), config::append(), config::child_range(), default_gui, e, filesystem::ENTIRE_FILE_PATH, ERR_GUI_P, filesystem::file_exists(), g, filesystem::get_addons_dir(), filesystem::get_files_in_dir(), filesystem::get_short_wml_path(), filesystem::get_wml_location(), guis, id, game_config::config_cache::instance(), LOG_GUI_G, preprocess_file(), read(), gui2::settings::update_screen_size_variables(), VALIDATE, and validator.
Referenced by do_gameloop(), test_utils::game_config_manager::game_config_manager(), and wesnoth_global_fixture::wesnoth_global_fixture().
|
static |
Definition at line 1267 of file window.cpp.
References gui2::widget::visible.
Referenced by unit::halo_or_icon_abilities(), gui2::window::signal_handler_sdl_key_down(), and ng::create_engine::toggle_mod().
bool gui2::is_in_dialog | ( | ) |
Is a dialog open?
Definition at line 1084 of file handler.cpp.
References open_window_stack.
Referenced by controller_base::handle_event(), controller_base::process(), and display::queue_rerender().
|
static |
Definition at line 347 of file scrollbar_container.cpp.
Referenced by adjust_scrollbar_mode().
t_string gui2::missing_widget | ( | const std::string & | id | ) |
Returns a default error message if a mandatory widget is omitted.
id | The id of the omitted widget. |
Definition at line 120 of file helper.cpp.
References VGETTEXT.
Referenced by gui2::dialogs::mp_options_helper::add_node_and_get_widget(), and gui2::widget::find_widget().
std::vector< linked_group_definition > gui2::parse_linked_group_definitions | ( | const config & | cfg | ) |
Definition at line 24 of file linked_group_definition.cpp.
References config::child_range(), FAIL, gui2::linked_group_definition::fixed_height, gui2::linked_group_definition::fixed_width, gui2::linked_group_definition::id, missing_mandatory_wml_key(), wfl::msg(), VALIDATE, and VGETTEXT.
Referenced by gui2::resolution_definition::resolution_definition(), and gui2::builder_window::window_resolution::window_resolution().
void gui2::register_widget | ( | const std::string & | type, |
widget_parser_t | f, | ||
const char * | key = nullptr |
||
) |
Registers a widget type.
This function is utilized by the REGISTER_WIDGET macro and sets the the parser function used to process the widget type's WML when a GUI definition is initialized.
All widgets need to register themselves before gui2::init is called.
type | The type of the widget to register. |
f | The function to parse the definition config. |
key | The tagname from which to read the widget's definition in the game config. If nullptr the default [<id>_definition] is used. |
Definition at line 49 of file static_registry.cpp.
References f, and registered_widget_types().
void gui2::register_widget_builder | ( | const std::string & | type, |
widget_builder_func_t | functor | ||
) |
Registers a widget builder.
A widget builder simply creates and returns a pointer to a widget type's builder struct. This is part of the static registry since widget builders are simply used to instantiate a widget object when a dialog is being assembled.
If the widget inherits from styled_widget, any theme-dependent info will be fetched from the current GUI theme upon construction.
type | The type of the widget as used in WML. |
functor | The functor to create the widget. |
Definition at line 60 of file static_registry.cpp.
References widget_builder_lookup().
void gui2::register_window | ( | const std::string & | id | ) |
Registers a window.
This function is utilized by the REGISTER_WINDOW macro and notes a window to look for when a GUI definition is initialized.
All windows need to register themselves before gui2::init is called.
id | The id of the window to register. |
Definition at line 33 of file static_registry.cpp.
References registered_window_types(), and WRN_GUI_P.
std::map< std::string, registered_widget_parser > & gui2::registered_widget_types | ( | ) |
Returns the list of registered widgets and their parsers.
Definition at line 43 of file static_registry.cpp.
Referenced by add_single_widget_definition(), gui2::gui_definition::gui_definition(), and register_widget().
std::set< std::string > & gui2::registered_window_types | ( | ) |
Returns the list of registered windows.
Definition at line 27 of file static_registry.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), gui2::gui_definition::gui_definition(), 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 1074 of file handler.cpp.
References open_window_stack.
Referenced by intf_show_dialog(), and gui2::dialogs::modeless_dialog::show().
void gui2::remove_single_widget_definition | ( | const std::string & | widget_type, |
const std::string & | definition_id | ||
) |
Removes a widget definition from the default GUI.
Definition at line 308 of file gui_definition.cpp.
References current_gui.
Referenced by lua_kernel_base::~lua_kernel_base().
bool gui2::remove_timer | ( | const std::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.
id | The id of the timer to remove, this is the id returned by add_timer. |
Definition at line 164 of file timer.cpp.
References DBG_GUI_E, executing_id, executing_id_removed, get_timers(), LOG_GUI_E, and timers_mutex.
Referenced by gui2::dialogs::story_viewer::clear_image_timer(), controller_base::handle_event(), gui2::dialogs::mp_lobby::post_show(), gui2::dialogs::mp_join_game::post_show(), gui2::dialogs::mp_staging::post_show(), gui2::dialogs::outro::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::dialogs::outro::update(), controller_base::~controller_base(), 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(), and gui2::repeating_button::~repeating_button().
|
static |
Definition at line 317 of file scrollbar_container.cpp.
References gui2::scrollbar_container::ALWAYS_INVISIBLE, gui2::scrollbar_container::AUTO_VISIBLE, gui2::scrollbar_container::AUTO_VISIBLE_FIRST_RUN, gui2::widget::get_visible(), gui2::widget::hidden, gui2::widget::invisible, gui2::grid::layout_initialize(), gui2::scrollbar_base::set_item_count(), gui2::widget::set_visible(), gui2::scrollbar_base::set_visible_items(), and gui2::widget::visible.
Referenced by adjust_scrollbar_mode(), and gui2::scrollbar_container::place().
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.
grid | The grid to add the child to. |
widget | The widget to add as child to the grid. |
Definition at line 1103 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 | ( | const std::string & | message, |
bool | message_use_markup = false |
||
) |
Shows an error message to the user.
message | The message to show in the dialog. |
message_use_markup | Use markup for the message? |
Definition at line 201 of file message.cpp.
References _(), lg::err(), lg::general(), LOG_STREAM, wfl::msg(), 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(), editor::editor_controller::do_execute_command(), gui2::dialogs::mp_lobby::enter_game(), gui2::dialogs::addon_manager::fetch_addons_list(), editor::context_manager::generate_map_dialog(), gui2::dialogs::title_screen::init_callbacks(), 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::addon_manager::publish_addon(), gui2::dialogs::game_cache_options::purge_cache_callback(), gui2::dialogs::mp_match_history::request_history(), savegame::savegame::save_game(), gui2::dialogs::screenshot_notification::save_screenshot(), sp::select_campaign(), wml_exception::show(), play_controller::to_config(), addons_client::try_fetch_addon(), gui2::dialogs::addon_manager::uninstall_addon(), and gui2::dialogs::editor_edit_pbl::validate().
int gui2::show_message | ( | 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.
title | The title of the dialog. |
message | The message to show in the dialog. |
button_style | The style of the button(s) shown. |
message_use_markup | Use markup for the message? |
title_use_markup | Use markup for the title? |
Definition at line 160 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(), wfl::msg(), 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_message | ( | 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.
title | The title of the dialog. |
message | The message to show in the dialog. |
button_caption | The caption of the close button. |
auto_close | When true the window will hide the ok button when the message doesn't need a scrollbar to show itself. |
message_use_markup | Use markup for the message? |
title_use_markup | Use markup for the title? |
Definition at line 148 of file message.cpp.
References wfl::msg(), 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(), play_controller::check_next_scenario_is_known(), savegame::savegame::check_overwrite(), savegame::loadgame::check_version_compatibility(), gui2::dialogs::game_cache_options::clean_cache_callback(), events::menu_handler::clear_labels(), 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(), editor::editor_controller::do_execute_command(), do_gameloop(), addons_client::do_resolve_addon_dependencies(), events::menu_handler::do_search(), events::console_handler::do_undiscover(), events::console_handler::do_unsafe_lua(), network::download(), events::menu_handler::end_turn(), gui2::dialogs::mp_lobby::enter_game(), gui2::dialogs::migrate_version_selection::execute(), gui2::dialogs::addon_manager::execute_default_action(), ng::depcheck::manager::failure_dialog(), playsingle_controller::hotkey_handler::load_autosave(), editor::map_context::map_context(), gui2::dialogs::file_dialog::on_file_delete_cmd(), campaign_controller::play_game(), gui2::dialogs::addon_manager::publish_addon(), gui2::dialogs::game_cache_options::purge_cache_callback(), gui2::dialogs::editor_edit_unit::quit_confirmation(), gui2::dialogs::game_version::report_issue(), editor::context_manager::save_map_as_dialog(), editor::context_manager::save_scenario_as_dialog(), gui2::dialogs::custom_tod::select_file(), gui2::dialogs::editor_edit_unit::select_file(), show_error_message(), gui2::dialogs::game_version::show_manual(), lua_gui2::show_message_box(), quit_confirmation::show_prompt(), gui2::label::signal_handler_left_button_click(), gui2::multiline_text::signal_handler_left_button_down(), gui2::label::signal_handler_right_button_click(), hotkey::command_executor::surrender_game(), and gui2::dialogs::editor_edit_pbl::validate().
void gui2::show_transient_error_message | ( | 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.
message | The message to show in the dialog. |
image | An image to show in the dialog. |
message_use_markup | Use markup for the message? |
Definition at line 72 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 | ( | 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 |
||
) |
Shows a transient message to the user.
This shows a dialog with a short message which can be dismissed with a single click.
title | The title of the dialog. |
message | The message to show in the dialog. |
image | An image to show in the dialog. |
message_use_markup | Use markup for the message? |
title_use_markup | Use markup for the title? |
Definition at line 60 of file transient_message.cpp.
References gui2::dialogs::modal_dialog::show().
Referenced by gui2::dialogs::preferences_dialog::add_friend_list_entry(), gui2::dialogs::preferences_dialog::add_hotkey_callback(), editor::location_palette::adjust_size(), editor::context_manager::apply_mask_dialog(), carryover_show_gold(), 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(), playsingle_controller::do_end_level(), events::menu_handler::do_recruit(), events::console_handler::do_show_var(), events::menu_handler::end_turn(), gui2::dialogs::game_load::execute(), gui2::dialogs::game_stats::execute(), gui2::dialogs::unit_list::execute(), editor::context_manager::generate_map_dialog(), 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_init(), gui2::dialogs::mp_create_game::pre_show(), gui2::dialogs::addon_manager::publish_addon(), events::menu_handler::recall(), events::menu_handler::recruit(), actions::undo_list::redo(), gui2::dialogs::preferences_dialog::remove_friend_list_entry(), gui2::dialogs::preferences_dialog::remove_hotkey_callback(), savegame::savegame::save_game(), events::menu_handler::save_map(), editor::context_manager::save_map_as_dialog(), editor::context_manager::save_scenario_as_dialog(), editor::map_context::save_schedule(), events::mouse_handler::show_attack_dialog(), play_controller::show_objectives(), lua_gui2::show_popup_dialog(), prefs::show_theme_dialog(), show_transient_error_message(), playsingle_controller::show_turn_dialog(), and gui2::dialogs::editor_edit_unit::write().
void gui2::swap_grid | ( | grid * | g, |
grid * | content_grid, | ||
std::unique_ptr< widget > | widget, | ||
const std::string & | id | ||
) |
Swaps an item in a grid for another one.
Definition at line 24 of file widget_helpers.cpp.
References gui2::widget::find_widget(), g, id, gui2::widget::parent(), gui2::widget::set_id(), and gui2::grid::swap_child().
Referenced by gui2::listbox::finalize(), gui2::stacked_widget::finalize(), and gui2::multi_page::finalize().
void gui2::switch_theme | ( | const std::string & | current_theme | ) |
Set and activate the given gui2 theme.
current_theme | the name of the gui2 theme to switch to |
Definition at line 135 of file gui.cpp.
References current_gui, default_gui, ERR_GUI_P, and guis.
Referenced by hotkey::command_executor::do_execute_command(), do_gameloop(), test_utils::game_config_manager::game_config_manager(), lua_gui2::switch_theme(), wesnoth_global_fixture::wesnoth_global_fixture(), and campaign_controller::~campaign_controller().
|
static |
Definition at line 93 of file timer.cpp.
References DBG_GUI_E, get_timers(), id, TIMER_EVENT, and timers_mutex.
Referenced by add_timer().
std::map< std::string, widget_builder_func_t > & gui2::widget_builder_lookup | ( | ) |
Returns the list of registered widget builders.
Definition at line 54 of file static_registry.cpp.
Referenced by build_single_widget_instance_helper(), create_widget_builder(), and register_widget_builder().
gui_theme_map_t::iterator gui2::current_gui = guis.end() |
Iterator pointing to the current GUI.
Definition at line 31 of file gui_definition.cpp.
Referenced by add_single_widget_definition(), get_control(), get_window_builder(), remove_single_widget_definition(), and switch_theme().
gui_theme_map_t::iterator gui2::default_gui = guis.end() |
Iterator pointing to the default GUI.
Definition at line 32 of file gui_definition.cpp.
Referenced by get_control(), get_window_builder(), init(), and switch_theme().
|
static |
The id of the event being executed, 0 if none.
NOTE: it is possible that multiple timers are executed at the same time if one of the timer starts an event loop for example if its handler shows a dialog. In that case code that relies on this breaks. This could probably fixed my making this a list/stack of ids.
Definition at line 52 of file timer.cpp.
Referenced by gui2::executor::executor(), remove_timer(), and gui2::executor::~executor().
|
static |
Did somebody try to remove the timer during its execution?
Definition at line 57 of file timer.cpp.
Referenced by gui2::executor::executor(), remove_timer(), and gui2::executor::~executor().
gui_theme_map_t gui2::guis |
Map of all known GUIs.
Definition at line 30 of file gui_definition.cpp.
Referenced by init(), gui2::dialogs::preferences_dialog::set_gui2_theme_list(), and switch_theme().
lg::log_domain gui2::log_gui_draw | ( | "gui/draw" | ) |
Definition at line 28 of file log.hpp.
Referenced by gui2::canvas::draw(), gui2::window::show(), gui2::window::show_non_modal(), and gui2::window::show_tooltip().
lg::log_domain gui2::log_gui_event | ( | "gui/event" | ) |
lg::log_domain gui2::log_gui_general | ( | "gui/general" | ) |
Definition at line 40 of file log.hpp.
Referenced by gui2::builder_grid::build(), and gui2::container_base::init_grid().
lg::log_domain gui2::log_gui_iterator | ( | "gui/iterator" | ) |
lg::log_domain gui2::log_gui_layout | ( | "gui/layout" | ) |
Definition at line 54 of file log.hpp.
Referenced by gui2::container_base::calculate_best_size(), gui2::grid::calculate_best_size(), gui2::scrollbar_container::calculate_best_size(), gui2::slider::calculate_best_size(), gui2::tree_view_node::calculate_best_size(), gui2::grid::child::get_best_size(), gui2::styled_widget::get_best_text_size(), gui2::window::layout(), gui2::window_implementation::layout(), gui2::grid::place(), gui2::tree_view_node::place(), gui2::grid::reduce_height(), gui2::grid::reduce_width(), and gui2::tree_view_node::set_visible_rectangle().
lg::log_domain gui2::log_gui_lifetime | ( | "gui/lifetime" | ) |
lg::log_domain gui2::log_gui_parse | ( | "gui/parse" | ) |
Definition at line 65 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 23 of file settings.cpp.
Referenced by game_launcher::game_launcher(), and gui2::widget::set_visible().
|
static |
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 1072 of file handler.cpp.
Referenced by gui2::text_box_base::cursor_timer_callback(), intf_show_dialog(), is_in_dialog(), remove_from_window_stack(), and gui2::dialogs::modeless_dialog::show().
std::mutex gui2::timers_mutex |
Definition at line 54 of file timer.cpp.
Referenced by add_timer(), execute_timer(), remove_timer(), and timer_callback().