The Battle for Wesnoth  1.19.5+dev
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
gui2::window Class Reference

base class of top level items, the only item which needs to store the final canvases to draw on. More...

#include <window.hpp>

Inheritance diagram for gui2::window:

Classes

class  invalidate_layout_blocker
 Helper class to block invalidate_layout. More...
 
struct  linked_size
 Helper struct to force widgets the have the same size. More...
 

Public Types

enum class  status { NEW , SHOWING , REQUEST_CLOSE , CLOSED }
 The status of the window. More...
 
enum class  exit_hook { on_all , on_ok }
 
enum class  show_mode { none , modal , modeless , tooltip }
 
- Public Types inherited from gui2::widget
enum class  visibility { visible , hidden , invisible }
 Visibility settings done by the user. More...
 
enum class  redraw_action { full , partly , none }
 Visibility set by the engine. More...
 
enum class  debug_border { none , outline , fill }
 
- Public Types inherited from gui2::event::dispatcher
enum  event_queue_type { pre = 1 , child = 2 , post = 4 }
 
enum  queue_position {
  front_pre_child , back_pre_child , front_child , back_child ,
  front_post_child , back_post_child
}
 The position where to add a new callback in the signal handler. More...
 
enum class  mouse_behavior { all , hit , none }
 The behavior of the mouse events. More...
 

Public Member Functions

 window (const builder_window::window_resolution &definition)
 < Needs to be initialized in show. More...
 
virtual ~window ()
 
int show (unsigned auto_close_timeout=0)
 Shows the window, running an event loop until it should close. More...
 
void show_tooltip ()
 Shows the window as a tooltip. More...
 
void show_non_modal ()
 Shows the window non modal. More...
 
void draw ()
 Draws the window. More...
 
void hide ()
 Hides the window. More...
 
virtual void layout () override
 Lays out the window. More...
 
virtual void render () override
 Ensure the window's internal render buffer is up-to-date. More...
 
virtual bool expose (const rect &region) override
 Called by draw_manager when it believes a redraw is necessary. More...
 
virtual rect screen_location () override
 The current draw location of the window, on the screen. More...
 
void queue_rerender (const rect &region)
 Queue a rerender of the internal render buffer. More...
 
void queue_rerender ()
 
void defer_region (const rect &region)
 Defer rendering of a particular region to next frame. More...
 
void close ()
 Requests to close the window. More...
 
bool invalidate_layout_blocked () const
 Is invalidate_layout blocked, see invalidate_layout_blocker. More...
 
void invalidate_layout ()
 Updates the size of the window. More...
 
virtual widgetfind_at (const point &coordinate, const bool must_be_active) override
 See widget::find_at. More...
 
virtual const widgetfind_at (const point &coordinate, const bool must_be_active) const override
 See widget::find_at. More...
 
dialogs::modal_dialogdialog ()
 Inherited from widget. More...
 
widgetfind (const std::string &id, const bool must_be_active) override
 See widget::find. More...
 
const widgetfind (const std::string &id, const bool must_be_active) const override
 See widget::find. More...
 
bool does_click_dismiss () const
 Does the window close easily? More...
 
void set_enter_disabled (const bool enter_disabled)
 Disable the enter key. More...
 
void set_escape_disabled (const bool escape_disabled)
 Disable the escape key. More...
 
void init_linked_size_group (const std::string &id, const bool fixed_width, const bool fixed_height)
 Initializes a linked size group. More...
 
bool has_linked_size_group (const std::string &id)
 Is the linked size group defined for this window? More...
 
void add_linked_widget (const std::string &id, widget *widget)
 Adds a widget to a linked size group. More...
 
void remove_linked_widget (const std::string &id, const widget *widget)
 Removes a widget from a linked size group. More...
 
void set_retval (const int retval, const bool close_window=true)
 Sets there return value of the window. More...
 
int get_retval ()
 
void set_owner (dialogs::modal_dialog *owner)
 
void set_click_dismiss (const bool click_dismiss)
 
bool get_need_layout () const
 
void set_variable (const std::string &key, const wfl::variant &value)
 
point get_linked_size (const std::string &linked_group_id) const
 
void set_exit_hook (exit_hook mode, std::function< bool(window &)> func)
 Sets the window's exit hook. More...
 
const event::distributorget_distributor () const
 Gets a reference to the window's distributor to allow some state peeking. More...
 
show_mode mode () const
 Returns the dialog mode for this window. More...
 
void mouse_capture (const bool capture=true)
 
void keyboard_capture (widget *widget)
 
void add_to_keyboard_chain (widget *widget)
 Adds the widget to the keyboard chain. More...
 
void remove_from_keyboard_chain (widget *widget)
 Remove the widget from the keyboard chain. More...
 
void add_to_tab_order (widget *widget, int at=-1)
 Add the widget to the tabbing order. More...
 
- Public Member Functions inherited from gui2::panel
 panel (const implementation::builder_styled_widget &builder, const std::string &control_type="")
 Constructor. More...
 
virtual SDL_Rect get_client_rect () const override
 See container_base::get_client_rect. More...
 
virtual bool get_active () const override
 See styled_widget::get_active. More...
 
virtual unsigned get_state () const override
 See styled_widget::get_state. More...
 
- Public Member Functions inherited from gui2::container_base
 container_base (const implementation::builder_styled_widget &builder, const std::string &control_type)
 
virtual void layout_initialize (const bool full_initialization) override
 See widget::layout_initialize. More...
 
void reduce_width (const unsigned maximum_width)
 Tries to reduce the width of a container. More...
 
virtual void request_reduce_width (const unsigned maximum_width) override
 See widget::request_reduce_width. More...
 
virtual void demand_reduce_width (const unsigned maximum_width) override
 See widget::demand_reduce_width. More...
 
void reduce_height (const unsigned maximum_height)
 Tries to reduce the height of a container. More...
 
virtual void request_reduce_height (const unsigned maximum_height) override
 See widget::request_reduce_height. More...
 
virtual void demand_reduce_height (const unsigned maximum_height) override
 See widget::demand_reduce_height. More...
 
virtual bool can_wrap () const override
 See widget::can_wrap. More...
 
virtual void place (const point &origin, const point &size) override
 See widget::place. More...
 
virtual bool has_widget (const widget &widget) const override
 See widget::has_widget. More...
 
virtual void set_origin (const point &origin) override
 See widget::set_origin. More...
 
virtual void set_visible_rectangle (const SDL_Rect &rectangle) override
 See widget::set_visible_rectangle. More...
 
virtual void impl_draw_children () override
 See widget::impl_draw_children. More...
 
virtual void set_active (const bool active) override
 See styled_widget::set_active. More...
 
bool disable_click_dismiss () const override
 See widget::disable_click_dismiss. More...
 
virtual iteration::walker_ptr create_walker () override
 See widget::create_walker. More...
 
void init_grid (const builder_grid &grid_builder)
 Initializes and builds the grid. More...
 
grid::iterator begin ()
 
grid::iterator end ()
 
unsigned add_row (const unsigned count=1)
 
void set_rows (const unsigned rows)
 
unsigned int get_rows () const
 
void set_cols (const unsigned cols)
 
unsigned int get_cols () const
 
void set_rows_cols (const unsigned rows, const unsigned cols)
 
void set_child (std::unique_ptr< widget > widget, const unsigned row, const unsigned col, const unsigned flags, const unsigned border_size)
 
void set_row_grow_factor (const unsigned row, const unsigned factor)
 
void set_column_grow_factor (const unsigned column, const unsigned factor)
 
const gridget_grid () const
 
gridget_grid ()
 
- Public Member Functions inherited from gui2::styled_widget
 styled_widget (const implementation::builder_styled_widget &builder, const std::string &control_type)
 Constructor. More...
 
virtual void set_members (const widget_item &data)
 Sets the members of the styled_widget. More...
 
bool disable_click_dismiss () const override
 See widget::disable_click_dismiss. More...
 
point get_config_minimum_size () const
 Gets the minimum size as defined in the config. More...
 
point get_config_default_size () const
 Gets the default size as defined in the config. More...
 
point get_config_maximum_size () const
 Gets the best size as defined in the config. More...
 
virtual unsigned get_characters_per_line () const
 Returns the number of characters per line. More...
 
virtual bool get_link_aware () const
 Returns whether the label should be link_aware, in in rendering and in searching for links with get_link. More...
 
virtual color_t get_link_color () const
 Returns the color string to be used with links. More...
 
bool get_use_tooltip_on_label_overflow () const
 
void set_use_tooltip_on_label_overflow (const bool use_tooltip=true)
 
const t_stringget_label () const
 
virtual void set_label (const t_string &text)
 
virtual void set_use_markup (bool use_markup)
 
bool get_use_markup () const
 
const t_stringtooltip () const
 
void set_tooltip (const t_string &tooltip)
 
const t_stringhelp_message () const
 
void set_help_message (const t_string &help_message)
 
std::vector< canvas > & get_canvases ()
 
canvasget_canvas (const unsigned index)
 
virtual void set_text_alignment (const PangoAlignment text_alignment)
 
PangoAlignment get_text_alignment () const
 
void set_text_ellipse_mode (const PangoEllipsizeMode ellipse_mode)
 
PangoEllipsizeMode get_text_ellipse_mode () const
 Get the text's ellipsize mode. More...
 
void set_text_maximum_width (int max_width)
 Set how wide the text can become. More...
 
- Public Member Functions inherited from gui2::widget
 widget (const widget &)=delete
 
widgetoperator= (const widget &)=delete
 
 widget ()
 
 widget (const builder_widget &builder)
 Constructor. More...
 
virtual ~widget () override
 
void set_id (const std::string &id)
 
const std::string & id () const
 
windowget_window ()
 Get the parent window. More...
 
const windowget_window () const
 The constant version of get_window. More...
 
gridget_parent_grid ()
 Get the parent grid. More...
 
const gridget_parent_grid () const
 
void set_parent (widget *parent)
 
widgetparent ()
 
point get_best_size () const
 Gets the best size for the widget. More...
 
virtual bool can_mouse_focus () const
 Whether the mouse move/click event go 'through' this widget. More...
 
virtual void set_size (const point &size)
 Sets the size of the widget. More...
 
virtual void move (const int x_offset, const int y_offset)
 Moves a widget. More...
 
virtual void set_horizontal_alignment (const std::string &alignment)
 Sets the horizontal alignment of the widget within its parent grid. More...
 
virtual void set_vertical_alignment (const std::string &alignment)
 Sets the horizontal alignment of the widget within its parent grid. More...
 
point get_origin () const
 Returns the screen origin of the widget. More...
 
point get_size () const
 Returns the size of the widget. More...
 
rect get_rectangle () const
 Gets the bounding rectangle of the widget on the screen. More...
 
int get_x () const
 
int get_y () const
 
unsigned get_width () const
 
unsigned get_height () const
 
void set_linked_group (const std::string &linked_group)
 
std::string get_linked_group () const
 
SDL_Rect calculate_blitting_rectangle () const
 Calculates the blitting rectangle of the widget. More...
 
SDL_Rect calculate_clipping_rectangle () const
 Calculates the clipping rectangle of the widget. More...
 
bool draw_background ()
 Draws the background of a widget. More...
 
void draw_children ()
 Draws the children of a widget. More...
 
bool draw_foreground ()
 Draws the foreground of the widget. More...
 
SDL_Rect get_dirty_rectangle () const
 Gets the dirty rectangle of the widget. More...
 
void queue_redraw ()
 Indicates that this widget should be redrawn. More...
 
void queue_redraw (const rect &region)
 Indicate that specific region of the screen should be redrawn. More...
 
void set_visible (const visibility visible)
 
visibility get_visible () const
 
redraw_action get_drawing_action () const
 
void set_debug_border_mode (const debug_border debug_border_mode)
 
void set_debug_border_color (const color_t debug_border_color)
 
template<class T >
NOT_DANGLING T * find_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 >
NOT_DANGLING const T * find_widget (const std::string &id, const bool must_be_active, const bool must_exist) const
 
template<class T >
NOT_DANGLING T & find_widget (const std::string &id, const bool must_be_active=false)
 Gets a widget with the wanted id. More...
 
template<class T >
NOT_DANGLING const T & find_widget (const std::string &id, const bool must_be_active=false) const
 
- Public Member Functions inherited from gui2::event_executor
 event_executor ()
 
virtual ~event_executor ()
 
void set_wants_mouse_hover (const bool hover=true)
 
bool wants_mouse_hover () const
 
void set_wants_mouse_left_double_click (const bool click=true)
 
bool wants_mouse_left_double_click () const
 
void set_wants_mouse_middle_double_click (const bool click=true)
 
bool wants_mouse_middle_double_click () const
 
event_executorset_wants_mouse_right_double_click (const bool click=true)
 
bool wants_mouse_right_double_click () const
 
- Public Member Functions inherited from gui2::event::dispatcher
 dispatcher ()
 
virtual ~dispatcher ()
 
void connect ()
 Connects the dispatcher to the event handler. More...
 
void disconnect ()
 Disconnects the dispatcher from the event handler. More...
 
bool is_connected () const
 Return whether the dispatcher is currently connected. More...
 
bool has_event (const ui_event event, const event_queue_type event_type)
 
bool fire (const ui_event event, widget &target)
 Fires an event which has no extra parameters. More...
 
bool fire (const ui_event event, widget &target, const point &coordinate)
 Fires an event which takes a coordinate parameter. More...
 
bool fire (const ui_event event, widget &target, const SDL_Keycode key, const SDL_Keymod modifier, const std::string &unicode)
 Fires an event which takes keyboard parameters. More...
 
bool fire (const ui_event event, widget &target, const point &pos, const point &distance)
 Fires an event which takes touch-motion parameters. More...
 
bool fire (const ui_event event, widget &target, const point &center, float dTheta, float dDist, uint8_t numFingers)
 Fires an event which takes touch-gesture parameters. More...
 
bool fire (const ui_event event, widget &target, void *)
 Fires an event which takes notification parameters. More...
 
bool fire (const ui_event event, widget &target, const message &msg)
 Fires an event which takes message parameters. More...
 
bool fire (const ui_event event, widget &target, const SDL_Event &sdlevent)
 Fires an event that's a raw SDL event. More...
 
bool fire (const ui_event event, widget &target, const std::string &text, int32_t start, int32_t len)
 Fires an event which takes text input parameters. More...
 
template<ui_event E, typename F >
void connect_signal (const F &func, const queue_position position=back_child)
 Adds a callback to the appropriate queue based on event type. More...
 
template<ui_event E, typename F >
void disconnect_signal (const F &func, const queue_position position=back_child)
 Removes a callback from the appropriate queue based on event type. More...
 
void capture_mouse ()
 Captures the mouse. More...
 
void release_mouse ()
 Releases the mouse capture. More...
 
void set_mouse_behavior (const mouse_behavior mouse_behavior)
 
mouse_behavior get_mouse_behavior () const
 
void set_want_keyboard_input (const bool want_keyboard_input)
 
bool get_want_keyboard_input () const
 
void register_hotkey (const hotkey::HOTKEY_COMMAND id, const hotkey_function &function)
 Registers a hotkey. More...
 
bool execute_hotkey (const hotkey::HOTKEY_COMMAND id)
 Executes a hotkey. More...
 
- Public Member Functions inherited from enable_lua_ptr< widget >
 enable_lua_ptr (widget *tp)
 
- Public Member Functions inherited from gui2::top_level_drawable
virtual void update ()
 Update state and any parameters that may effect layout, or any of the later stages. More...
 

Static Public Member Functions

static windowwindow_instance (const unsigned handle)
 Returns the instance of a window. More...
 
static retval get_retval_by_id (const std::string &id)
 Gets the retval for the default buttons. More...
 
static const std::string & type ()
 Static type getter that does not rely on the widget being constructed. More...
 
- Static Public Member Functions inherited from gui2::panel
static const std::string & type ()
 Static type getter that does not rely on the widget being constructed. More...
 

Private Member Functions

void update_render_textures ()
 Ensure render textures are valid and correct. More...
 
void layout_linked_widgets ()
 Layouts the linked widgets. More...
 
bool click_dismiss (const int mouse_button_mask)
 Handles a mouse click event for dismissing the dialog. More...
 
virtual const std::string & get_control_type () const override
 Inherited from styled_widget, implemented by REGISTER_WIDGET. More...
 
void redraw_windows_on_top () const
 Schedules windows on top of us (if any) to redraw. More...
 
void finalize (const builder_grid &content_grid)
 Finishes the initialization of the grid. More...
 
void generate_dot_file (const std::string &, const unsigned)
 
void signal_handler_sdl_video_resize (const event::ui_event event, bool &handled, const point &new_size)
 
void signal_handler_click_dismiss (const event::ui_event event, bool &handled, bool &halt, const int mouse_button_mask)
 The handler for the click dismiss mouse 'event'. More...
 
void signal_handler_sdl_key_down (const event::ui_event event, bool &handled, const SDL_Keycode key, const SDL_Keymod mod, bool handle_tab)
 
void signal_handler_message_show_tooltip (const event::ui_event event, bool &handled, const event::message &message)
 
void signal_handler_message_show_helptip (const event::ui_event event, bool &handled, const event::message &message)
 
void signal_handler_request_placement (const event::ui_event event, bool &handled)
 
void signal_handler_close_window ()
 

Private Attributes

texture render_buffer_ = {}
 The internal render buffer used by render() and expose(). More...
 
rect awaiting_rerender_
 The part of the window (if any) currently marked for rerender. More...
 
std::vector< rectdeferred_regions_
 Parts of the window (if any) with rendering deferred to next frame. More...
 
status status_
 The status of the window. More...
 
show_mode show_mode_
 The mode in which the window is shown. More...
 
int retval_
 
dialogs::modal_dialogowner_
 The dialog that owns the window. More...
 
bool need_layout_
 When set the form needs a full layout redraw cycle. More...
 
wfl::map_formula_callable variables_
 The variables of the canvas. More...
 
bool invalidate_layout_blocked_
 Is invalidate_layout blocked, see invalidate_layout_blocker. More...
 
bool hidden_
 Avoid drawing the window. More...
 
const bool automatic_placement_
 Do we wish to place the widget automatically? More...
 
const unsigned horizontal_placement_
 Sets the horizontal placement. More...
 
const unsigned vertical_placement_
 Sets the vertical placement. More...
 
typed_formula< unsigned > maximum_width_
 The maximum width if automatic_placement_ is true. More...
 
typed_formula< unsigned > maximum_height_
 The maximum height if automatic_placement_ is true. More...
 
typed_formula< unsigned > x_
 The formula to calculate the x value of the dialog. More...
 
typed_formula< unsigned > y_
 The formula to calculate the y value of the dialog. More...
 
typed_formula< unsigned > w_
 The formula to calculate the width of the dialog. More...
 
typed_formula< unsigned > h_
 The formula to calculate the height of the dialog. More...
 
typed_formula< bool > reevaluate_best_size_
 The formula to determine whether the size is good. More...
 
wfl::function_symbol_table functions_
 The formula definitions available for the calculation formulas. More...
 
builder_window::window_resolution::tooltip_info tooltip_
 The settings for the tooltip. More...
 
builder_window::window_resolution::tooltip_info helptip_
 The settings for the helptip. More...
 
bool click_dismiss_
 Do we want to have easy close behavior? More...
 
bool enter_disabled_
 Disable the enter key see our setter for more info. More...
 
bool escape_disabled_
 Disable the escape key see our setter for more info. More...
 
std::map< std::string, linked_sizelinked_size_
 List of the widgets, whose size are linked together. More...
 
std::vector< widget * > tab_order
 List of widgets in the tabbing order. More...
 
int mouse_button_state_
 The state of the mouse button. More...
 
unsigned int consecutive_changed_frames_ = 0u
 In how many consecutive frames the window has changed. More...
 
std::unique_ptr< event::distributorevent_distributor_
 
std::function< bool(window &)> exit_hook_
 

Friends

class debug_layout_graph
 
struct window_implementation
 
class invalidate_layout_blocker
 
class pane
 
std::unique_ptr< windowbuild (const builder_window::window_resolution &)
 

Additional Inherited Members

- Protected Member Functions inherited from gui2::container_base
virtual point calculate_best_size () const override
 See widget::calculate_best_size. More...
 
virtual void layout_children () override
 See widget::layout_children. More...
 
- Protected Member Functions inherited from gui2::styled_widget
resolution_definition_ptr get_config ()
 
resolution_definition_const_ptr get_config () const
 
template<typename T >
std::shared_ptr< const typename T::resolution > cast_config_to () const
 Casts the current resolution definition config to the respective type of a derived widget. More...
 
void set_config (resolution_definition_ptr config)
 
virtual void update_canvas ()
 Updates the canvas(ses). More...
 
unsigned int get_text_font_size () const
 Resolves and returns the text_font_size. More...
 
int get_text_maximum_width () const
 Returns the maximum width available for the text. More...
 
int get_text_maximum_height () const
 Returns the maximum height available for the text. More...
 
std::string get_label_token (const point &position, const char *delimiters=" \n\r\t") const
 Exposes font::pango_text::get_token, for the text label of this styled_widget. More...
 
std::string get_label_link (const point &position) const
 
- Protected Member Functions inherited from gui2::widget
void set_layout_size (const point &size)
 
const pointlayout_size () const
 
void clear_layout_size ()
 Throws away layout_size_. More...
 
- Protected Member Functions inherited from gui2::top_level_drawable
 top_level_drawable ()
 
virtual ~top_level_drawable ()
 
 top_level_drawable (const top_level_drawable &)
 
top_level_drawableoperator= (const top_level_drawable &)
 
 top_level_drawable (top_level_drawable &&)
 
top_level_drawableoperator= (top_level_drawable &&)
 

Detailed Description

base class of top level items, the only item which needs to store the final canvases to draw on.

A window is a kind of panel see the panel for which fields exist.

Definition at line 60 of file window.hpp.

Member Enumeration Documentation

◆ exit_hook

Enumerator
on_all 

Always run hook.

on_ok 

Run hook only if result is OK.

Definition at line 437 of file window.hpp.

◆ show_mode

Enumerator
none 
modal 
modeless 
tooltip 

Definition at line 463 of file window.hpp.

◆ status

enum gui2::window::status
strong

The status of the window.

Enumerator
NEW 

The window is new and not yet shown.

SHOWING 

The window is being shown.

REQUEST_CLOSE 

The window has been requested to be closed but still needs to evaluate the request.

CLOSED 

The window has been closed.

Definition at line 206 of file window.hpp.

Constructor & Destructor Documentation

◆ window()

gui2::window::window ( const builder_window::window_resolution definition)
explicit

< Needs to be initialized in show.

Todo:
: should eventally become part of global hotkey handling.

Definition at line 253 of file window.cpp.

◆ ~window()

gui2::window::~window ( )
virtual

Definition at line 380 of file window.cpp.

References gui2::dialogs::tip::remove().

Member Function Documentation

◆ add_linked_widget()

void gui2::window::add_linked_widget ( const std::string &  id,
widget widget 
)

Adds a widget to a linked size group.

The group needs to exist, which is done by calling init_linked_size_group. A widget may only be member of one group.

Todo:
Untested if a new widget is added after showing the widgets.
Parameters
idThe id of the group.
widgetThe widget to add to the group.

Definition at line 804 of file window.cpp.

References ERR_GUI, has_linked_size_group(), gui2::widget::id(), and linked_size_.

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

◆ add_to_keyboard_chain()

void gui2::window::add_to_keyboard_chain ( widget widget)

◆ add_to_tab_order()

void gui2::window::add_to_tab_order ( widget widget,
int  at = -1 
)

◆ click_dismiss()

bool gui2::window::click_dismiss ( const int  mouse_button_mask)
private

Handles a mouse click event for dismissing the dialog.

Parameters
mouse_button_maskThe SDL_BUTTON mask for the button used to dismiss the click. If the caller is from the keyboard code the value should be 0.
Returns
Whether the event should be considered as handled.

Definition at line 1084 of file window.cpp.

References does_click_dismiss(), mouse_button_state_, gui2::OK, and set_retval().

Referenced by set_click_dismiss(), signal_handler_click_dismiss(), and signal_handler_sdl_key_down().

◆ close()

void gui2::window::close ( )
inline

◆ defer_region()

void gui2::window::defer_region ( const rect region)

Defer rendering of a particular region to next frame.

This is used for blur, which must render the region underneath once before rendering the blur.

Parameters
regionThe region to defer in screen coordinates.

Definition at line 691 of file window.cpp.

References LOG_DP.

Referenced by gui2::grid::impl_draw_children().

◆ dialog()

dialogs::modal_dialog* gui2::window::dialog ( )
inline

Inherited from widget.

Definition at line 268 of file window.hpp.

References owner_.

◆ does_click_dismiss()

bool gui2::window::does_click_dismiss ( ) const
inline

Does the window close easily?

The behavior can change at run-time, but that might cause oddities with the easy close button (when one is needed).

Returns
Whether or not the window closes easily.

Definition at line 310 of file window.hpp.

References click_dismiss_, and gui2::container_base::disable_click_dismiss().

Referenced by click_dismiss().

◆ draw()

void gui2::window::draw ( )

Draws the window.

This routine draws the window if needed, it's called from the event handler. This is done by a drawing event. When a window is shown it manages an SDL timer which fires a drawing event every X milliseconds, that event calls this routine. Don't call it manually.

Definition at line 600 of file window.cpp.

◆ expose()

bool gui2::window::expose ( const rect region)
overridevirtual

Called by draw_manager when it believes a redraw is necessary.

Can be called multiple times per vsync.

Implements gui2::top_level_drawable.

Definition at line 719 of file window.cpp.

References draw::blit(), rect::clip(), DBG_DP, dst, rect::empty(), draw::get_clip(), rect::intersect(), rect::shift(), and src.

◆ finalize()

void gui2::window::finalize ( const builder_grid content_grid)
private

Finishes the initialization of the grid.

Parameters
content_gridThe new contents for the content grid.

Definition at line 1097 of file window.cpp.

References gui2::builder_grid::build(), c, gui2::widget::find_widget(), gui2::container_base::get_grid(), gui2::widget::id(), and gui2::widget::set_id().

◆ find() [1/2]

const widget * gui2::window::find ( const std::string &  id,
const bool  must_be_active 
) const
overridevirtual

See widget::find.

Reimplemented from gui2::container_base.

Definition at line 783 of file window.cpp.

References gui2::container_base::find().

◆ find() [2/2]

widget * gui2::window::find ( const std::string &  id,
const bool  must_be_active 
)
overridevirtual

◆ find_at() [1/2]

const widget * gui2::window::find_at ( const point coordinate,
const bool  must_be_active 
) const
overridevirtual

See widget::find_at.

Reimplemented from gui2::container_base.

Definition at line 772 of file window.cpp.

References gui2::container_base::find_at().

◆ find_at() [2/2]

widget * gui2::window::find_at ( const point coordinate,
const bool  must_be_active 
)
overridevirtual

See widget::find_at.

Reimplemented from gui2::container_base.

Definition at line 767 of file window.cpp.

References gui2::container_base::find_at().

Referenced by gui2::dialogs::drop_down_menu::mouse_up_callback().

◆ generate_dot_file()

void gui2::window::generate_dot_file ( const std::string &  ,
const unsigned   
)
inlineprivate

Definition at line 679 of file window.hpp.

Referenced by layout().

◆ get_control_type()

virtual const std::string& gui2::window::get_control_type ( ) const
overrideprivatevirtual

Inherited from styled_widget, implemented by REGISTER_WIDGET.

Reimplemented from gui2::panel.

◆ get_distributor()

const event::distributor& gui2::window::get_distributor ( ) const
inline

Gets a reference to the window's distributor to allow some state peeking.

Definition at line 688 of file window.hpp.

References event_distributor_.

◆ get_linked_size()

point gui2::window::get_linked_size ( const std::string &  linked_group_id) const
inline

Definition at line 427 of file window.hpp.

References linked_size_, and draw::point().

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

◆ get_need_layout()

bool gui2::window::get_need_layout ( ) const
inline

Definition at line 417 of file window.hpp.

References need_layout_.

Referenced by gui2::scrollbar_container::content_resize_request().

◆ get_retval()

int gui2::window::get_retval ( )
inline

◆ get_retval_by_id()

retval gui2::window::get_retval_by_id ( const std::string &  id)
static

Gets the retval for the default buttons.

Definition at line 419 of file window.cpp.

References gui2::CANCEL, gui2::NONE, and gui2::OK.

Referenced by gui2::implementation::get_retval().

◆ has_linked_size_group()

bool gui2::window::has_linked_size_group ( const std::string &  id)

Is the linked size group defined for this window?

Parameters
idThe id of the group.
Returns
True if defined, false otherwise.

Definition at line 799 of file window.cpp.

References linked_size_.

Referenced by add_linked_widget(), init_linked_size_group(), and remove_linked_widget().

◆ hide()

void gui2::window::hide ( )

Hides the window.

It will not draw until it is shown again.

Definition at line 627 of file window.cpp.

References id, and LOG_DP.

◆ init_linked_size_group()

void gui2::window::init_linked_size_group ( const std::string &  id,
const bool  fixed_width,
const bool  fixed_height 
)

Initializes a linked size group.

Note at least one of fixed_width or fixed_height must be true.

Parameters
idThe id of the group.
fixed_widthDoes the group have a fixed width?
fixed_heightDoes the group have a fixed height?

Definition at line 789 of file window.cpp.

References has_linked_size_group(), gui2::widget::id(), and linked_size_.

Referenced by gui2::container_base::inject_linked_groups().

◆ invalidate_layout()

void gui2::window::invalidate_layout ( )

◆ invalidate_layout_blocked()

bool gui2::window::invalidate_layout_blocked ( ) const
inline

Is invalidate_layout blocked, see invalidate_layout_blocker.

Definition at line 245 of file window.hpp.

References invalidate_layout_blocked_.

◆ keyboard_capture()

void gui2::window::keyboard_capture ( widget widget)

Definition at line 1207 of file window.cpp.

References event_distributor_.

Referenced by add_to_tab_order(), gui2::dialogs::chat_log::view::bind(), gui2::dialogs::lua_interpreter::controller::bind(), gui2::dialogs::modal_dialog::init_fields(), intf_set_dialog_focus(), gui2::listbox::list_item_clicked(), gui2::dialogs::file_dialog::on_bookmark_selected(), gui2::dialogs::file_dialog::on_row_selected(), gui2::dialogs::addon_manager::pre_show(), gui2::dialogs::campaign_difficulty::pre_show(), gui2::dialogs::campaign_selection::pre_show(), gui2::dialogs::core_selection::pre_show(), gui2::dialogs::drop_down_menu::pre_show(), gui2::dialogs::editor_edit_pbl::pre_show(), gui2::dialogs::editor_edit_pbl_translation::pre_show(), gui2::dialogs::editor_generate_map::pre_show(), gui2::dialogs::file_dialog::pre_show(), gui2::dialogs::game_load::pre_show(), gui2::dialogs::game_stats::pre_show(), gui2::dialogs::help_browser::pre_show(), gui2::dialogs::language_selection::pre_show(), gui2::dialogs::log_settings::pre_show(), gui2::dialogs::message::pre_show(), gui2::dialogs::faction_select::pre_show(), gui2::dialogs::mp_lobby::pre_show(), gui2::dialogs::mp_create_game::pre_show(), gui2::dialogs::mp_login::pre_show(), gui2::dialogs::preferences_dialog::pre_show(), gui2::dialogs::prompt::pre_show(), gui2::dialogs::screenshot_notification::pre_show(), gui2::dialogs::simple_item_selector::pre_show(), gui2::dialogs::theme_list::pre_show(), gui2::dialogs::unit_advance::pre_show(), gui2::dialogs::unit_attack::pre_show(), gui2::dialogs::unit_create::pre_show(), gui2::dialogs::unit_list::pre_show(), gui2::dialogs::unit_recall::pre_show(), gui2::dialogs::unit_recruit::pre_show(), gui2::dialogs::wml_message_base::pre_show(), gui2::scroll_label::signal_handler_left_button_down(), gui2::scroll_text::signal_handler_left_button_down(), gui2::spinner::signal_handler_left_button_down(), gui2::tree_view::signal_handler_left_button_down(), gui2::combobox::signal_handler_left_button_down(), gui2::multiline_text::signal_handler_left_button_down(), gui2::text_box::signal_handler_left_button_down(), gui2::slider::signal_handler_left_button_up(), gui2::chatbox::signal_handler_receive_keyboard_focus(), signal_handler_sdl_key_down(), and gui2::chatbox::switch_to_window().

◆ layout()

void gui2::window::layout ( )
overridevirtual

Lays out the window.

This part does the pre and post processing for the actual layout algorithm.

See Layout algorithm for more information.

This is also called by draw_manager to finalize screen layout.

Todo:
implement the scrollbars on the window.
Todo:
implement the scrollbars on the window.

Reimplemented from gui2::top_level_drawable.

Reimplemented in gui2::dialogs::loading_screen.

Definition at line 838 of file window.cpp.

References _(), wfl::map_formula_callable::add(), automatic_placement_, click_dismiss_, gui2::event::connect_signal_mouse_left_click(), DBG_DP, gui2::container_base::disable_click_dismiss(), functions_, generate_dot_file(), gui2::widget::get_best_size(), gui2::get_mouse_position(), gui2::get_screen_size_variables(), h_, gui2::grid::HORIZONTAL_ALIGN_CENTER, gui2::grid::HORIZONTAL_ALIGN_LEFT, gui2::grid::HORIZONTAL_ALIGN_RIGHT, horizontal_placement_, gui2::event::init_mouse_location(), gui2::widget::invisible, gui2::window_implementation::layout(), gui2::container_base::layout_initialize(), layout_linked_widgets(), gui2::log_gui_layout, log_scope2, LOG_SCOPE_HEADER, maximum_height_, maximum_width_, need_layout_, gui2::OK, gui2::container_base::place(), reevaluate_best_size_, gui2::settings::screen_height, gui2::settings::screen_width, set_retval(), gui2::widget::set_visible(), utf8::size(), VALIDATE, variables_, gui2::grid::VERTICAL_ALIGN_BOTTOM, gui2::grid::VERTICAL_ALIGN_CENTER, gui2::grid::VERTICAL_ALIGN_TOP, vertical_placement_, gui2::widget::visible, w_, x_, and y_.

Referenced by gui2::dialogs::loading_screen::layout(), and gui2::window_implementation::layout().

◆ layout_linked_widgets()

void gui2::window::layout_linked_widgets ( )
private

◆ mode()

show_mode gui2::window::mode ( ) const
inline

◆ mouse_capture()

void gui2::window::mouse_capture ( const bool  capture = true)

◆ queue_rerender() [1/2]

void gui2::window::queue_rerender ( )

Definition at line 677 of file window.cpp.

◆ queue_rerender() [2/2]

void gui2::window::queue_rerender ( const rect region)

Queue a rerender of the internal render buffer.

This does not request a repaint. Ordinarily use queue_redraw() on a widget, which will call this automatically.

Parameters
regionThe region to rerender in screen coordinates.

Definition at line 682 of file window.cpp.

References rect::intersect(), and rect::shift().

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

◆ redraw_windows_on_top()

void gui2::window::redraw_windows_on_top ( ) const
private

Schedules windows on top of us (if any) to redraw.

◆ remove_from_keyboard_chain()

void gui2::window::remove_from_keyboard_chain ( widget widget)

Remove the widget from the keyboard chain.

Todo:
rename to keyboard_remove_from_chain.
Parameters
widgetThe widget to be removed from the chain.

Definition at line 1219 of file window.cpp.

References event_distributor_.

◆ remove_linked_widget()

void gui2::window::remove_linked_widget ( const std::string &  id,
const widget widget 
)

Removes a widget from a linked size group.

The group needs to exist, which is done by calling init_linked_size_group. If the widget is no member of the group the function does nothing.

Parameters
idThe id of the group.
widgetThe widget to remove from the group.

Definition at line 818 of file window.cpp.

References has_linked_size_group(), gui2::widget::id(), and linked_size_.

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

◆ render()

void gui2::window::render ( )
overridevirtual

Ensure the window's internal render buffer is up-to-date.

This renders the window to an off-screen texture, which is then copied to the screen during expose().

Reimplemented from gui2::top_level_drawable.

Definition at line 697 of file window.cpp.

References DBG_DP, events::draw(), sdl::empty_rect, draw::override_clip(), and draw::set_render_target().

◆ screen_location()

rect gui2::window::screen_location ( )
overridevirtual

The current draw location of the window, on the screen.

Implements gui2::top_level_drawable.

Definition at line 740 of file window.cpp.

◆ set_click_dismiss()

void gui2::window::set_click_dismiss ( const bool  click_dismiss)
inline

◆ set_enter_disabled()

void gui2::window::set_enter_disabled ( const bool  enter_disabled)
inline

◆ set_escape_disabled()

void gui2::window::set_escape_disabled ( const bool  escape_disabled)
inline

Disable the escape key.

This is added to block dialogs from being closed automatically.

Todo:
this function should be merged with the hotkey support once that has been added.

Definition at line 336 of file window.hpp.

References escape_disabled_.

Referenced by gui2::dialogs::title_screen::init_callbacks(), gui2::dialogs::addon_manager::pre_show(), gui2::dialogs::loading_screen::pre_show(), gui2::dialogs::mp_join_game::pre_show(), gui2::dialogs::mp_staging::pre_show(), gui2::dialogs::unit_advance::pre_show(), and gui2::dialogs::wml_message_base::pre_show().

◆ set_exit_hook()

void gui2::window::set_exit_hook ( exit_hook  mode,
std::function< bool(window &)>  func 
)
inline

Sets the window's exit hook.

A window will only close if the given function returns true under the specified mode.

Definition at line 449 of file window.hpp.

References exit_hook_, mode(), gui2::OK, on_all, on_ok, and w.

Referenced by gui2::dialogs::addon_manager::pre_show(), gui2::dialogs::file_dialog::pre_show(), gui2::dialogs::mp_lobby::pre_show(), gui2::dialogs::mp_create_game::pre_show(), and gui2::dialogs::mp_report::pre_show().

◆ set_owner()

void gui2::window::set_owner ( dialogs::modal_dialog owner)
inline

Definition at line 407 of file window.hpp.

References owner_.

◆ set_retval()

void gui2::window::set_retval ( const int  retval,
const bool  close_window = true 
)
inline

Sets there return value of the window.

Parameters
retvalThe return value for the window.
close_windowClose the window after setting the value.

Definition at line 395 of file window.hpp.

References close(), and retval_.

Referenced by gui2::dialogs::title_screen::button_callback_cores(), gui2::dialogs::title_screen::button_callback_multiplayer(), gui2::dialogs::formula_debugger::callback_continue_button(), gui2::dialogs::formula_debugger::callback_next_button(), gui2::dialogs::formula_debugger::callback_step_button(), gui2::dialogs::formula_debugger::callback_stepout_button(), click_dismiss(), gui2::dialogs::unit_recall::dismiss_unit(), gui2::dialogs::mp_lobby::enter_game(), gui2::dialogs::preferences_dialog::handle_gui2_theme_select(), gui2::dialogs::title_screen::hotkey_callback_select_tests(), gui2::dialogs::title_screen::init_callbacks(), layout(), gui2::dialogs::mp_create_game::load_game_callback(), gui2::dialogs::drop_down_menu::mouse_up_callback(), gui2::dialogs::mp_join_game::network_handler(), gui2::dialogs::mp_staging::network_handler(), gui2::dialogs::file_dialog::on_exit(), gui2::dialogs::title_screen::on_resize(), gui2::dialogs::mp_create_game::post_show(), gui2::dialogs::mp_lobby::pre_show(), gui2::dialogs::mp_create_game::pre_show(), gui2::dialogs::mp_join_game::pre_show(), gui2::dialogs::mp_staging::pre_show(), gui2::dialogs::campaign_selection::proceed(), gui2::dialogs::file_dialog::push_fileview_row(), gui2::dialogs::editor_edit_unit::quit_confirmation(), gui2::dialogs::title_screen::register_button(), gui2::dialogs::hotkey_bind::sdl_event_callback(), gui2::dialogs::title_screen::show_preferences(), signal_handler_close_window(), gui2::button::signal_handler_left_button_click(), gui2::toggle_button::signal_handler_left_button_double_click(), gui2::toggle_panel::signal_handler_left_button_double_click(), signal_handler_sdl_key_down(), and gui2::dialogs::mp_staging::start_game().

◆ set_variable()

void gui2::window::set_variable ( const std::string &  key,
const wfl::variant value 
)
inline

◆ show()

int gui2::window::show ( unsigned  auto_close_timeout = 0)

Shows the window, running an event loop until it should close.

Parameters
auto_close_timeoutThe time in ms after which the window will automatically close, if 0 it doesn't close.
Note
the timeout is a minimum time and there's no guarantee about how fast it closes after the minimum.
Returns
The close code of the window, predefined values are listed in retval.

Definition at line 498 of file window.cpp.

References CLOSE_WINDOW_EVENT, data, DBG_DP, events::draw(), sdl::get_mouse_button_mask(), utils::get_unknown_exception_type(), id, LOG_DP, gui2::log_gui_draw, log_scope2, LOG_SCOPE_HEADER, events::pump(), and gui2::dialogs::tip::remove().

Referenced by gui2::dialogs::modal_dialog::show().

◆ show_non_modal()

void gui2::window::show_non_modal ( )

Shows the window non modal.

A tooltip can be interacted with unlike the tooltip.

Todo:
implement auto_close_timeout.

auto_close_timeout The time in ms after which the window will automatically close, if 0 it doesn't close.

Note
the timeout is a minimum time and there's no guarantee about how fast it closes after the minimum.

Definition at line 464 of file window.cpp.

References DBG_DP, id, LOG_DP, gui2::log_gui_draw, log_scope2, and events::pump_and_draw().

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

◆ show_tooltip()

void gui2::window::show_tooltip ( )

Shows the window as a tooltip.

A tooltip can't be interacted with and is just shown.

Todo:
implement auto_close_timeout.

auto_close_timeout The time in ms after which the window will automatically close, if 0 it doesn't close.

Note
the timeout is a minimum time and there's no guarantee about how fast it closes after the minimum.

Definition at line 432 of file window.cpp.

References DBG_DP, id, LOG_DP, gui2::log_gui_draw, log_scope2, and tooltip.

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

◆ signal_handler_click_dismiss()

void gui2::window::signal_handler_click_dismiss ( const event::ui_event  event,
bool &  handled,
bool &  halt,
const int  mouse_button_mask 
)
private

The handler for the click dismiss mouse 'event'.

Parameters
eventSee event::dispatcher::fire.
handledSee event::dispatcher::fire.
haltSee event::dispatcher::fire.
mouse_button_maskForwared to click_dismiss.

Definition at line 1256 of file window.cpp.

References click_dismiss(), DBG_GUI_E, and LOG_HEADER.

◆ signal_handler_close_window()

void gui2::window::signal_handler_close_window ( )
private

Definition at line 1379 of file window.cpp.

References gui2::AUTO_CLOSE, and set_retval().

◆ signal_handler_message_show_helptip()

void gui2::window::signal_handler_message_show_helptip ( const event::ui_event  event,
bool &  handled,
const event::message message 
)
private

◆ signal_handler_message_show_tooltip()

void gui2::window::signal_handler_message_show_tooltip ( const event::ui_event  event,
bool &  handled,
const event::message message 
)
private

◆ signal_handler_request_placement()

void gui2::window::signal_handler_request_placement ( const event::ui_event  event,
bool &  handled 
)
private

Definition at line 1369 of file window.cpp.

References DBG_GUI_E, invalidate_layout(), and LOG_HEADER.

◆ signal_handler_sdl_key_down()

void gui2::window::signal_handler_sdl_key_down ( const event::ui_event  event,
bool &  handled,
const SDL_Keycode  key,
const SDL_Keymod  mod,
bool  handle_tab 
)
private

◆ signal_handler_sdl_video_resize()

void gui2::window::signal_handler_sdl_video_resize ( const event::ui_event  event,
bool &  handled,
const point new_size 
)
private

◆ type()

static const std::string& gui2::window::type ( )
static

◆ update_render_textures()

void gui2::window::update_render_textures ( )
private

Ensure render textures are valid and correct.

Definition at line 643 of file window.cpp.

References draw::clear(), events::draw(), video::get_pixel_scale(), image::get_size(), LOG_DP, draw_manager::render(), draw::set_render_target(), and setter.

◆ window_instance()

window * gui2::window::window_instance ( const unsigned  handle)
static

Returns the instance of a window.

Parameters
handleThe instance id of the window.
Returns
The window or nullptr.

Definition at line 414 of file window.cpp.

References gui2::widget::get_window().

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

Friends And Related Function Documentation

◆ build

std::unique_ptr<window> build ( const builder_window::window_resolution )
friend

◆ debug_layout_graph

friend class debug_layout_graph
friend

Definition at line 62 of file window.hpp.

◆ invalidate_layout_blocker

friend class invalidate_layout_blocker
friend

Definition at line 65 of file window.hpp.

◆ pane

friend class pane
friend

Definition at line 66 of file window.hpp.

◆ window_implementation

friend struct window_implementation
friend

Definition at line 64 of file window.hpp.

Member Data Documentation

◆ automatic_placement_

const bool gui2::window::automatic_placement_
private

Do we wish to place the widget automatically?

Definition at line 505 of file window.hpp.

Referenced by layout().

◆ awaiting_rerender_

rect gui2::window::awaiting_rerender_
private

The part of the window (if any) currently marked for rerender.

Definition at line 166 of file window.hpp.

◆ click_dismiss_

bool gui2::window::click_dismiss_
private

Do we want to have easy close behavior?

Easy closing means that whenever a mouse click is done the dialog will be closed. The widgets in the window may override this behavior by registering themselves as blockers. This is tested by the function disable_click_dismiss().

The handling of easy close is done in the window, in order to do so a window either needs a click_dismiss or an ok button. Both will be hidden when not needed and when needed first the ok is tried and then the click_dismiss button. this allows adding a click_dismiss button to the window definition and use the ok from the window instance.

Todo:
After testing the click dismiss feature it should be documented in the wiki.

Definition at line 570 of file window.hpp.

Referenced by does_click_dismiss(), layout(), and set_click_dismiss().

◆ consecutive_changed_frames_

unsigned int gui2::window::consecutive_changed_frames_ = 0u
private

In how many consecutive frames the window has changed.

This is used to detect the situation where the title screen changes in every frame, forcing all other windows to redraw everything all the time.

Definition at line 658 of file window.hpp.

◆ deferred_regions_

std::vector<rect> gui2::window::deferred_regions_
private

Parts of the window (if any) with rendering deferred to next frame.

Definition at line 169 of file window.hpp.

◆ enter_disabled_

bool gui2::window::enter_disabled_
private

Disable the enter key see our setter for more info.

Definition at line 573 of file window.hpp.

Referenced by set_enter_disabled(), and signal_handler_sdl_key_down().

◆ escape_disabled_

bool gui2::window::escape_disabled_
private

Disable the escape key see our setter for more info.

Definition at line 576 of file window.hpp.

Referenced by set_escape_disabled(), and signal_handler_sdl_key_down().

◆ event_distributor_

std::unique_ptr<event::distributor> gui2::window::event_distributor_
private

◆ exit_hook_

std::function<bool(window&)> gui2::window::exit_hook_
private

Definition at line 769 of file window.hpp.

Referenced by set_exit_hook().

◆ functions_

wfl::function_symbol_table gui2::window::functions_
private

The formula definitions available for the calculation formulas.

Definition at line 545 of file window.hpp.

Referenced by layout().

◆ h_

typed_formula<unsigned> gui2::window::h_
private

The formula to calculate the height of the dialog.

Definition at line 539 of file window.hpp.

Referenced by layout().

◆ helptip_

builder_window::window_resolution::tooltip_info gui2::window::helptip_
private

The settings for the helptip.

Definition at line 551 of file window.hpp.

Referenced by signal_handler_message_show_helptip().

◆ hidden_

bool gui2::window::hidden_
private

Avoid drawing the window.


Definition at line 502 of file window.hpp.

◆ horizontal_placement_

const unsigned gui2::window::horizontal_placement_
private

Sets the horizontal placement.

Only used if automatic_placement_ is true. The value should be a grid placement flag.

Definition at line 513 of file window.hpp.

Referenced by layout().

◆ invalidate_layout_blocked_

bool gui2::window::invalidate_layout_blocked_
private

◆ linked_size_

std::map<std::string, linked_size> gui2::window::linked_size_
private

List of the widgets, whose size are linked together.

Definition at line 603 of file window.hpp.

Referenced by add_linked_widget(), get_linked_size(), has_linked_size_group(), init_linked_size_group(), layout_linked_widgets(), and remove_linked_widget().

◆ maximum_height_

typed_formula<unsigned> gui2::window::maximum_height_
private

The maximum height if automatic_placement_ is true.

Definition at line 527 of file window.hpp.

Referenced by layout().

◆ maximum_width_

typed_formula<unsigned> gui2::window::maximum_width_
private

The maximum width if automatic_placement_ is true.

Definition at line 524 of file window.hpp.

Referenced by layout().

◆ mouse_button_state_

int gui2::window::mouse_button_state_
private

The state of the mouse button.

When click dismissing a dialog in the past the DOWN event was used. This lead to a bug [1]. The obvious change was to switch to the UP event, this lead to another bug; the dialog was directly dismissed. Since the game map code uses the UP and DOWN event to select a unit there is no simple solution.

Upon entry this value stores the mouse button state at entry. When a button is DOWN and goes UP that button does not trigger a dismissal of the dialog, instead that button's down state is removed from this variable. Therefore the next UP event does dismiss the dialog.

[1] https://gna.org/bugs/index.php?18970

Definition at line 643 of file window.hpp.

Referenced by click_dismiss().

◆ need_layout_

bool gui2::window::need_layout_
private

When set the form needs a full layout redraw cycle.

This happens when either a widget changes it's size or visibility or the window is resized.

Definition at line 493 of file window.hpp.

Referenced by get_need_layout(), invalidate_layout(), and layout().

◆ owner_

dialogs::modal_dialog* gui2::window::owner_
private

◆ reevaluate_best_size_

typed_formula<bool> gui2::window::reevaluate_best_size_
private

The formula to determine whether the size is good.

Definition at line 542 of file window.hpp.

Referenced by layout().

◆ render_buffer_

texture gui2::window::render_buffer_ = {}
private

The internal render buffer used by render() and expose().

Definition at line 163 of file window.hpp.

◆ retval_

int gui2::window::retval_
private

Definition at line 482 of file window.hpp.

Referenced by get_retval(), and set_retval().

◆ show_mode_

show_mode gui2::window::show_mode_
private

The mode in which the window is shown.

This is used to determine whether or not to remove the tip.

Definition at line 479 of file window.hpp.

Referenced by mode().

◆ status_

status gui2::window::status_
private

The status of the window.

Definition at line 472 of file window.hpp.

Referenced by close().

◆ tab_order

std::vector<widget*> gui2::window::tab_order
private

List of widgets in the tabbing order.

Definition at line 606 of file window.hpp.

Referenced by add_to_tab_order(), and signal_handler_sdl_key_down().

◆ tooltip_

builder_window::window_resolution::tooltip_info gui2::window::tooltip_
private

The settings for the tooltip.

Definition at line 548 of file window.hpp.

Referenced by signal_handler_message_show_tooltip().

◆ variables_

wfl::map_formula_callable gui2::window::variables_
private

The variables of the canvas.

Definition at line 496 of file window.hpp.

Referenced by layout(), and set_variable().

◆ vertical_placement_

const unsigned gui2::window::vertical_placement_
private

Sets the vertical placement.

Only used if automatic_placement_ is true. The value should be a grid placement flag.

Definition at line 521 of file window.hpp.

Referenced by layout().

◆ w_

typed_formula<unsigned> gui2::window::w_
private

The formula to calculate the width of the dialog.

Definition at line 536 of file window.hpp.

Referenced by layout().

◆ x_

typed_formula<unsigned> gui2::window::x_
private

The formula to calculate the x value of the dialog.

Definition at line 530 of file window.hpp.

Referenced by layout().

◆ y_

typed_formula<unsigned> gui2::window::y_
private

The formula to calculate the y value of the dialog.

Definition at line 533 of file window.hpp.

Referenced by layout().


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