base class of top level items, the only item which needs to store the final canvases to draw on. More...
#include <window.hpp>
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 { always , ok_only } |
enum class | show_mode { none , modal , modeless , tooltip } |
![]() | |
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 } |
![]() | |
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 ®ion) 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 ®ion) |
Queue a rerender of the internal render buffer. More... | |
void | queue_rerender () |
void | defer_region (const rect ®ion) |
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 widget * | find_at (const point &coordinate, const bool must_be_active) override |
See widget::find_at. More... | |
virtual const widget * | find_at (const point &coordinate, const bool must_be_active) const override |
See widget::find_at. More... | |
dialogs::modal_dialog * | dialog () |
Inherited from widget. More... | |
widget * | find (const std::string_view id, const bool must_be_active) override |
See widget::find. More... | |
const widget * | find (const std::string_view 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... | |
bool | 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 (std::string_view group_id) const |
template<typename Func > | |
void | set_exit_hook (exit_hook mode, const Func &hook) |
Sets the window's exit hook. More... | |
const event::distributor & | get_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... | |
![]() | |
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... | |
![]() | |
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 grid & | get_grid () const |
grid & | get_grid () |
![]() | |
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_string & | get_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_string & | tooltip () const |
void | set_tooltip (const t_string &tooltip) |
const t_string & | help_message () const |
void | set_help_message (const t_string &help_message) |
std::vector< canvas > & | get_canvases () |
canvas & | get_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... | |
![]() | |
widget (const widget &)=delete | |
widget & | operator= (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 |
window * | get_window () |
Get the parent window. More... | |
const window * | get_window () const |
The constant version of get_window. More... | |
grid * | get_parent_grid () |
Get the parent grid. More... | |
const grid * | get_parent_grid () const |
void | set_parent (widget *parent) |
widget * | parent () |
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 ®ion) |
Indicate that specific region of the screen should be redrawn. More... | |
void | set_visible (const visibility visible) |
visibility | get_visible () const |
void | set_visible (bool visible) |
Sets widget to visible if visible is true, else invisible. More... | |
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 > | |
T * | find_widget (const std::string_view id, const bool must_be_active, const bool must_exist) |
Gets a widget with the wanted id. More... | |
template<class T > | |
const T * | find_widget (const std::string_view id, const bool must_be_active, const bool must_exist) const |
template<class T > | |
T & | find_widget (const std::string_view id, const bool must_be_active=false) |
Gets a widget with the wanted id. More... | |
template<class T > | |
const T & | find_widget (const std::string_view id, const bool must_be_active=false) const |
![]() | |
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_executor & | set_wants_mouse_right_double_click (const bool click=true) |
bool | wants_mouse_right_double_click () const |
![]() | |
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 ¢er, 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... | |
![]() | |
enable_lua_ptr (widget *tp) | |
enable_lua_ptr (enable_lua_ptr &&o) | |
enable_lua_ptr & | operator= (enable_lua_ptr &&o) |
![]() | |
virtual void | update () |
Update state and any parameters that may effect layout, or any of the later stages. More... | |
Static Public Member Functions | |
static window * | window_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 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< rect > | deferred_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_dialog * | owner_ |
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_size, std::less<> > | linked_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::distributor > | event_distributor_ |
std::function< bool()> | exit_hook_ |
Friends | |
class | debug_layout_graph |
struct | window_implementation |
class | invalidate_layout_blocker |
class | pane |
Additional Inherited Members | |
![]() | |
virtual point | calculate_best_size () const override |
See widget::calculate_best_size. More... | |
virtual void | layout_children () override |
See widget::layout_children. More... | |
![]() | |
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 |
![]() | |
void | set_layout_size (const point &size) |
const point & | layout_size () const |
void | clear_layout_size () |
Throws away layout_size_. More... | |
![]() | |
top_level_drawable () | |
virtual | ~top_level_drawable () |
top_level_drawable (const top_level_drawable &) | |
top_level_drawable & | operator= (const top_level_drawable &) |
top_level_drawable (top_level_drawable &&) | |
top_level_drawable & | operator= (top_level_drawable &&) |
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.
|
strong |
Enumerator | |
---|---|
always | |
ok_only |
Definition at line 437 of file window.hpp.
|
strong |
Enumerator | |
---|---|
none | |
modal | |
modeless | |
tooltip |
Definition at line 464 of file window.hpp.
|
strong |
The status of the window.
Definition at line 205 of file window.hpp.
|
explicit |
< Needs to be initialized in show.
Definition at line 246 of file window.cpp.
|
virtual |
Definition at line 371 of file window.cpp.
References gui2::grid::get_cols(), gui2::container_base::get_grid(), gui2::grid::get_rows(), hidden_, modal, gui2::widget::queue_redraw(), gui2::dialogs::tip::remove(), gui2::grid::remove_child(), and show_mode_.
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.
id | The id of the group. |
widget | The widget to add to the group. |
Definition at line 792 of file window.cpp.
References ERR_GUI, utils::find(), has_linked_size_group(), gui2::widget::id(), and linked_size_.
Referenced by gui2::widget::layout_initialize().
void gui2::window::add_to_keyboard_chain | ( | widget * | widget | ) |
Adds the widget to the keyboard chain.
widget | The widget to add to the chain. The widget should be valid widget, which hasn't been added to the chain yet. |
Definition at line 1199 of file window.cpp.
References event_distributor_.
Referenced by gui2::addon_list::add_list_to_keyboard_chain(), gui2::dialogs::campaign_selection::pre_show(), gui2::dialogs::file_dialog::pre_show(), gui2::dialogs::game_load::pre_show(), gui2::dialogs::log_settings::pre_show(), gui2::dialogs::mp_create_game::pre_show(), gui2::dialogs::units_dialog::pre_show(), and gui2::dialogs::wml_message_base::pre_show().
void gui2::window::add_to_tab_order | ( | widget * | widget, |
int | at = -1 |
||
) |
Add the widget to the tabbing order.
widget | The widget to be added to the tabbing order |
at | A hint for where to place the widget in the tabbing order |
Definition at line 1211 of file window.cpp.
References schema_validation::at(), event_distributor_, utils::find(), keyboard_capture(), and tab_order.
Referenced by gui2::dialogs::addon_auth::pre_show(), gui2::dialogs::custom_tod::pre_show(), gui2::dialogs::editor_edit_label::pre_show(), gui2::dialogs::editor_edit_scenario::pre_show(), gui2::dialogs::editor_edit_side::pre_show(), gui2::dialogs::mp_login::pre_show(), and gui2::dialogs::lobby_player_info::pre_show().
|
private |
Handles a mouse click event for dismissing the dialog.
mouse_button_mask | The SDL_BUTTON mask for the button used to dismiss the click. If the caller is from the keyboard code the value should be 0. |
Definition at line 1070 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().
|
inline |
Requests to close the window.
This request is not always honored immediately, and so callers must account for the window remaining open. For example, when overriding draw_manager's update() method.
Definition at line 218 of file window.hpp.
References REQUEST_CLOSE, and status_.
Referenced by gui2::dialogs::lobby_player_info::check_status_button_callback(), gui2::dialogs::addon_manager::fetch_addons_list(), gui2::dialogs::synched_choice_wait::handle_generic_event(), intf_dialog_close(), gui2::dialogs::lobby_player_info::kick_ban_button_callback(), gui2::dialogs::lobby_player_info::kick_button_callback(), gui2::dialogs::story_viewer::nav_button_callback(), gui2::dialogs::synched_choice_wait::pre_show(), gui2::dialogs::loading_screen::process(), set_retval(), gui2::dialogs::lobby_player_info::start_whisper_button_callback(), and gui2::dialogs::lobby_player_info::stopgame_button_callback().
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.
region | The region to defer in screen coordinates. |
Definition at line 682 of file window.cpp.
References deferred_regions_, and LOG_DP.
Referenced by draw(), and gui2::grid::impl_draw_children().
|
inline |
|
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).
Definition at line 308 of file window.hpp.
References click_dismiss_, and gui2::container_base::disable_click_dismiss().
Referenced by click_dismiss().
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 591 of file window.cpp.
References defer_region(), gui2::widget::draw_background(), gui2::widget::draw_children(), gui2::widget::draw_foreground(), gui2::widget::get_rectangle(), and hidden_.
Referenced by render(), and update_render_textures().
|
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 710 of file window.cpp.
References draw::blit(), texture::clear_src(), rect::clip(), DBG_DP, dst, rect::empty(), draw::get_clip(), gui2::widget::get_origin(), gui2::widget::get_rectangle(), rect::intersect(), render_buffer_, texture::set_src(), rect::shift(), and src.
|
private |
Finishes the initialization of the grid.
content_grid | The new contents for the content grid. |
Definition at line 1083 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().
|
overridevirtual |
See widget::find.
Reimplemented from gui2::container_base.
Definition at line 774 of file window.cpp.
References gui2::container_base::find().
|
overridevirtual |
See widget::find.
Reimplemented from gui2::container_base.
Definition at line 769 of file window.cpp.
References gui2::container_base::find().
Referenced by gui2::dialogs::modal_dialog::init_fields(), and gui2::dialogs::lobby_player_info::pre_show().
|
overridevirtual |
See widget::find_at.
Reimplemented from gui2::container_base.
Definition at line 763 of file window.cpp.
References gui2::container_base::find_at().
|
overridevirtual |
See widget::find_at.
Reimplemented from gui2::container_base.
Definition at line 758 of file window.cpp.
References gui2::container_base::find_at().
Referenced by gui2::dialogs::drop_down_menu::mouse_up_callback().
|
inlineprivate |
Definition at line 680 of file window.hpp.
Referenced by layout(), show(), show_non_modal(), and show_tooltip().
|
overrideprivatevirtual |
Inherited from styled_widget, implemented by REGISTER_WIDGET.
Reimplemented from gui2::panel.
|
inline |
Gets a reference to the window's distributor to allow some state peeking.
Definition at line 689 of file window.hpp.
References event_distributor_.
|
inline |
Definition at line 428 of file window.hpp.
References linked_size_.
Referenced by gui2::widget::get_best_size().
|
inline |
Definition at line 417 of file window.hpp.
References need_layout_.
Referenced by gui2::scrollbar_container::content_resize_request().
|
inline |
Definition at line 402 of file window.hpp.
References retval_.
Referenced by gui2::dialogs::title_screen::button_callback_multiplayer(), quit_confirmation::default_prompt(), do_gameloop(), gui2::dialogs::addon_manager::exit_hook(), manage_addons(), gui2::dialogs::file_dialog::on_exit(), gui2::dialogs::addon_auth::post_show(), gui2::dialogs::addon_connect::post_show(), gui2::dialogs::addon_uninstall_list::post_show(), gui2::dialogs::campaign_difficulty::post_show(), gui2::dialogs::depcheck_select_new::post_show(), gui2::dialogs::editor_edit_pbl::post_show(), gui2::dialogs::game_stats::post_show(), gui2::dialogs::label_settings::post_show(), gui2::dialogs::language_selection::post_show(), gui2::dialogs::migrate_version_selection::post_show(), gui2::dialogs::faction_select::post_show(), gui2::dialogs::mp_change_control::post_show(), gui2::dialogs::mp_create_game::post_show(), gui2::dialogs::mp_join_game::post_show(), gui2::dialogs::mp_login::post_show(), gui2::dialogs::mp_method_selection::post_show(), gui2::dialogs::mp_report::post_show(), gui2::dialogs::mp_staging::post_show(), gui2::dialogs::network_transmission::post_show(), gui2::dialogs::reachmap_options::post_show(), gui2::dialogs::select_orb_colors::post_show(), gui2::dialogs::simple_item_selector::post_show(), gui2::dialogs::sp_options_configure::post_show(), gui2::dialogs::theme_list::post_show(), gui2::dialogs::unit_advance::post_show(), gui2::dialogs::unit_attack::post_show(), gui2::dialogs::units_dialog::post_show(), gui2::dialogs::mp_lobby::pre_show(), sp::select_campaign(), set_exit_hook(), gui2::dialogs::modal_dialog::show(), gui2::show_message(), gui2::dialogs::title_screen::show_preferences(), savegame::savegame::show_save_dialog(), and savegame::oos_savegame::show_save_dialog().
|
static |
Gets the retval for the default buttons.
Definition at line 410 of file window.cpp.
References gui2::CANCEL, gui2::NONE, and gui2::OK.
Referenced by gui2::implementation::get_retval().
bool gui2::window::has_linked_size_group | ( | const std::string & | id | ) |
Is the linked size group defined for this window?
id | The id of the group. |
Definition at line 787 of file window.cpp.
References linked_size_.
Referenced by add_linked_widget(), and remove_linked_widget().
void gui2::window::hide | ( | ) |
Hides the window.
It will not draw until it is shown again.
Definition at line 618 of file window.cpp.
References gui2::event::dispatcher::disconnect(), hidden_, gui2::widget::id(), gui2::event::dispatcher::is_connected(), LOG_DP, and gui2::widget::queue_redraw().
Referenced by show().
bool 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.
id | The id of the group. |
fixed_width | Does the group have a fixed width? |
fixed_height | Does the group have a fixed height? |
Definition at line 780 of file window.cpp.
References linked_size_.
Referenced by gui2::container_base::inject_linked_groups().
void gui2::window::invalidate_layout | ( | ) |
Updates the size of the window.
If the window has automatic placement set this function recalculates the window. To be used after creation and after modification or items which can have different sizes eg listboxes.
Definition at line 752 of file window.cpp.
References invalidate_layout_blocked_, and need_layout_.
Referenced by gui2::scrollbar_container::content_resize_height(), gui2::scrollbar_container::content_resize_width(), gui2::dialogs::editor_edit_unit::load_unit_type(), gui2::dialogs::help_browser::pre_show(), gui2::scrollbar_base::recalculate(), gui2::dialogs::units_dialog::rename_unit(), gui2::listbox::set_row_shown(), gui2::widget::set_visible(), show(), show_non_modal(), show_tooltip(), gui2::dialogs::help_browser::show_topic(), signal_handler_request_placement(), signal_handler_sdl_video_resize(), gui2::dialogs::custom_tod::update_image(), gui2::dialogs::editor_edit_unit::update_image(), gui2::multiline_text::update_layout(), gui2::dialogs::custom_tod::update_tod_display(), and WIDGET_SETTER().
|
inline |
Is invalidate_layout blocked, see invalidate_layout_blocker.
Definition at line 244 of file window.hpp.
References invalidate_layout_blocked_.
void gui2::window::keyboard_capture | ( | widget * | widget | ) |
Definition at line 1193 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::units_dialog::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().
|
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.
Reimplemented from gui2::top_level_drawable.
Reimplemented in gui2::dialogs::loading_screen.
Definition at line 824 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().
|
private |
Layouts the linked widgets.
See Layout algorithm for more information.
Definition at line 1024 of file window.cpp.
References gui2::widget::get_best_size(), gui2::window::linked_size::height, linked_size_, gui2::widget::set_layout_size(), utf8::size(), gui2::window::linked_size::widgets, and gui2::window::linked_size::width.
Referenced by layout(), gui2::window_implementation::layout(), and gui2::pane::signal_handler_request_placement().
|
inline |
Returns the dialog mode for this window.
Definition at line 695 of file window.hpp.
References show_mode_.
Referenced by gui2::dialogs::mp_lobby::enter_game(), gui2::dialogs::mp_lobby::enter_game_by_id(), gui2::dialogs::mp_lobby::enter_game_by_index(), gui2::dialogs::mp_lobby::enter_selected_game(), and set_exit_hook().
void gui2::window::mouse_capture | ( | const bool | capture = true | ) |
Definition at line 1187 of file window.cpp.
References event_distributor_.
Referenced by gui2::button::signal_handler_left_button_down(), gui2::combobox::signal_handler_left_button_down(), gui2::menu_button::signal_handler_left_button_down(), gui2::multiline_text::signal_handler_left_button_down(), gui2::multimenu_button::signal_handler_left_button_down(), gui2::repeating_button::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(), and gui2::slider_base::signal_handler_left_button_up().
void gui2::window::queue_rerender | ( | ) |
Definition at line 668 of file window.cpp.
References gui2::widget::get_rectangle().
Referenced by update_render_textures().
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.
region | The region to rerender in screen coordinates. |
Definition at line 673 of file window.cpp.
References awaiting_rerender_, rect::expand_to_cover(), gui2::widget::get_origin(), gui2::widget::get_rectangle(), rect::intersect(), and rect::shift().
Referenced by gui2::widget::queue_redraw().
|
private |
Schedules windows on top of us (if any) to redraw.
void gui2::window::remove_from_keyboard_chain | ( | widget * | widget | ) |
Remove the widget from the keyboard chain.
widget | The widget to be removed from the chain. |
Definition at line 1205 of file window.cpp.
References event_distributor_.
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.
id | The id of the group. |
widget | The widget to remove from the group. |
Definition at line 806 of file window.cpp.
References utils::find(), has_linked_size_group(), gui2::widget::id(), and linked_size_.
Referenced by gui2::widget::~widget().
|
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 688 of file window.cpp.
References awaiting_rerender_, DBG_DP, deferred_regions_, draw(), rect::empty(), sdl::empty_rect, draw::override_clip(), gui2::widget::queue_redraw(), render_buffer_, draw::set_render_target(), and update_render_textures().
Referenced by update_render_textures().
|
overridevirtual |
The current draw location of the window, on the screen.
Implements gui2::top_level_drawable.
Definition at line 731 of file window.cpp.
References gui2::widget::get_rectangle(), and hidden_.
|
inline |
Definition at line 412 of file window.hpp.
References click_dismiss(), and click_dismiss_.
Referenced by gui2::dialogs::lua_interpreter::controller::bind(), gui2::dialogs::title_screen::init_callbacks(), gui2::dialogs::message::pre_show(), and gui2::dialogs::wml_message_base::pre_show().
|
inline |
Disable the enter key.
This is added to block dialogs from being closed automatically.
Definition at line 321 of file window.hpp.
References enter_disabled_.
Referenced by gui2::dialogs::lua_interpreter::controller::bind(), gui2::dialogs::game_load::display_savegame(), gui2::dialogs::title_screen::init_callbacks(), gui2::dialogs::addon_manager::pre_show(), gui2::dialogs::loading_screen::pre_show(), gui2::dialogs::mp_lobby::pre_show(), gui2::dialogs::mp_join_game::pre_show(), gui2::dialogs::mp_staging::pre_show(), gui2::dialogs::screenshot_notification::pre_show(), and gui2::dialogs::story_viewer::pre_show().
|
inline |
Disable the escape key.
This is added to block dialogs from being closed automatically.
Definition at line 334 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().
|
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 448 of file window.hpp.
References always, exit_hook_, get_retval(), mode(), gui2::OK, and ok_only.
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().
|
inline |
Definition at line 407 of file window.hpp.
References owner_.
|
inline |
Sets there return value of the window.
retval | The return value for the window. |
close_window | Close 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::mp_join_game::close_faction_select_dialog_if_open(), gui2::dialogs::units_dialog::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::preferences_dialog::post_show(), gui2::dialogs::campaign_selection::pre_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::sp_options_configure::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::modal_dialog::show(), 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().
|
inline |
Definition at line 422 of file window.hpp.
References wfl::map_formula_callable::add(), gui2::widget::queue_redraw(), and variables_.
Referenced by gui2::dialogs::drop_down_menu::pre_show().
int gui2::window::show | ( | unsigned | auto_close_timeout = 0 | ) |
Shows the window, running an event loop until it should close.
auto_close_timeout | The time in ms after which the window will automatically close, if 0 it doesn't close. |
Definition at line 489 of file window.cpp.
References CLOSE_WINDOW_EVENT, CLOSED, gui2::event::dispatcher::connect(), data, DBG_DP, events::draw(), event_distributor_, exit_hook_, generate_dot_file(), sdl::get_mouse_button_mask(), utils::get_unknown_exception_type(), hidden_, hide(), gui2::widget::id(), invalidate_layout(), gui2::event::dispatcher::is_connected(), LOG_DP, gui2::log_gui_draw, log_scope2, LOG_SCOPE_HEADER, modal, mouse_button_state_, events::pump(), gui2::widget::queue_redraw(), gui2::dialogs::tip::remove(), REQUEST_CLOSE, retval_, show_mode_, SHOWING, and status_.
Referenced by gui2::dialogs::modal_dialog::show().
void gui2::window::show_non_modal | ( | ) |
Shows the window non modal.
A tooltip can be interacted with unlike the tooltip.
auto_close_timeout
.auto_close_timeout
The time in ms after which the window will automatically close, if 0 it doesn't close.
Definition at line 455 of file window.cpp.
References gui2::event::dispatcher::connect(), DBG_DP, generate_dot_file(), gui2::widget::get_rectangle(), hidden_, gui2::event::dispatcher::hit, gui2::widget::id(), invalidate_layout(), gui2::event::dispatcher::is_connected(), LOG_DP, gui2::log_gui_draw, log_scope2, modeless, NEW, events::pump_and_draw(), gui2::widget::queue_redraw(), gui2::event::dispatcher::set_mouse_behavior(), show_mode_, and status_.
Referenced by gui2::dialogs::modeless_dialog::show().
void gui2::window::show_tooltip | ( | ) |
Shows the window as a tooltip.
A tooltip can't be interacted with and is just shown.
auto_close_timeout
.auto_close_timeout
The time in ms after which the window will automatically close, if 0 it doesn't close.
Definition at line 423 of file window.cpp.
References gui2::event::dispatcher::connect(), DBG_DP, generate_dot_file(), gui2::widget::get_rectangle(), hidden_, gui2::widget::id(), invalidate_layout(), gui2::event::dispatcher::is_connected(), LOG_DP, gui2::log_gui_draw, log_scope2, NEW, gui2::event::dispatcher::none, gui2::widget::queue_redraw(), gui2::event::dispatcher::set_mouse_behavior(), gui2::event::dispatcher::set_want_keyboard_input(), show_mode_, status_, and tooltip.
Referenced by gui2::dialogs::modeless_dialog::show().
|
private |
The handler for the click dismiss mouse 'event'.
event | See event::dispatcher::fire. |
handled | See event::dispatcher::fire. |
halt | See event::dispatcher::fire. |
mouse_button_mask | Forwared to click_dismiss. |
Definition at line 1242 of file window.cpp.
References click_dismiss(), DBG_GUI_E, and LOG_HEADER.
|
private |
Definition at line 1365 of file window.cpp.
References gui2::AUTO_CLOSE, and set_retval().
|
private |
Definition at line 1341 of file window.cpp.
References DBG_GUI_E, helptip_, gui2::builder_window::window_resolution::tooltip_info::id, gui2::event::message_show_helptip::location, LOG_HEADER, gui2::event::message_show_helptip::message, gui2::dialogs::tip::show(), and gui2::event::message_show_helptip::source_rect.
|
private |
Definition at line 1327 of file window.cpp.
References DBG_GUI_E, gui2::builder_window::window_resolution::tooltip_info::id, gui2::event::message_show_tooltip::location, LOG_HEADER, gui2::event::message_show_tooltip::message, gui2::dialogs::tip::show(), gui2::event::message_show_tooltip::source_rect, and tooltip_.
|
private |
Definition at line 1355 of file window.cpp.
References DBG_GUI_E, invalidate_layout(), and LOG_HEADER.
|
private |
Definition at line 1261 of file window.cpp.
References gui2::CANCEL, click_dismiss(), DBG_GUI_E, enter_disabled_, escape_disabled_, event_distributor_, utils::find(), gui2::is_active(), keyboard_capture(), LOG_HEADER, gui2::OK, set_retval(), and tab_order.
|
private |
Definition at line 1227 of file window.cpp.
References DBG_GUI_E, gui2::settings::gamemap_height, gui2::settings::gamemap_width, invalidate_layout(), LOG_HEADER, gui2::settings::screen_height, and gui2::settings::screen_width.
|
static |
Static type getter that does not rely on the widget being constructed.
Referenced by gui2::dialogs::statistics_dialog::add_damage_row(), gui2::dialogs::statistics_dialog::add_hits_row(), gui2::dialogs::statistics_dialog::add_stat_row(), gui2::dialogs::units_dialog::build_create_dialog(), gui2::dialogs::custom_tod::color_slider_callback(), gui2::dialogs::custom_tod::copy_to_clipboard_callback(), gui2::dialogs::mp_create_game::display_games_of_type(), gui2::dialogs::mp_join_game::generate_side_list(), gui2::dialogs::editor_edit_unit::load_unit_type(), gui2::dialogs::statistics_dialog::on_primary_list_select(), gui2::dialogs::mp_create_game::post_show(), and gui2::dialogs::mp_staging::update_leader_display().
|
private |
Ensure render textures are valid and correct.
Definition at line 634 of file window.cpp.
References draw::clear(), draw(), texture::draw_size(), video::get_pixel_scale(), texture::get_raw_size(), gui2::widget::get_size(), LOG_DP, queue_rerender(), render(), render_buffer_, texture::set_draw_size(), draw::set_render_target(), and setter.
Referenced by render().
|
static |
Returns the instance of a window.
handle | The instance id of the window. |
Definition at line 405 of file window.cpp.
References gui2::widget::get_window().
Referenced by gui2::event::sdl_event_handler::close_window().
|
friend |
Definition at line 62 of file window.hpp.
|
friend |
Definition at line 64 of file window.hpp.
|
friend |
Definition at line 65 of file window.hpp.
|
friend |
Definition at line 63 of file window.hpp.
|
private |
Do we wish to place the widget automatically?
Definition at line 506 of file window.hpp.
Referenced by layout().
|
private |
The part of the window (if any) currently marked for rerender.
Definition at line 165 of file window.hpp.
Referenced by queue_rerender(), and render().
|
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.
Definition at line 571 of file window.hpp.
Referenced by does_click_dismiss(), layout(), and set_click_dismiss().
|
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 659 of file window.hpp.
|
private |
Parts of the window (if any) with rendering deferred to next frame.
Definition at line 168 of file window.hpp.
Referenced by defer_region(), and render().
|
private |
Disable the enter key see our setter for more info.
Definition at line 574 of file window.hpp.
Referenced by set_enter_disabled(), and signal_handler_sdl_key_down().
|
private |
Disable the escape key see our setter for more info.
Definition at line 577 of file window.hpp.
Referenced by set_escape_disabled(), and signal_handler_sdl_key_down().
|
private |
Definition at line 685 of file window.hpp.
Referenced by add_to_keyboard_chain(), add_to_tab_order(), get_distributor(), keyboard_capture(), mouse_capture(), remove_from_keyboard_chain(), show(), and signal_handler_sdl_key_down().
|
private |
Definition at line 770 of file window.hpp.
Referenced by set_exit_hook(), and show().
|
private |
The formula definitions available for the calculation formulas.
Definition at line 546 of file window.hpp.
Referenced by layout().
|
private |
The formula to calculate the height of the dialog.
Definition at line 540 of file window.hpp.
Referenced by layout().
|
private |
The settings for the helptip.
Definition at line 552 of file window.hpp.
Referenced by signal_handler_message_show_helptip().
|
private |
Avoid drawing the window.
Definition at line 503 of file window.hpp.
Referenced by draw(), hide(), screen_location(), show(), show_non_modal(), show_tooltip(), and ~window().
|
private |
Sets the horizontal placement.
Only used if automatic_placement_ is true. The value should be a grid placement flag.
Definition at line 514 of file window.hpp.
Referenced by layout().
|
private |
Is invalidate_layout blocked, see invalidate_layout_blocker.
Definition at line 500 of file window.hpp.
Referenced by invalidate_layout(), invalidate_layout_blocked(), and gui2::window::invalidate_layout_blocker::invalidate_layout_blocker().
|
private |
List of the widgets, whose size are linked together.
Definition at line 604 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().
|
private |
The maximum height if automatic_placement_ is true.
Definition at line 528 of file window.hpp.
Referenced by layout().
|
private |
The maximum width if automatic_placement_ is true.
Definition at line 525 of file window.hpp.
Referenced by layout().
|
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 644 of file window.hpp.
Referenced by click_dismiss(), and show().
|
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 494 of file window.hpp.
Referenced by get_need_layout(), invalidate_layout(), and layout().
|
private |
The dialog that owns the window.
Definition at line 486 of file window.hpp.
Referenced by dialog(), gui2::dialogs::mp_connect::selection::parent_list(), gui2::dialogs::mp_connect::selection::relative_index(), set_owner(), and gui2::dialogs::mp_connect::selection::user_defined().
|
private |
The formula to determine whether the size is good.
Definition at line 543 of file window.hpp.
Referenced by layout().
|
private |
The internal render buffer used by render() and expose().
Definition at line 162 of file window.hpp.
Referenced by expose(), render(), and update_render_textures().
|
private |
Definition at line 483 of file window.hpp.
Referenced by get_retval(), set_retval(), and show().
|
private |
The mode in which the window is shown.
This is used to determine whether or not to remove the tip.
Definition at line 480 of file window.hpp.
Referenced by mode(), show(), show_non_modal(), show_tooltip(), and ~window().
|
private |
The status of the window.
Definition at line 473 of file window.hpp.
Referenced by close(), show(), show_non_modal(), and show_tooltip().
|
private |
List of widgets in the tabbing order.
Definition at line 607 of file window.hpp.
Referenced by add_to_tab_order(), and signal_handler_sdl_key_down().
|
private |
The settings for the tooltip.
Definition at line 549 of file window.hpp.
Referenced by signal_handler_message_show_tooltip().
|
private |
The variables of the canvas.
Definition at line 497 of file window.hpp.
Referenced by layout(), and set_variable().
|
private |
Sets the vertical placement.
Only used if automatic_placement_ is true. The value should be a grid placement flag.
Definition at line 522 of file window.hpp.
Referenced by layout().
|
private |
The formula to calculate the width of the dialog.
Definition at line 537 of file window.hpp.
Referenced by layout().
|
private |
The formula to calculate the x value of the dialog.
Definition at line 531 of file window.hpp.
Referenced by layout().
|
private |
The formula to calculate the y value of the dialog.
Definition at line 534 of file window.hpp.
Referenced by layout().