Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends

gui2::tcontrol Class Reference

Base class for all visible items. More...

#include <control.hpp>

Inheritance diagram for gui2::tcontrol:
Inheritance graph
[legend]
Collaboration diagram for gui2::tcontrol:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 tcontrol (const unsigned canvas_count)
 tcontrol (const implementation::tbuilder_control &builder, const unsigned canvas_count, const std::string &control_type)
 Constructor.
virtual void set_members (const string_map &data)
 Sets the members of the control.
virtual void set_active (const bool active)=0
 Sets the control's state.
virtual bool get_active () const =0
 Gets the active state of the control.
bool disable_click_dismiss () const
 Inherited from twidget.
virtual iterator::twalker_create_walker ()
 Inherited from twidget.
tpoint get_config_minimum_size () const
 Gets the minimum size as defined in the config.
tpoint get_config_default_size () const
 Gets the default size as defined in the config.
tpoint get_config_maximum_size () const
 Gets the best size as defined in the config.
virtual unsigned get_characters_per_line () const
 Returns the number of characters per line.
void layout_init (const bool full_initialization)
 Inherited from twidget.
void request_reduce_width (const unsigned maximum_width)
 Inherited from twidget.
void place (const tpoint &origin, const tpoint &size)
 Inherited from twidget.
twidgetfind_at (const tpoint &coordinate, const bool must_be_active)
 Inherited from twidget.
const twidgetfind_at (const tpoint &coordinate, const bool must_be_active) const
 Inherited from twidget.
twidgetfind (const std::string &id, const bool must_be_active)
 Inherited from twidget.
const twidgetfind (const std::string &id, const bool must_be_active) const
 Inherited from twidget.
void set_definition (const std::string &definition)
 Sets the definition.
bool get_use_tooltip_on_label_overflow () const
void set_use_tooltip_on_label_overflow (const bool use_tooltip=true)
const t_stringlabel () const
virtual void set_label (const t_string &label)
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< tcanvas > & canvas ()
tcanvascanvas (const unsigned index)
void set_text_alignment (const PangoAlignment text_alignment)
PangoAlignment get_text_alignment () const
virtual const std::string & get_control_type () const =0
 Returns the control_type of the control.

Protected Member Functions

virtual unsigned get_state () const =0
 Returns the id of the state.
tpoint calculate_best_size () const
 Inherited from twidget.
tresolution_definition_ptr config ()
tresolution_definition_const_ptr config () const
void set_config (tresolution_definition_ptr config)
virtual void update_canvas ()
 Updates the canvas(ses).
int get_text_maximum_width () const
 Returns the maximum width available for the text.
int get_text_maximum_height () const
 Returns the maximum height available for the text.
void impl_draw_background (surface &frame_buffer)
 Inherited from twidget.
void impl_draw_background (surface &frame_buffer, int x_offset, int y_offset)
void impl_draw_foreground (surface &)
 Inherited from twidget.
void impl_draw_foreground (surface &, int, int)

Private Member Functions

void load_config ()
 Loads the configuration of the widget.
virtual void load_config_extra ()
 Load class dependant config settings.
void definition_load_configuration (const std::string &control_type)
 Loads the configuration of the widget.
tpoint get_best_text_size (const tpoint &minimum_size, const tpoint &maximum_size=tpoint(0, 0)) const
 Gets the best size for a text.
void signal_handler_show_tooltip (const event::tevent event, bool &handled, const tpoint &location)
void signal_handler_show_helptip (const event::tevent event, bool &handled, const tpoint &location)
void signal_handler_notify_remove_tooltip (const event::tevent event, bool &handled)

Private Attributes

std::string definition_
 The definition is the id of that widget class.
t_string label_
 Contain the non-editable text associated with control.
bool use_markup_
 Use markup for the label?
bool use_tooltip_on_label_overflow_
 If the text doesn't fit on the label should the text be used as tooltip?
t_string tooltip_
 Tooltip text.
t_string help_message_
 Tooltip text.
std::vector< tcanvascanvas_
 Holds all canvas objects for a control.
tresolution_definition_ptr config_
 Contains the pointer to the configuration.
font::ttext renderer_
 Contains a helper cache for the rendering.
int text_maximum_width_
 The maximum width for the text in a control.
PangoAlignment text_alignment_
 The alignment of the text in a control.
bool shrunken_
 Is the widget smaller as it's best size?

Friends

class tdebug_layout_graph
class twindow
 Uses the load function.

Detailed Description

Base class for all visible items.

Definition at line 30 of file control.hpp.


Constructor & Destructor Documentation

gui2::tcontrol::tcontrol ( const unsigned  canvas_count  )  [explicit]
Deprecated:
Used the second overload.

Definition at line 42 of file control.cpp.

References signal_handler_notify_remove_tooltip(), signal_handler_show_helptip(), and signal_handler_show_tooltip().

Here is the call graph for this function:

gui2::tcontrol::tcontrol ( const implementation::tbuilder_control builder,
const unsigned  canvas_count,
const std::string &  control_type 
)

Constructor.

Parameters:
builder The builder object with the settings for the object.
canvas_count The number of canvasses in the control.

Definition at line 77 of file control.cpp.

References definition_load_configuration(), signal_handler_notify_remove_tooltip(), signal_handler_show_helptip(), and signal_handler_show_tooltip().

Here is the call graph for this function:


Member Function Documentation

tpoint gui2::tcontrol::calculate_best_size (  )  const [protected, virtual]

Inherited from twidget.

Todo:
The value send should subtract the border size and read it after calculation to get the proper result.

Implements gui2::twidget.

Reimplemented in gui2::tcontainer_, gui2::tdrawing, gui2::tscrollbar_container, and gui2::tspacer.

Definition at line 236 of file control.cpp.

References config_, DBG_GUI_L, gui2::debug_truncate(), t_string::empty(), get_best_text_size(), get_config_default_size(), get_config_maximum_size(), label_, and LOG_HEADER.

Here is the call graph for this function:

tcanvas& gui2::tcontrol::canvas ( const unsigned  index  )  [inline]

Definition at line 247 of file control.hpp.

References canvas_.

std::vector<tcanvas>& gui2::tcontrol::canvas (  )  [inline]
tresolution_definition_ptr gui2::tcontrol::config (  )  [inline, protected]
tresolution_definition_const_ptr gui2::tcontrol::config (  )  const [inline, protected]

Definition at line 258 of file control.hpp.

References config_.

iterator::twalker_ * gui2::tcontrol::create_walker (  )  [virtual]

Inherited from twidget.

Implements gui2::twidget.

Reimplemented in gui2::tcontainer_.

Definition at line 158 of file control.cpp.

References gui2::twidget::twidget().

Here is the call graph for this function:

void gui2::tcontrol::definition_load_configuration ( const std::string &  control_type  )  [private]

Loads the configuration of the widget.

Controls have their definition stored in a definition object. In order to determine sizes and drawing the widget this definition needs to be loaded. The member definition_ contains the name of the definition and function load the proper configuration.

Definition at line 400 of file control.cpp.

References canvas(), config(), definition_, gui2::get_control(), set_config(), and update_canvas().

Referenced by load_config(), and tcontrol().

Here is the call graph for this function:

Here is the caller graph for this function:

bool gui2::tcontrol::disable_click_dismiss (  )  const [virtual]

Inherited from twidget.

The default behavious is that a widget blocks easy close, if not it hould override this function.

Implements gui2::twidget.

Reimplemented in gui2::tcontainer_, gui2::tdrawing, gui2::tlabel, gui2::tminimap, gui2::tprogress_bar, gui2::tscrollbar_container, and gui2::tspacer.

Definition at line 153 of file control.cpp.

References get_active(), gui2::twidget::get_visible(), and gui2::twidget::VISIBLE.

Here is the call graph for this function:

twidget* gui2::tcontrol::find ( const std::string &  id,
const bool  must_be_active 
) [inline, virtual]

Inherited from twidget.

Reimplemented from gui2::twidget.

Reimplemented in gui2::tcontainer_, and gui2::tscrollbar_container.

Definition at line 200 of file control.hpp.

References gui2::twidget::find(), and get_active().

Here is the call graph for this function:

const twidget* gui2::tcontrol::find ( const std::string &  id,
const bool  must_be_active 
) const [inline, virtual]

Inherited from twidget.

Reimplemented from gui2::twidget.

Reimplemented in gui2::tcontainer_, and gui2::tscrollbar_container.

Definition at line 207 of file control.hpp.

References gui2::twidget::find(), and get_active().

Here is the call graph for this function:

twidget* gui2::tcontrol::find_at ( const tpoint coordinate,
const bool  must_be_active 
) [inline, virtual]

Inherited from twidget.

Reimplemented from gui2::twidget.

Reimplemented in gui2::tcontainer_, and gui2::tscrollbar_container.

Definition at line 185 of file control.hpp.

References gui2::twidget::find_at(), and get_active().

Here is the call graph for this function:

const twidget* gui2::tcontrol::find_at ( const tpoint coordinate,
const bool  must_be_active 
) const [inline, virtual]

Inherited from twidget.

Reimplemented from gui2::twidget.

Reimplemented in gui2::tcontainer_, and gui2::tscrollbar_container.

Definition at line 192 of file control.hpp.

References gui2::twidget::find_at(), and get_active().

Here is the call graph for this function:

virtual bool gui2::tcontrol::get_active (  )  const [pure virtual]
tpoint gui2::tcontrol::get_best_text_size ( const tpoint minimum_size,
const tpoint maximum_size = tpoint(0,0) 
) const [private]

Gets the best size for a text.

Parameters:
minimum_size The minimum size of the text.
maximum_size The wanted maximum size of the text, if not possible it's ignored. A value of 0 means that it's ignored as well.
Returns:
The best size.

Definition at line 414 of file control.cpp.

References gui2::twidget::can_wrap(), config_, DBG_GUI_L, gui2::debug_truncate(), t_string::empty(), get_characters_per_line(), label_, gui2::log_gui_layout, LOG_HEADER, log_scope2, LOG_SCOPE_HEADER, renderer_, text_alignment_, text_maximum_width_, use_markup_, WRN_GUI_L, gui2::tpoint::x, and gui2::tpoint::y.

Referenced by calculate_best_size(), and request_reduce_width().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned gui2::tcontrol::get_characters_per_line (  )  const [virtual]

Returns the number of characters per line.

This value is used to call ttext::set_characters_per_line (indirectly).

Returns:
The characters per line. This implementation always returns 0.

Reimplemented in gui2::tlabel.

Definition at line 193 of file control.cpp.

Referenced by get_best_text_size(), and update_canvas().

Here is the caller graph for this function:

tpoint gui2::tcontrol::get_config_default_size (  )  const

Gets the default size as defined in the config.

Precondition:
config_ != NULL
Returns:
The size.

Definition at line 173 of file control.cpp.

References config_, DBG_GUI_L, and LOG_HEADER.

Referenced by calculate_best_size().

Here is the caller graph for this function:

tpoint gui2::tcontrol::get_config_maximum_size (  )  const

Gets the best size as defined in the config.

Precondition:
config_ != NULL
Returns:
The size.

Definition at line 183 of file control.cpp.

References config_, DBG_GUI_L, and LOG_HEADER.

Referenced by calculate_best_size(), and gui2::tgrid::tchild::place().

Here is the caller graph for this function:

tpoint gui2::tcontrol::get_config_minimum_size (  )  const

Gets the minimum size as defined in the config.

Precondition:
config_ != NULL
Returns:
The size.

Definition at line 163 of file control.cpp.

References config_, DBG_GUI_L, and LOG_HEADER.

virtual const std::string& gui2::tcontrol::get_control_type (  )  const [pure virtual]

Returns the control_type of the control.

The control_type parameter for tgui_definition::get_control() To keep the code more generic this type is required so the controls need to return the proper string here. Might be used at other parts as well the get the type of control involved.

Implemented in gui2::tdrawing, gui2::thorizontal_scrollbar, gui2::tlabel, gui2::tlistbox, gui2::tminimap, gui2::tmulti_page, gui2::tpanel, gui2::tpassword_box, gui2::tprogress_bar, gui2::tscroll_label, gui2::tscrollbar_container, gui2::tscrollbar_panel, gui2::tspacer, gui2::tstacked_widget, gui2::ttext_box, gui2::ttree_view, and gui2::tvertical_scrollbar.

Referenced by load_config().

Here is the caller graph for this function:

virtual unsigned gui2::tcontrol::get_state (  )  const [protected, pure virtual]

Returns the id of the state.

The current state is also the index canvas_.

Implemented in gui2::tdrawing, gui2::tlabel, gui2::tminimap, gui2::tmulti_page, gui2::tpanel, gui2::tprogress_bar, gui2::tscroll_label, gui2::tscrollbar_, gui2::tscrollbar_container, gui2::tscrollbar_panel, gui2::tspacer, gui2::tstacked_widget, and gui2::ttext_.

Referenced by impl_draw_background().

Here is the caller graph for this function:

PangoAlignment gui2::tcontrol::get_text_alignment (  )  const [inline]

Definition at line 251 of file control.hpp.

References text_alignment_.

int gui2::tcontrol::get_text_maximum_height (  )  const [protected]

Returns the maximum height available for the text.

This value makes sense after the widget has been given a size, since the maximum height is based on the height of the widget.

Definition at line 368 of file control.cpp.

References config_, and gui2::twidget::get_height().

Referenced by gui2::ttext_box::place(), update_canvas(), and gui2::ttext_box::update_canvas().

Here is the call graph for this function:

Here is the caller graph for this function:

int gui2::tcontrol::get_text_maximum_width (  )  const [protected]

Returns the maximum width available for the text.

This value makes sense after the widget has been given a size, since the maximum width is based on the width of the widget.

Definition at line 359 of file control.cpp.

References config_, gui2::twidget::get_width(), and text_maximum_width_.

Referenced by gui2::ttext_box::place(), update_canvas(), and gui2::ttext_box::update_canvas().

Here is the call graph for this function:

Here is the caller graph for this function:

bool gui2::tcontrol::get_use_markup (  )  const [inline]

Definition at line 234 of file control.hpp.

References use_markup_.

bool gui2::tcontrol::get_use_tooltip_on_label_overflow (  )  const [inline]

Definition at line 226 of file control.hpp.

References use_tooltip_on_label_overflow_.

const t_string& gui2::tcontrol::help_message (  )  const [inline]

Definition at line 241 of file control.hpp.

References help_message_.

void gui2::tcontrol::impl_draw_background ( surface frame_buffer  )  [protected, virtual]

Inherited from twidget.

Reimplemented from gui2::twidget.

Reimplemented in gui2::tminimap, gui2::tmulti_page, gui2::tpanel, and gui2::tspacer.

Definition at line 375 of file control.cpp.

References canvas(), DBG_GUI_D, gui2::debug_truncate(), gui2::twidget::get_rect(), get_state(), label_, and LOG_HEADER.

Here is the call graph for this function:

void gui2::tcontrol::impl_draw_background ( surface frame_buffer,
int  x_offset,
int  y_offset 
) [protected, virtual]

Reimplemented from gui2::twidget.

Reimplemented in gui2::tminimap, gui2::tmulti_page, gui2::tpanel, and gui2::tspacer.

Definition at line 385 of file control.cpp.

References gui2::twidget::calculate_blitting_rectangle(), canvas(), DBG_GUI_D, gui2::debug_truncate(), gui2::twidget::get_rect(), get_state(), label_, and LOG_HEADER.

Here is the call graph for this function:

void gui2::tcontrol::impl_draw_foreground ( surface  )  [inline, protected, virtual]

Inherited from twidget.

Reimplemented from gui2::twidget.

Reimplemented in gui2::tpanel.

Definition at line 387 of file control.hpp.

void gui2::tcontrol::impl_draw_foreground ( surface ,
int  ,
int   
) [inline, protected, virtual]

Reimplemented from gui2::twidget.

Reimplemented in gui2::tpanel.

Definition at line 388 of file control.hpp.

const t_string& gui2::tcontrol::label (  )  const [inline]
void gui2::tcontrol::layout_init ( const bool  full_initialization  )  [virtual]

Inherited from twidget.

Todo:
Also handle the tooltip state if shrunken_ && use_tooltip_on_label_overflow_.

Reimplemented from gui2::twidget.

Reimplemented in gui2::tcontainer_, and gui2::tscrollbar_container.

Definition at line 198 of file control.cpp.

References shrunken_.

void gui2::tcontrol::load_config (  )  [private]

Loads the configuration of the widget.

Controls have their definition stored in a definition object. In order to determine sizes and drawing the widget this definition needs to be loaded. The member definition_ contains the name of the definition and function load the proper configuration.

definition_load_configuration() is the replacement.

Definition at line 282 of file control.cpp.

References config(), definition_load_configuration(), get_control_type(), and load_config_extra().

Referenced by set_definition(), and gui2::twindow::twindow().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void gui2::tcontrol::load_config_extra (  )  [inline, private, virtual]

Load class dependant config settings.

load_config will call this method after loading the config, by default it does nothing but classes can override it to implement custom behaviour.

Reimplemented in gui2::tscrollbar_, and gui2::ttext_box.

Definition at line 354 of file control.hpp.

Referenced by load_config().

Here is the caller graph for this function:

void gui2::tcontrol::place ( const tpoint origin,
const tpoint size 
) [virtual]
void gui2::tcontrol::request_reduce_width ( const unsigned  maximum_width  )  [virtual]

Inherited from twidget.

Implements gui2::twidget.

Reimplemented in gui2::tcontainer_, and gui2::tscrollbar_container.

Definition at line 208 of file control.cpp.

References gui2::twidget::can_wrap(), config_, DBG_GUI_L, gui2::debug_truncate(), t_string::empty(), get_best_text_size(), label_, LOG_HEADER, gui2::twidget::set_layout_size(), gui2::tpoint::x, and gui2::tpoint::y.

Here is the call graph for this function:

virtual void gui2::tcontrol::set_active ( const bool  active  )  [pure virtual]

Sets the control's state.

Sets the control in the active state, when inactive a control can't be used and doesn't react to events. (Note read-only for a ttext_ is a different state.)

Implemented in gui2::tcontainer_, gui2::tdrawing, gui2::tlabel, gui2::tminimap, gui2::tprogress_bar, gui2::tscrollbar_, gui2::tspacer, and gui2::ttext_.

Referenced by intf_set_dialog_active(), gui2::tgrid::set_active(), gui2::tscrollbar_container::set_scrollbar_button_status(), gui2::teditor_settings::update_selected_tod_info(), and gui2::tfield_::widget_set_enabled().

Here is the caller graph for this function:

void gui2::tcontrol::set_config ( tresolution_definition_ptr  config  )  [inline, protected]

Definition at line 260 of file control.hpp.

References config_.

Referenced by definition_load_configuration().

Here is the caller graph for this function:

void gui2::tcontrol::set_definition ( const std::string &  definition  ) 

Sets the definition.

This function sets the definition of a control and should be called soon after creating the object since a lot of internal functions depend on the definition.

This function should be called one time only!!!

Definition at line 292 of file control.cpp.

References config(), definition_, gui2::init(), and load_config().

Referenced by gui2::tscrollbar_container::finalize_setup(), gui2::implementation::tbuilder_control::init_control(), and gui2::twindow::twindow().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tcontrol::set_help_message ( const t_string help_message  )  [inline]

Definition at line 243 of file control.hpp.

References help_message_.

Referenced by gui2::implementation::tbuilder_control::init_control(), and set_members().

Here is the caller graph for this function:

void gui2::tcontrol::set_label ( const t_string label  )  [virtual]
void gui2::tcontrol::set_members ( const string_map data  )  [virtual]

Sets the members of the control.

The map contains named members it can set, controls inheriting from us can add additional members to set by this function. The following members can by the following key: * label_ label * tooltip_ tooltip * help_message_ help

Parameters:
data Map with the key value pairs to set the members.

Todo:
document this feature on the wiki.
Todo:
do we need to add the debug colors here as well?

Definition at line 118 of file control.cpp.

References set_help_message(), gui2::twidget::set_id(), set_label(), gui2::twidget::set_linked_group(), set_tooltip(), set_use_markup(), and utils::string_bool().

Referenced by gui2::tpane::create_item(), gui2::ttree_view_node::init_grid(), and gui2::ttoggle_panel::set_child_members().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tcontrol::set_text_alignment ( const PangoAlignment  text_alignment  ) 

Definition at line 327 of file control.cpp.

References gui2::twidget::set_dirty(), text_alignment_, and update_canvas().

Here is the call graph for this function:

void gui2::tcontrol::set_tooltip ( const t_string tooltip  )  [inline]

Definition at line 238 of file control.hpp.

References t_string::empty(), gui2::tevent_executor::set_wants_mouse_hover(), and tooltip_.

Referenced by gui2::implementation::tbuilder_control::init_control(), place(), and set_members().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tcontrol::set_use_markup ( bool  use_markup  )  [virtual]
void gui2::tcontrol::set_use_tooltip_on_label_overflow ( const bool  use_tooltip = true  )  [inline]

Definition at line 227 of file control.hpp.

References use_tooltip_on_label_overflow_.

Referenced by gui2::implementation::tbuilder_control::init_control().

Here is the caller graph for this function:

void gui2::tcontrol::signal_handler_notify_remove_tooltip ( const event::tevent  event,
bool &  handled 
) [private]

Definition at line 525 of file control.cpp.

References DBG_GUI_E, LOG_HEADER, and schema_validation::remove.

Referenced by tcontrol().

Here is the caller graph for this function:

void gui2::tcontrol::signal_handler_show_helptip ( const event::tevent  event,
bool &  handled,
const tpoint location 
) [private]

Definition at line 512 of file control.cpp.

References DBG_GUI_E, t_string::empty(), gui2::event::tdispatcher::fire(), help_message_, LOG_HEADER, and gui2::event::MESSAGE_SHOW_HELPTIP.

Referenced by tcontrol().

Here is the call graph for this function:

Here is the caller graph for this function:

void gui2::tcontrol::signal_handler_show_tooltip ( const event::tevent  event,
bool &  handled,
const tpoint location 
) [private]
const t_string& gui2::tcontrol::tooltip (  )  const [inline]

Definition at line 236 of file control.hpp.

References tooltip_.

void gui2::tcontrol::update_canvas (  )  [protected, virtual]

Updates the canvas(ses).

This function should be called if either the size of the widget changes or the text on the widget changes.

Reimplemented in gui2::tscrollbar_, and gui2::ttext_box.

Definition at line 338 of file control.cpp.

References gui2::twidget::can_wrap(), canvas(), canvas_, gui2::encode_text_alignment(), get_characters_per_line(), get_text_maximum_height(), get_text_maximum_width(), label_, gui2::tcanvas::set_variable(), text_alignment_, and use_markup_.

Referenced by definition_load_configuration(), gui2::ttext_::insert_char(), gui2::ttext_::paste_selection(), place(), gui2::ttext_::set_cursor(), set_label(), gui2::ttext_::set_maximum_length(), set_text_alignment(), set_use_markup(), and gui2::ttext_::set_value().

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class tdebug_layout_graph [friend]

Reimplemented from gui2::twidget.

Reimplemented in gui2::tcontainer_, gui2::tlistbox, gui2::tmulti_page, gui2::tscrollbar_container, and gui2::tstacked_widget.

Definition at line 32 of file control.hpp.

friend class twindow [friend]

Uses the load function.

Note:
This doesn't look really clean, but the final goal is refactor more code and call load_config in the ctor, removing the use case for the window. That however is a longer termine refactoring.

Reimplemented from gui2::twidget.

Definition at line 181 of file control.hpp.


Member Data Documentation

std::vector<tcanvas> gui2::tcontrol::canvas_ [private]

Holds all canvas objects for a control.

A control can have multiple states, which are defined in the classes inheriting from us. For every state there is a separate canvas, which is stored here. When drawing the state is determined and that canvas is drawn.

Definition at line 335 of file control.hpp.

Referenced by canvas(), place(), and update_canvas().

Contains the pointer to the configuration.

Every control has a definition of how it should look, this contains a pointer to the definition. The definition is resolution dependant, where the resolution is the size of the Wesnoth application window. Depending on the resolution widgets can look different, use different fonts. Windows can use extra scrollbars use abbreviations as text etc.

Definition at line 346 of file control.hpp.

Referenced by calculate_best_size(), config(), get_best_text_size(), get_config_default_size(), get_config_maximum_size(), get_config_minimum_size(), get_text_maximum_height(), get_text_maximum_width(), request_reduce_width(), and set_config().

std::string gui2::tcontrol::definition_ [private]

The definition is the id of that widget class.

Eg for a button it [button_definition]id. A button can have multiple definitions which all look different but for the engine still is a button.

Definition at line 296 of file control.hpp.

Referenced by definition_load_configuration(), and set_definition().

Tooltip text.

The help event can cause a tooltip to be shown, this is the text to be shown. At the moment the tooltip is a single line of text.

Definition at line 325 of file control.hpp.

Referenced by help_message(), set_help_message(), signal_handler_show_helptip(), and signal_handler_show_tooltip().

Contain the non-editable text associated with control.

Definition at line 299 of file control.hpp.

Referenced by calculate_best_size(), get_best_text_size(), impl_draw_background(), label(), place(), request_reduce_width(), set_label(), and update_canvas().

font::ttext gui2::tcontrol::renderer_ [mutable, private]

Contains a helper cache for the rendering.

Creating a ttext object is quite expensive and is done on various occasions so it's cached here.

Todo:
Maybe if still too slow we might also copy this cache to the canvas so it can reuse our results, but for now it seems fast enough. Unfortunately that would make the dependency between the classes bigger as wanted.

Definition at line 431 of file control.hpp.

Referenced by get_best_text_size(), and place().

bool gui2::tcontrol::shrunken_ [private]

Is the widget smaller as it's best size?

Definition at line 440 of file control.hpp.

Referenced by layout_init().

PangoAlignment gui2::tcontrol::text_alignment_ [private]

The alignment of the text in a control.

Definition at line 437 of file control.hpp.

Referenced by get_best_text_size(), get_text_alignment(), set_text_alignment(), and update_canvas().

The maximum width for the text in a control.

Definition at line 434 of file control.hpp.

Referenced by get_best_text_size(), and get_text_maximum_width().

Tooltip text.

The hovering event can cause a small tooltip to be shown, this is the text to be shown. At the moment the tooltip is a single line of text.

Definition at line 317 of file control.hpp.

Referenced by place(), set_tooltip(), signal_handler_show_tooltip(), and tooltip().

Use markup for the label?

Definition at line 302 of file control.hpp.

Referenced by get_best_text_size(), get_use_markup(), set_use_markup(), and update_canvas().

If the text doesn't fit on the label should the text be used as tooltip?

This only happens if the tooltip is empty.

Definition at line 309 of file control.hpp.

Referenced by get_use_tooltip_on_label_overflow(), place(), and set_use_tooltip_on_label_overflow().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:22:47 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs