21 #ifndef GUI_WIDGETS_WINDOW_HPP_INCLUDED
22 #define GUI_WIDGETS_WINDOW_HPP_INCLUDED
40 namespace gui2 {
class twidget; }
41 namespace gui2 {
namespace event {
struct tmessage; } }
42 namespace gui2 {
struct tpoint; }
50 class tdebug_layout_graph;
78 const bool automatic_placement,
79 const unsigned horizontal_placement,
80 const unsigned vertical_placement,
81 const unsigned maximum_width,
82 const unsigned maximum_height,
160 int show(
const bool restore =
true,
const unsigned auto_close_timeout = 0);
283 const bool must_be_active)
override;
287 const bool must_be_active)
const override;
300 const bool must_be_active)
const override;
311 void add_click_dismiss_blocker(
const std::string&
id);
321 void remove_click_dismiss_blocker(
const std::string&
id);
373 const bool fixed_width,
374 const bool fixed_height);
422 void set_retval(
const int retval,
const bool close_window =
true)
441 sunset_ = interval ? interval : 5;
456 std::map<std::string, tlinked_size>::const_iterator it =
linked_size_.find(linked_group_id);
458 return tpoint(it->second.width, it->second.height);
688 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
747 const Uint8 mouse_button_mask);
bool escape_disabled_
Disable the escape key see our setter for more info.
~tinvalidate_layout_blocker()
tdialog * owner_
The dialog that owns the window.
unsigned maximum_height_
The maximum height if automatic_placement_ is true.
twidget * find(const std::string &id, const bool must_be_active) override
See twidget::find.
tformula< unsigned > x_
The formula to calulate the x value of the dialog.
bool enter_disabled_
Disable the enter key see our setter for more info.
bool does_click_dismiss() const
Does the window close easily?
void remove_from_keyboard_chain(twidget *widget)
Remove the widget from the keyboard chain.
The dialog is closed automatically since it's timeout has been triggered.
rng * generator
This generator is automatically synced during synced context.
tretval
Default return values.
tstatus
The status of the window.
friend class tdebug_layout_graph
game_logic::function_symbol_table functions_
The formula definitions available for the calulation formulas.
std::vector< twidget * > widgets
The widgets linked.
twindow_builder::tresolution::ttip tooltip_
The settings for the tooltip.
void signal_handler_message_show_helptip(const event::tevent event, bool &handled, event::tmessage &message)
std::vector< std::vector< twidget * > > dirty_list_
The list with dirty items in the window.
void signal_handler_sdl_key_down(const event::tevent event, bool &handled, const SDLKey key)
const unsigned horizontal_placement_
Sets the horizontal placement.
static void set_sunset(const unsigned interval)
void add_to_keyboard_chain(twidget *widget)
Adds the widget to the keyboard chain.
static void update_screen_size()
Update the size of the screen variables in settings.
The window has been requested to be closed but still needs to evaluate the request.
surface restorer_
When the window closes this surface is used to undraw the window.
void set_escape_disabled(const bool escape_disabled)
Disable the escape key.
static tretval get_retval_by_id(const std::string &id)
Gets the retval for the default buttons.
GLint GLint GLint GLint GLint GLint y
void undraw()
Undraws the window.
virtual const std::string & get_control_type() const override
See tcontrol::get_control_type.
std::map< std::string, tlinked_size > linked_size_
List of the widgets, whose size are linked together.
static twindow * window_instance(const unsigned handle)
Returns the instance of a window.
The window is new and not yet shown.
The window is being shown.
bool suspend_drawing_
Avoid drawing the window.
base class of top level items, the only item which needs to store the final canvases to draw on ...
A class inherited from ttext_box that displays its input as stars.
void set_enter_disabled(const bool enter_disabled)
Disable the enter key.
void signal_handler_sdl_video_resize(const event::tevent event, bool &handled, const tpoint &new_size)
void finalize(const boost::intrusive_ptr< tbuilder_grid > &content_grid)
Finishes the initialization of the grid.
tdialog * dialog()
Inherited from twidget.
bool disable_click_dismiss() const override
See twidget::disable_click_dismiss.
Dialog is closed with ok button.
void signal_handler_click_dismiss(const event::tevent event, bool &handled, bool &halt, const Uint8 mouse_button_mask)
The handler for the click dismiss mouse 'event'.
Dialog is closed with no return value, should be rare but eg a message popup can do it...
void draw()
Draws the window.
Abstract base class for all dialogs.
void show_tooltip()
Shows the window as a tooltip.
int show(const bool restore=true, const unsigned auto_close_timeout=0)
Shows the window.
Dialog is closed with the cancel button.
GLubyte GLubyte GLubyte GLubyte w
Uint8 mouse_button_state_
The state of the mouse button.
GLsizei const GLfloat * value
const t_string & tooltip() const
void set_owner(tdialog *owner)
void set_variable(const std::string &key, const variant &value)
twindow_builder::tresolution::ttip helptip_
The settings for the helptip.
void set_retval(const int retval, const bool close_window=true)
Sets there return value of the window.
void generate_dot_file(const std::string &, const unsigned)
tinvalidate_layout_blocker(twindow &window)
void init_linked_size_group(const std::string &id, const bool fixed_width, const bool fixed_height)
Initializes a linked size group.
tformula< unsigned > h_
The formula to calulate the height of the dialog.
tevent
The event send to the dispatcher.
void close()
Requests to close the window.
void signal_handler_request_placement(const event::tevent event, bool &handled)
Visible container to hold multiple widgets.
tformula< bool > reevaluate_best_size_
The formula to determine whether the size is good.
void layout()
Layouts the window.
bool invalidate_layout_blocked_
Is invalidate layout blocked see tinvalidate_layout_blocker.
const twindow & get_window() const
Inherited from tevent_handler.
The window has been closed.
bool restore_
Whether the window should undraw the window using restorer_.
virtual twidget * find_at(const tpoint &coordinate, const bool must_be_active) override
See twidget::find_at.
bool get_need_layout() const
GLfloat GLfloat GLfloat GLfloat h
GLint GLint GLint GLint GLint x
Helper struct to store information about the tips.
tshow_mode show_mode_
The mode in which the window is shown.
void set_click_dismiss(const bool click_dismiss)
void show_non_modal()
Shows the window non modal.
GLint GLint GLint GLint GLint GLint GLsizei GLsizei height
tformula< unsigned > y_
The formula to calulate the y value of the dialog.
Helper class to block invalidate_layout.
void add_to_dirty_list(const std::vector< twidget * > &call_stack)
Adds an item to the dirty_list_.
bool has_linked_size_group(const std::string &id)
Is the linked size group defined for this window?
void add_linked_widget(const std::string &id, twidget *widget)
Adds a widget to a linked size group.
twindow_definition(const config &cfg)
tstatus status_
The status of the window.
Helper to implement private functions without modifying the header.
tresolution(const config &cfg)
const unsigned vertical_placement_
Sets the vertical placement.
Helper struct to force widgets the have the same size.
void mouse_capture(const bool capture=true)
GLsizei GLenum GLuint GLuint GLsizei char * message
twindow & get_window()
Inherited from tevent_handler.
unsigned maximum_width_
The maximum width if automatic_placement_ is true.
GLint GLint GLint GLint GLint GLint GLsizei width
int height
the current height of all widgets in the intis group, -1 if the height is not linked ...
void layout_linked_widgets()
Layouts the linked widgets.
const bool automatic_placement_
Do we wish to place the widget automatically?
int width
the current width of all widgets in the intis group, -1 if the width is not linked ...
void keyboard_capture(twidget *widget)
twindow(CVideo &video, tformula< unsigned > x, tformula< unsigned > y, tformula< unsigned > w, tformula< unsigned > h, tformula< bool > reevaluate_best_size, const game_logic::function_symbol_table &functions, const bool automatic_placement, const unsigned horizontal_placement, const unsigned vertical_placement, const unsigned maximum_width, const unsigned maximum_height, const std::string &definition, const twindow_builder::tresolution::ttip &tooltip, const twindow_builder::tresolution::ttip &helptip)
< Needs to be initialised in show.
tformula< unsigned > w_
The formula to calulate the width of the dialog.
friend twindow * build(CVideo &, const twindow_builder::tresolution *)
Builds a window.
A config object defines a single node in a WML file, with access to child nodes.
void remove_linked_widget(const std::string &id, const twidget *widget)
Removes a widget from a linked size group.
CVideo & video_
Needed so we can change what's drawn on the screen.
tpoint get_linked_size(const std::string &linked_group_id) const
game_logic::map_formula_callable variables_
The variables of the canvas.
tlinked_size(const bool width=false, const bool height=false)
bool click_dismiss_
Do we want to have easy close behavior?
GLsizei const GLcharARB ** string
bool click_dismiss(const Uint8 mouse_button_mask)
Handles a mouse click event for dismissing the dialogue.
void signal_handler_message_show_tooltip(const event::tevent event, bool &handled, event::tmessage &message)
event::tdistributor * event_distributor_
void invalidate_layout()
Updates the size of the window.
static unsigned sunset_
Controls the sunset feature.
boost::shared_ptr< halo_record > handle
bool need_layout_
When set the form needs a full layout redraw cycle.