15 #ifndef GUI_WIDGETS_CONTROL_HPP_INCLUDED
16 #define GUI_WIDGETS_CONTROL_HPP_INCLUDED
21 #include "../../text.hpp"
30 struct tbuilder_control;
40 explicit tcontrol(
const unsigned canvas_count);
51 const unsigned canvas_count,
79 virtual void set_active(
const bool active) = 0;
214 const bool must_be_active)
override;
218 const bool must_be_active)
const override;
225 const bool must_be_active)
const override;
288 assert(index <
canvas_.size());
435 int y_offset)
override;
440 int y_offset)
override;
448 #ifdef GUI2_EXPERIMENTAL_LISTBOX
472 const tpoint& maximum_size = tpoint(0, 0))
const;
tpoint get_config_default_size() const
Gets the default size as defined in the config.
virtual void impl_draw_background(surface &frame_buffer, int x_offset, int y_offset) override
See twidget::impl_draw_background.
virtual void impl_draw_foreground(surface &frame_buffer, int x_offset, int y_offset) override
See twidget::impl_draw_foreground.
void signal_handler_show_tooltip(const event::tevent event, bool &handled, const tpoint &location)
void set_config(tresolution_definition_ptr config)
virtual unsigned get_characters_per_line() const
Returns the number of characters per line.
twidget * find(const std::string &id, const bool must_be_active) override
See twidget::find.
virtual void load_config_extra()
Load class dependent config settings.
virtual const std::string & get_control_type() const =0
Returns the control_type of the control.
tresolution_definition_ptr config()
virtual void request_reduce_width(const unsigned maximum_width) override
See twidget::request_reduce_width.
virtual void set_label(const t_string &label)
int text_maximum_width_
The maximum width for the text in a control.
void set_help_message(const t_string &help_message)
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
tresolution_definition_const_ptr config() const
virtual unsigned get_state() const =0
Returns the id of the state.
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.
virtual void set_use_markup(bool use_markup)
virtual void set_active(const bool active)=0
Sets the control's state.
tpoint get_config_maximum_size() const
Gets the best size as defined in the config.
tpoint get_best_text_size(const tpoint &minimum_size, const tpoint &maximum_size=tpoint(0, 0)) const
Gets the best size for a text.
t_string tooltip_
Tooltip text.
std::string get_label_token(const gui2::tpoint &position, const char *delimiters=" \n\r\t") const
Exposes font::ttext::get_token, for the text label of this control.
bool get_use_tooltip_on_label_overflow() const
int get_text_maximum_width() const
Returns the maximum width available for the text.
const t_string & tooltip() const
virtual void place(const tpoint &origin, const tpoint &size) override
See twidget::place.
PangoAlignment get_text_alignment() const
void load_config()
Loads the configuration of the widget.
const t_string & label() const
tevent
The event send to the dispatcher.
A simple canvas which can be drawn upon.
void set_use_tooltip_on_label_overflow(const bool use_tooltip=true)
bool shrunken_
Is the widget smaller as it's best size?
void set_tooltip(const t_string &tooltip)
bool init()
Initializes the gui subsystems.
bool get_use_markup() const
tresolution_definition_ptr config_
Contains the pointer to the configuration.
font::ttext renderer_
Contains a helper cache for the rendering.
std::map< std::string, t_string > string_map
PangoAlignment text_alignment_
The alignment of the text in a control.
Encapsulates the map of the game.
std::string definition_
The definition is the id of that widget class.
void set_wants_mouse_hover(const bool hover=true)
virtual void update_canvas()
Updates the canvas(ses).
tpoint get_config_minimum_size() const
Gets the minimum size as defined in the config.
std::vector< tcanvas > canvas_
Holds all canvas objects for a control.
virtual iterator::twalker_ * create_walker() override
See twidget::create_walker.
bool use_markup_
Use markup for the label?
void signal_handler_show_helptip(const event::tevent event, bool &handled, const tpoint &location)
void definition_load_configuration(const std::string &control_type)
Loads the configuration of the widget.
std::vector< tcanvas > & canvas()
void signal_handler_notify_remove_tooltip(const event::tevent event, bool &handled)
const t_string & help_message() const
friend class tdebug_layout_graph
virtual bool get_link_aware() const
Returns whether the label should be link_aware, in in rendering and in searching for links with get_l...
tcanvas & canvas(const unsigned index)
Base class for all visible items.
bool disable_click_dismiss() const override
See twidget::disable_click_dismiss.
bool use_tooltip_on_label_overflow_
If the text doesn't fit on the label should the text be used as tooltip?
t_string label_
Contain the non-editable text associated with control.
void set_text_alignment(const PangoAlignment text_alignment)
int get_text_maximum_height() const
Returns the maximum height available for the text.
virtual void set_members(const string_map &data)
Sets the members of the control.
virtual twidget * find_at(const tpoint &coordinate, const bool must_be_active) override
See twidget::find_at.
std::string get_label_link(const gui2::tpoint &position) const
tcontrol(const unsigned canvas_count)
virtual std::string get_link_color() const
Returns the color string to be used with links.
void set_definition(const std::string &definition)
Sets the definition.
The walker abstract base class.
tbuilder_control(const config &cfg)
A config object defines a single node in a WML file, with access to child nodes.
virtual bool get_active() const =0
Gets the active state of the control.
virtual void layout_initialise(const bool full_initialisation) override
See twidget::layout_initialise.
GLsizei const GLcharARB ** string
t_string help_message_
Tooltip text.
Contains the implementation details for lexical_cast and shouldn't be used directly.
virtual tpoint calculate_best_size() const override
See twidget::calculate_best_size.
bool use_tooltip_on_label_overflow