#include <widget.hpp>
Public Member Functions | |
twidget () | |
virtual | ~twidget () |
twidget * | parent () |
void | set_parent (twidget *parent) |
const std::string & | id () const |
void | set_id (const std::string &id) |
const std::string & | definition () const |
virtual void | set_definition (const std::string &definition) |
This should not be changed after the widget is shown, strange things might occur. | |
virtual void | draw (surface &)=0 |
Draws a widget. | |
int | get_x () const |
int | get_y () const |
unsigned | get_width () const |
unsigned | get_height () const |
virtual bool | dirty () const |
Is the widget dirty? | |
virtual tpoint | get_minimum_size () const =0 |
Gets the minimum size for the object, 0,0 means no size required. | |
virtual tpoint | get_best_size () const =0 |
Gets the best size for the object, 0,0 means no size required. | |
virtual tpoint | get_maximum_size () const =0 |
Gets the best size for an object, 0,0 means no limits. | |
virtual void | set_size (const SDL_Rect &rect) |
Sets a predefined size for the object. | |
virtual twidget * | find_widget (const tpoint &coordinate, const bool must_be_active) |
Gets the widget at the wanted coordinates. | |
virtual const twidget * | find_widget (const tpoint &coordinate, const bool must_be_active) const |
The const version of find_widget. | |
virtual twidget * | find_widget (const std::string &id, const bool must_be_active) |
Gets a widget with the wanted id. | |
virtual const twidget * | find_widget (const std::string &id, const bool must_be_active) const |
The const version of find_widget. | |
virtual bool | has_widget (const twidget *widget) const |
Does the widget contain the widget. | |
twindow * | get_window () |
The toplevel item should always be a window if not null is returned. | |
virtual void | load_config () |
loads the configuration of the widget, mainly used for controls. | |
SDL_Rect | get_rect () const |
virtual bool | has_vertical_scrollbar () const |
If the best size doesn't fit we want to use the best size for normal widgets, and resize those who own a scrollbar. | |
virtual bool | has_horizontal_scrollbar () const |
Protected Member Functions | |
virtual void | set_dirty (const bool dirty=true) |
Private Attributes | |
std::string | id_ |
The id is the unique name of the widget in a certain context. | |
std::string | definition_ |
The definition is the id of that widget class. | |
twidget * | parent_ |
int | x_ |
int | y_ |
unsigned | w_ |
unsigned | h_ |
bool | dirty_ |
This is a non visible widget but it does have dimentions and size hints.
Definition at line 117 of file gui/widgets/widget.hpp.
gui2::twidget::twidget | ( | ) | [inline] |
Definition at line 120 of file gui/widgets/widget.hpp.
virtual gui2::twidget::~twidget | ( | ) | [inline, virtual] |
Definition at line 130 of file gui/widgets/widget.hpp.
twidget* gui2::twidget::parent | ( | ) | [inline] |
Definition at line 132 of file gui/widgets/widget.hpp.
References parent_.
Referenced by gui2::get_listbox().
void gui2::twidget::set_parent | ( | twidget * | parent | ) | [inline] |
Definition at line 133 of file gui/widgets/widget.hpp.
References parent_.
Referenced by gui2::tgrid::add_child(), gui2::tlistbox::add_item(), and gui2::tcontainer_::tcontainer_().
const std::string& gui2::twidget::id | ( | ) | const [inline] |
Definition at line 135 of file gui/widgets/widget.hpp.
References id_.
Referenced by gui2::tgrid::add_child(), gui2::tlistbox::find_widget(), and gui2::tlistbox::scrollbar_click().
void gui2::twidget::set_id | ( | const std::string & | id | ) | [inline] |
Definition at line 136 of file gui/widgets/widget.hpp.
References id_.
Referenced by gui2::tbuilder_listbox::build(), and gui2::tbuilder_control::init_control().
const std::string& gui2::twidget::definition | ( | ) | const [inline] |
Definition at line 138 of file gui/widgets/widget.hpp.
References definition_.
Referenced by gui2::tcontrol::load_config().
virtual void gui2::twidget::set_definition | ( | const std::string & | definition | ) | [inline, virtual] |
This should not be changed after the widget is shown, strange things might occur.
Reimplemented in gui2::tcontrol.
Definition at line 142 of file gui/widgets/widget.hpp.
References definition_.
Referenced by gui2::tbuilder_listbox::build(), and gui2::tcontrol::set_definition().
virtual void gui2::twidget::draw | ( | surface & | ) | [pure virtual] |
Draws a widget.
Implemented in gui2::tcontainer_, gui2::tcontrol, gui2::tgrid, gui2::tlistbox, gui2::tpanel, gui2::tspacer, and gui2::twindow.
int gui2::twidget::get_x | ( | ) | const [inline] |
Definition at line 153 of file gui/widgets/widget.hpp.
References x_.
Referenced by gui2::twindow::client_position(), gui2::ttext_box::handle_mouse_selection(), gui2::tscrollbar_::mouse_left_button_down(), gui2::tscrollbar_::mouse_left_button_up(), gui2::tscrollbar_::mouse_move(), and gui2::twindow::screen_position().
int gui2::twidget::get_y | ( | ) | const [inline] |
Definition at line 154 of file gui/widgets/widget.hpp.
References y_.
Referenced by gui2::twindow::client_position(), gui2::ttext_box::handle_mouse_selection(), gui2::tscrollbar_::mouse_left_button_down(), gui2::tscrollbar_::mouse_left_button_up(), gui2::tscrollbar_::mouse_move(), and gui2::twindow::screen_position().
unsigned gui2::twidget::get_width | ( | ) | const [inline] |
Definition at line 155 of file gui/widgets/widget.hpp.
References w_.
Referenced by gui2::tcontrol::draw(), gui2::tvertical_scrollbar::on_positioner(), and gui2::ttext_box::update_offsets().
unsigned gui2::twidget::get_height | ( | ) | const [inline] |
Definition at line 156 of file gui/widgets/widget.hpp.
References h_.
Referenced by gui2::tvertical_scrollbar::get_length(), and gui2::ttext_box::update_offsets().
virtual bool gui2::twidget::dirty | ( | ) | const [inline, virtual] |
Is the widget dirty?
Reimplemented in gui2::tcontainer_.
Definition at line 159 of file gui/widgets/widget.hpp.
References dirty_.
Referenced by gui2::tcontainer_::dirty(), gui2::twindow::draw(), gui2::tlistbox::draw(), gui2::tgrid::tchild::get_best_size(), gui2::tgrid::tchild::get_maximum_size(), gui2::tgrid::tchild::get_minimum_size(), and set_dirty().
virtual tpoint gui2::twidget::get_minimum_size | ( | ) | const [pure virtual] |
Gets the minimum size for the object, 0,0 means no size required.
Implemented in gui2::tcontainer_, gui2::tcontrol, and gui2::tgrid.
Referenced by gui2::tgrid::tchild::get_minimum_size().
virtual tpoint gui2::twidget::get_best_size | ( | ) | const [pure virtual] |
Gets the best size for the object, 0,0 means no size required.
Implemented in gui2::tcontainer_, gui2::tcontrol, gui2::tgrid, gui2::tlistbox, and gui2::tspacer.
Referenced by gui2::tgrid::tchild::get_best_size(), and gui2::tgrid::tchild::set_size().
virtual tpoint gui2::twidget::get_maximum_size | ( | ) | const [pure virtual] |
Gets the best size for an object, 0,0 means no limits.
Implemented in gui2::tcontrol, and gui2::tgrid.
Referenced by gui2::tgrid::tchild::get_maximum_size(), and gui2::tgrid::tchild::set_size().
virtual void gui2::twidget::set_size | ( | const SDL_Rect & | rect | ) | [inline, virtual] |
Sets a predefined size for the object.
Reimplemented in gui2::tcontainer_, gui2::tcontrol, gui2::tgrid, gui2::tlistbox, gui2::tscrollbar_, and gui2::ttext_box.
Definition at line 171 of file gui/widgets/widget.hpp.
References dirty_, h_, w_, x_, and y_.
Referenced by gui2::tgrid::tchild::set_size(), gui2::tgrid::set_size(), and gui2::tcontrol::set_size().
virtual twidget* gui2::twidget::find_widget | ( | const tpoint & | coordinate, | |
const bool | must_be_active | |||
) | [inline, virtual] |
Gets the widget at the wanted coordinates.
coordinate | The coordinate which should be inside the widget. | |
must_be_active | The widget should be active, not all widgets have an active flag, those who don't ignore flag. |
0 | No widget at the wanted coordinate found (or not active if must_be_active was set). |
Reimplemented in gui2::tcontainer_, gui2::tcontrol, gui2::tgrid, gui2::tlistbox, gui2::tpanel, and gui2::twindow.
Definition at line 193 of file gui/widgets/widget.hpp.
References h_, w_, gui2::tpoint::x, x_, gui2::tpoint::y, and y_.
Referenced by gui2::tgrid::find_widget(), and gui2::tcontrol::find_widget().
virtual const twidget* gui2::twidget::find_widget | ( | const tpoint & | coordinate, | |
const bool | must_be_active | |||
) | const [inline, virtual] |
The const version of find_widget.
Reimplemented in gui2::tcontainer_, gui2::tcontrol, gui2::tgrid, gui2::tlistbox, gui2::tpanel, and gui2::twindow.
Definition at line 201 of file gui/widgets/widget.hpp.
References h_, w_, gui2::tpoint::x, x_, gui2::tpoint::y, and y_.
virtual twidget* gui2::twidget::find_widget | ( | const std::string & | id, | |
const bool | must_be_active | |||
) | [inline, virtual] |
Gets a widget with the wanted id.
id | The id of the widget to find. | |
must_be_active | The widget should be active, not all widgets have an active flag, those who don't ignore flag. |
0 | No widget with the id found (or not active if must_be_active was set). |
Reimplemented in gui2::tcontainer_, gui2::tcontrol, gui2::tgrid, gui2::tpanel, and gui2::twindow.
Definition at line 220 of file gui/widgets/widget.hpp.
References id_.
virtual const twidget* gui2::twidget::find_widget | ( | const std::string & | id, | |
const bool | must_be_active | |||
) | const [inline, virtual] |
The const version of find_widget.
Reimplemented in gui2::tcontainer_, gui2::tcontrol, gui2::tgrid, gui2::tpanel, and gui2::twindow.
Definition at line 225 of file gui/widgets/widget.hpp.
References id_.
virtual bool gui2::twidget::has_widget | ( | const twidget * | widget | ) | const [inline, virtual] |
Does the widget contain the widget.
This makes more sence in container classes.
Reimplemented in gui2::tcontainer_, and gui2::tgrid.
Definition at line 234 of file gui/widgets/widget.hpp.
twindow * gui2::twidget::get_window | ( | ) |
The toplevel item should always be a window if not null is returned.
Reimplemented in gui2::twindow.
Definition at line 47 of file gui/widgets/widget.cpp.
References parent_.
Referenced by gui2::tbutton::mouse_left_button_click().
virtual void gui2::twidget::load_config | ( | ) | [inline, virtual] |
loads the configuration of the widget, mainly used for controls.
Reimplemented in gui2::tcontrol.
Definition at line 241 of file gui/widgets/widget.hpp.
SDL_Rect gui2::twidget::get_rect | ( | ) | const [inline] |
Definition at line 243 of file gui/widgets/widget.hpp.
References create_rect(), h_, w_, x_, and y_.
Referenced by gui2::twindow::do_show_help_popup(), gui2::twindow::draw(), gui2::tpanel::draw(), gui2::tcontrol::draw(), gui2::twindow::get_client_rect(), gui2::tpanel::get_client_rect(), gui2::tcontainer_::get_client_rect(), gui2::tcontrol::restore_background(), gui2::tcontrol::save_background(), gui2::tlistbox::set_size(), and gui2::twindow::show().
virtual bool gui2::twidget::has_vertical_scrollbar | ( | ) | const [inline, virtual] |
If the best size doesn't fit we want to use the best size for normal widgets, and resize those who own a scrollbar.
Reimplemented in gui2::tcontainer_, gui2::tgrid, gui2::tlistbox, and gui2::tpanel.
Definition at line 251 of file gui/widgets/widget.hpp.
Referenced by gui2::tgrid::has_vertical_scrollbar(), and gui2::tgrid::set_size().
virtual bool gui2::twidget::has_horizontal_scrollbar | ( | ) | const [inline, virtual] |
Definition at line 252 of file gui/widgets/widget.hpp.
virtual void gui2::twidget::set_dirty | ( | const bool | dirty = true |
) | [inline, protected, virtual] |
Definition at line 255 of file gui/widgets/widget.hpp.
References dirty(), dirty_, parent_, and set_dirty().
Referenced by gui2::twindow::draw(), gui2::tgrid::draw(), gui2::tcontrol::draw(), gui2::ttext_box::handle_mouse_selection(), gui2::ttext_box::insert_char(), gui2::ttext_::paste_selection(), gui2::tlistbox::scrollbar_moved(), gui2::tgrid::set_col_grow_factor(), gui2::ttext_::set_cursor(), set_dirty(), gui2::tcontrol::set_label(), gui2::tcontrol::set_multiline_label(), gui2::tgrid::set_row_grow_factor(), gui2::ttext_::set_sel_len(), gui2::ttext_::set_sel_start(), gui2::ttoggle_button::set_state(), gui2::ttext_::set_state(), gui2::tscrollbar_::set_state(), gui2::tlabel::set_state(), gui2::tbutton::set_state(), gui2::ttext_::set_text(), gui2::tcontrol::set_visible(), and gui2::tscrollbar_::update_canvas().
std::string gui2::twidget::id_ [private] |
The id is the unique name of the widget in a certain context.
This is needed for certain widgets so the engine knows which widget is which. Eg it knows which button is pressed and thuswhich engine action is connected to the button.
Definition at line 266 of file gui/widgets/widget.hpp.
Referenced by find_widget(), id(), and set_id().
std::string gui2::twidget::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 271 of file gui/widgets/widget.hpp.
Referenced by definition(), and set_definition().
twidget* gui2::twidget::parent_ [private] |
Definition at line 273 of file gui/widgets/widget.hpp.
Referenced by get_window(), parent(), set_dirty(), and set_parent().
int gui2::twidget::x_ [private] |
Definition at line 274 of file gui/widgets/widget.hpp.
Referenced by find_widget(), get_rect(), get_x(), and set_size().
int gui2::twidget::y_ [private] |
Definition at line 274 of file gui/widgets/widget.hpp.
Referenced by find_widget(), get_rect(), get_y(), and set_size().
unsigned gui2::twidget::w_ [private] |
Definition at line 275 of file gui/widgets/widget.hpp.
Referenced by find_widget(), get_rect(), get_width(), and set_size().
unsigned gui2::twidget::h_ [private] |
Definition at line 275 of file gui/widgets/widget.hpp.
Referenced by find_widget(), get_height(), get_rect(), and set_size().
bool gui2::twidget::dirty_ [private] |
Definition at line 276 of file gui/widgets/widget.hpp.
Referenced by dirty(), set_dirty(), and set_size().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |