Class for a toggle button. More...
#include <toggle_panel.hpp>


Public Member Functions | |
| ttoggle_panel () | |
| void | set_child_members (const std::map< std::string, string_map > &data) |
| Sets the members of the child controls. | |
| twidget * | find_at (const tpoint &coordinate, const bool must_be_active) |
| Inherited from tcontainer_. | |
| const twidget * | find_at (const tpoint &coordinate, const bool must_be_active) const |
| Inherited from tcontainer_. | |
| void | set_active (const bool active) |
| Inherited from tpanel. | |
| bool | get_active () const |
| Inherited from tpanel. | |
| unsigned | get_state () const |
| Inherited from tpanel. | |
| SDL_Rect | get_client_rect () const |
| Inherited from tpanel. | |
| tpoint | border_space () const |
| Inherited from tpanel. | |
| bool | get_value () const |
| Inherited from tselectable_. | |
| void | set_value (const bool selected) |
| Inherited from tselectable_. | |
| void | set_retval (const int retval) |
| void | set_callback_state_change (boost::function< void(twidget *)> callback) |
| Inherited from tselectable_. | |
| void | set_callback_mouse_left_double_click (boost::function< void(twidget *)> callback) |
Private Types | |
| enum | tstate { ENABLED, DISABLED, FOCUSSED, ENABLED_SELECTED, DISABLED_SELECTED, FOCUSSED_SELECTED, COUNT } |
Possible states of the widget. More... | |
Private Member Functions | |
| void | set_state (const tstate state) |
| void | impl_draw_background (surface &frame_buffer) |
| Inherited from tpanel. | |
| void | impl_draw_background (surface &frame_buffer, int x_offset, int y_offset) |
| Inherited from tpanel. | |
| void | impl_draw_foreground (surface &frame_buffer) |
| Inherited from tpanel. | |
| void | impl_draw_foreground (surface &frame_buffer, int x_offset, int y_offset) |
| Inherited from tpanel. | |
| const std::string & | get_control_type () const |
| Inherited from tpanel. | |
| void | signal_handler_mouse_enter (const event::tevent event, bool &handled) |
| void | signal_handler_mouse_leave (const event::tevent event, bool &handled) |
| void | signal_handler_pre_left_button_click (const event::tevent event) |
| void | signal_handler_left_button_click (const event::tevent event, bool &handled) |
| void | signal_handler_left_button_double_click (const event::tevent event, bool &handled) |
Private Attributes | |
| tstate | state_ |
| Current state of the widget. | |
| int | retval_ |
| The return value of the button. | |
| boost::function< void(twidget *) | callback_state_change_ ) |
| See tselectable_::set_callback_state_change. | |
| boost::function< void(twidget *) | callback_mouse_left_double_click_ ) |
| Mouse left double click callback. | |
Class for a toggle button.
Quite some code looks like ttoggle_button maybe we should inherit from that but let's test first. the problem is that the toggle_button has an icon we don't want, but maybe look at refactoring later. but maybe we should also ditch the icon, not sure however since it's handy for checkboxes...
Definition at line 31 of file toggle_panel.hpp.
enum gui2::ttoggle_panel::tstate [private] |
Possible states of the widget.
Note the order of the states must be the same as defined in settings.hpp. Also note the internals do assume the order for 'up' and 'down' to be the same and also that 'up' is before 'down'. 'up' has no suffix, 'down' has the SELECTED suffix.
Definition at line 126 of file toggle_panel.hpp.
| gui2::ttoggle_panel::ttoggle_panel | ( | ) |
Definition at line 37 of file toggle_panel.cpp.
References signal_handler_left_button_click(), signal_handler_left_button_double_click(), signal_handler_mouse_enter(), signal_handler_mouse_leave(), and signal_handler_pre_left_button_click().

| tpoint gui2::ttoggle_panel::border_space | ( | ) | const |
Inherited from tpanel.
Definition at line 115 of file toggle_panel.cpp.
References gui2::tcontrol::config().

| twidget* gui2::ttoggle_panel::find_at | ( | const tpoint & | coordinate, | |
| const bool | must_be_active | |||
| ) | [inline] |
Inherited from tcontainer_.
Definition at line 49 of file toggle_panel.hpp.
Referenced by find_at().

| const twidget* gui2::ttoggle_panel::find_at | ( | const tpoint & | coordinate, | |
| const bool | must_be_active | |||
| ) | const [inline] |
Inherited from tcontainer_.
Definition at line 64 of file toggle_panel.hpp.
References find_at().

| bool gui2::ttoggle_panel::get_active | ( | ) | const [inline] |
Inherited from tpanel.
Definition at line 76 of file toggle_panel.hpp.
| SDL_Rect gui2::ttoggle_panel::get_client_rect | ( | ) | const |
Inherited from tpanel.
Definition at line 100 of file toggle_panel.cpp.
References gui2::tcontrol::config(), and gui2::twidget::get_rect().

| const std::string & gui2::ttoggle_panel::get_control_type | ( | ) | const [private] |
Inherited from tpanel.
Definition at line 157 of file toggle_panel.cpp.
References type.
Referenced by signal_handler_pre_left_button_click().

| unsigned gui2::ttoggle_panel::get_state | ( | ) | const [inline] |
| bool gui2::ttoggle_panel::get_value | ( | ) | const [inline, virtual] |
Inherited from tselectable_.
Implements gui2::tselectable_.
Definition at line 101 of file toggle_panel.hpp.
References state_.
Referenced by set_active(), set_value(), signal_handler_left_button_click(), signal_handler_mouse_enter(), and signal_handler_mouse_leave().

| void gui2::ttoggle_panel::impl_draw_background | ( | surface & | frame_buffer, | |
| int | x_offset, | |||
| int | y_offset | |||
| ) | [inline, private] |
Inherited from tpanel.
Definition at line 164 of file toggle_panel.hpp.
References impl_draw_background().

| void gui2::ttoggle_panel::impl_draw_background | ( | surface & | frame_buffer | ) | [inline, private] |
Inherited from tpanel.
Definition at line 156 of file toggle_panel.hpp.
Referenced by impl_draw_background().

| void gui2::ttoggle_panel::impl_draw_foreground | ( | surface & | frame_buffer | ) | [inline, private] |
Inherited from tpanel.
Definition at line 172 of file toggle_panel.hpp.
Referenced by impl_draw_foreground().

| void gui2::ttoggle_panel::impl_draw_foreground | ( | surface & | frame_buffer, | |
| int | x_offset, | |||
| int | y_offset | |||
| ) | [inline, private] |
Inherited from tpanel.
Definition at line 180 of file toggle_panel.hpp.
References impl_draw_foreground().

| void gui2::ttoggle_panel::set_active | ( | const bool | active | ) |
Inherited from tpanel.
Definition at line 83 of file toggle_panel.cpp.
References DISABLED, DISABLED_SELECTED, ENABLED, ENABLED_SELECTED, get_value(), and set_state().

| void gui2::ttoggle_panel::set_callback_mouse_left_double_click | ( | boost::function< void(twidget *)> | callback | ) | [inline] |
Definition at line 114 of file toggle_panel.hpp.
References callback_mouse_left_double_click_.
Referenced by gui2::tlobby_main::adjust_game_row_contents().

| void gui2::ttoggle_panel::set_callback_state_change | ( | boost::function< void(twidget *)> | callback | ) | [inline, virtual] |
Inherited from tselectable_.
Implements gui2::tselectable_.
Definition at line 111 of file toggle_panel.hpp.
References callback_state_change_.
| void gui2::ttoggle_panel::set_child_members | ( | const std::map< std::string, string_map > & | data | ) |
Sets the members of the child controls.
Sets the members for all controls which have the proper member id. See tcontrol::set_members for more info.
| data | Map with the key value pairs to set the members. |
Definition at line 71 of file toggle_panel.cpp.
References gui2::tcontainer_::find(), and gui2::tcontrol::set_members().
Referenced by gui2::ttree_view_node::init_grid().


| void gui2::ttoggle_panel::set_retval | ( | const int | retval | ) |
Definition at line 138 of file toggle_panel.cpp.
References retval_.
| void gui2::ttoggle_panel::set_state | ( | const tstate | state | ) | [private] |
Definition at line 143 of file toggle_panel.cpp.
References gui2::tcontrol::config(), gui2::twidget::set_dirty(), and state_.
Referenced by set_active(), set_value(), signal_handler_left_button_click(), signal_handler_mouse_enter(), and signal_handler_mouse_leave().


| void gui2::ttoggle_panel::set_value | ( | const bool | selected | ) | [virtual] |
Inherited from tselectable_.
Implements gui2::tselectable_.
Definition at line 125 of file toggle_panel.cpp.
References ENABLED_SELECTED, get_value(), set_state(), and state_.
Referenced by signal_handler_pre_left_button_click().


| void gui2::ttoggle_panel::signal_handler_left_button_click | ( | const event::tevent | event, | |
| bool & | handled | |||
| ) | [private] |
Definition at line 200 of file toggle_panel.cpp.
References callback_state_change_, DBG_GUI_E, ENABLED, ENABLED_SELECTED, get_value(), LOG_HEADER, sound::play_UI_sound(), set_state(), and gui2::settings::sound_toggle_panel_click.
Referenced by ttoggle_panel().


| void gui2::ttoggle_panel::signal_handler_left_button_double_click | ( | const event::tevent | event, | |
| bool & | handled | |||
| ) | [private] |
Definition at line 219 of file toggle_panel.cpp.
References callback_mouse_left_double_click_, DBG_GUI_E, gui2::twidget::get_window(), LOG_HEADER, retval_, and gui2::twindow::set_retval().
Referenced by ttoggle_panel().


| void gui2::ttoggle_panel::signal_handler_mouse_enter | ( | const event::tevent | event, | |
| bool & | handled | |||
| ) | [private] |
Definition at line 163 of file toggle_panel.cpp.
References DBG_GUI_E, FOCUSSED, FOCUSSED_SELECTED, get_value(), LOG_HEADER, and set_state().
Referenced by ttoggle_panel().


| void gui2::ttoggle_panel::signal_handler_mouse_leave | ( | const event::tevent | event, | |
| bool & | handled | |||
| ) | [private] |
Definition at line 176 of file toggle_panel.cpp.
References DBG_GUI_E, ENABLED, ENABLED_SELECTED, get_value(), LOG_HEADER, and set_state().
Referenced by ttoggle_panel().


| void gui2::ttoggle_panel::signal_handler_pre_left_button_click | ( | const event::tevent | event | ) | [private] |
Definition at line 189 of file toggle_panel.cpp.
References callback_state_change_, DBG_GUI_E, get_control_type(), gui2::twidget::id(), and set_value().
Referenced by ttoggle_panel().


boost::function<void (twidget*) gui2::ttoggle_panel::callback_mouse_left_double_click_) [private] |
Mouse left double click callback.
Definition at line 153 of file toggle_panel.hpp.
Referenced by set_callback_mouse_left_double_click(), and signal_handler_left_button_double_click().
boost::function<void (twidget*) gui2::ttoggle_panel::callback_state_change_) [private] |
See tselectable_::set_callback_state_change.
Definition at line 150 of file toggle_panel.hpp.
Referenced by set_callback_state_change(), signal_handler_left_button_click(), and signal_handler_pre_left_button_click().
int gui2::ttoggle_panel::retval_ [private] |
The return value of the button.
If this value is not 0 and the button is double clicked it sets the retval of the window and the window closes itself.
Definition at line 147 of file toggle_panel.hpp.
Referenced by set_retval(), and signal_handler_left_button_double_click().
tstate gui2::ttoggle_panel::state_ [private] |
Current state of the widget.
The state of the widget determines what to render and how the widget reacts to certain 'events'.
Definition at line 139 of file toggle_panel.hpp.
Referenced by get_active(), get_state(), get_value(), set_state(), and set_value().
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:23:34 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |