15 #define GETTEXT_DOMAIN "wesnoth-lib"
30 #define LOG_SCOPE_HEADER get_control_type() + " [" + id() + "] " + __func__
31 #define LOG_HEADER LOG_SCOPE_HEADER + ':'
45 , callback_state_change_(
nullptr)
46 , callback_mouse_left_double_click_()
48 set_wants_mouse_left_double_click();
50 connect_signal<event::MOUSE_ENTER>(std::bind(
52 connect_signal<event::MOUSE_LEAVE>(std::bind(
55 connect_signal<event::LEFT_BUTTON_CLICK>(
61 connect_signal<event::LEFT_BUTTON_CLICK>(std::bind(
63 connect_signal<event::LEFT_BUTTON_CLICK>(
69 connect_signal<event::LEFT_BUTTON_DOUBLE_CLICK>(
74 connect_signal<event::LEFT_BUTTON_DOUBLE_CLICK>(
91 const std::map<std::string /* widget id */, string_map>&
data)
93 for(
const auto & item : data)
102 const bool must_be_active)
117 const bool must_be_active)
const
150 result.x += conf->left_border;
151 result.y += conf->top_border;
152 result.w -= conf->left_border + conf->right_border;
153 result.h -= conf->top_border + conf->bottom_border;
165 return tpoint(conf->left_border + conf->right_border,
166 conf->top_border + conf->bottom_border);
306 DBG_GUI_P <<
"Parsing toggle panel " <<
id <<
'\n';
308 load_resolutions<tresolution>(cfg);
362 , top_border(cfg[
"top_border"])
363 , bottom_border(cfg[
"bottom_border"])
364 , left_border(cfg[
"left_border"])
365 , right_border(cfg[
"right_border"])
409 tbuilder_toggle_panel::tbuilder_toggle_panel(
const config& cfg)
412 , retval_id_(cfg[
"return_value_id"])
413 , retval_(cfg[
"return_value"])
430 DBG_GUI_G <<
"Window builder: placed toggle panel '" <<
id
431 <<
"' with definition '" <<
definition <<
"'.\n";
Define the common log macros for the gui toolkit.
void signal_handler_mouse_enter(const event::tevent event, bool &handled)
virtual void impl_draw_background(surface &frame_buffer, int x_offset, int y_offset) override
See twidget::impl_draw_background.
child_itors child_range(const std::string &key)
virtual void impl_draw_foreground(surface &frame_buffer, int x_offset, int y_offset) override
See twidget::impl_draw_foreground.
void signal_handler_left_button_click(const event::tevent event, bool &handled)
void signal_handler_pre_left_button_click(const event::tevent event)
virtual unsigned get_state() const override
See tcontrol::get_state.
Add a special kind of assert to validate whether the input from WML doesn't contain any problems that...
tstate state_
Current state of the widget.
GLuint GLuint GLsizei GLenum type
tresolution_definition_ptr config()
twidget * find(const std::string &id, const bool must_be_active) override
See twidget::find.
int get_retval(const std::string &retval_id, const int retval, const std::string &id)
Returns the return value for a widget.
void set_state(const tstate state)
virtual void impl_draw_foreground(surface &frame_buffer, int x_offset, int y_offset) override
See twidget::impl_draw_foreground.
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
Base class of a resolution, contains the common keys for a resolution.
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 init_control(tcontrol *control) const
std::string definition
Parameters for the control.
static UNUSEDNOWARN std::string _(const char *str)
tstate
Possible states of the widget.
#define VALIDATE(cond, message)
The macro to use for the validation of WML.
void signal_handler_mouse_leave(const event::tevent event, bool &handled)
void set_retval(const int retval, const bool close_window=true)
Sets there return value of the window.
void init_grid(const boost::intrusive_ptr< tbuilder_grid > &grid_builder)
Initializes and builds the grid.
tevent
The event send to the dispatcher.
void set_retval(const int retval)
Visible container to hold multiple widgets.
Contains the state info for a resolution.
int retval_
The return value of the button.
virtual tpoint border_space() const override
See tcontainer_::border_space.
unsigned state_num_
Usually 1 for selected and 0 for not selected, can also have higher values in tristate buttons...
void set_value(const unsigned selected)
Inherited from tselectable_.
virtual twidget * find_at(const tpoint &coordinate, const bool must_be_active) override
See twidget::find_at.
virtual void impl_draw_background(surface &frame_buffer, int x_offset, int y_offset) override
See twidget::impl_draw_background.
std::string sound_toggle_panel_click
unsigned get_value() const override
Inherited from tselectable_.
Base class for all visible items.
void set_child_members(const std::map< std::string, string_map > &data)
Sets the members of the child controls.
unsigned num_states() const override
Inherited from tselectable_.
std::vector< tstate_definition > state
virtual void set_members(const string_map &data)
Sets the members of the control.
config & child(const std::string &key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
virtual twidget * find_at(const tpoint &coordinate, const bool must_be_active) override
See twidget::find_at.
void play_UI_sound(const std::string &files)
virtual twidget * find_at(const tpoint &coordinate, const bool must_be_active) override
See twidget::find_at.
Class for a toggle button.
A config object defines a single node in a WML file, with access to child nodes.
virtual void set_active(const bool active) override
See tcontrol::set_active.
virtual bool get_active() const override
See tcontrol::get_active.
virtual SDL_Rect get_client_rect() const override
See tcontainer_::get_client_rect.
void signal_handler_left_button_double_click(const event::tevent event, bool &handled)
GLsizei const GLcharARB ** string
ttoggle_panel_definition(const config &cfg)
Contains the implementation details for lexical_cast and shouldn't be used directly.
virtual const std::string & get_control_type() const override
See tcontrol::get_control_type.
tresolution(const config &cfg)
std::function< void(twidget &)> callback_mouse_left_double_click_
Mouse left double click callback.
std::function< void(twidget &)> callback_state_change_
See tselectable_::set_callback_state_change.