#include <toggle_button.hpp>
Public Member Functions | |
ttoggle_button () | |
void | mouse_enter (tevent_handler &) |
void | mouse_leave (tevent_handler &) |
void | mouse_left_button_click (tevent_handler &) |
void | set_active (const bool active) |
Sets the control in the active state, when inactive a control can't be used and doesn't react to events. | |
bool | get_active () const |
Gets the active state of the control. | |
unsigned | get_state () const |
Returns the id of the state, which is also the index for the canvas. | |
bool | is_selected () const |
Inherited from tselectable_. | |
void | set_selected (const bool selected=true) |
Inherited from tselectable_. | |
void | set_callback_mouse_left_click (void(*callback)(twidget *)) |
Private Types | |
enum | tstate { ENABLED, DISABLED, FOCUSSED, ENABLED_SELECTED, DISABLED_SELECTED, FOCUSSED_SELECTED, COUNT } |
Note the order of the states must be the same as defined in settings.hpp. More... | |
Private Member Functions | |
void | set_state (tstate state) |
const std::string & | get_control_type () const |
Inherited from tcontrol. | |
Private Attributes | |
tstate | state_ |
void(* | callback_mouse_left_click_ )(twidget *) |
This callback is used when the control gets a left click. |
Definition at line 23 of file toggle_button.hpp.
enum gui2::ttoggle_button::tstate [private] |
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'.
Definition at line 56 of file toggle_button.hpp.
gui2::ttoggle_button::ttoggle_button | ( | ) | [inline] |
Definition at line 26 of file toggle_button.hpp.
void gui2::ttoggle_button::mouse_enter | ( | tevent_handler & | ) | [virtual] |
Reimplemented from gui2::tevent_executor.
Definition at line 42 of file toggle_button.cpp.
References DBG_G_E, FOCUSSED, FOCUSSED_SELECTED, is_selected(), and set_state().
void gui2::ttoggle_button::mouse_leave | ( | tevent_handler & | ) | [virtual] |
Reimplemented from gui2::tevent_executor.
Definition at line 53 of file toggle_button.cpp.
References DBG_G_E, ENABLED, ENABLED_SELECTED, is_selected(), and set_state().
void gui2::ttoggle_button::mouse_left_button_click | ( | tevent_handler & | ) | [virtual] |
Reimplemented from gui2::tevent_executor.
Definition at line 64 of file toggle_button.cpp.
References callback_mouse_left_click_, DBG_G_E, ENABLED, ENABLED_SELECTED, is_selected(), and set_state().
void gui2::ttoggle_button::set_active | ( | const bool | active | ) | [virtual] |
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.)
Implements gui2::tcontrol.
Definition at line 79 of file toggle_button.cpp.
References DISABLED, DISABLED_SELECTED, ENABLED, ENABLED_SELECTED, is_selected(), and set_state().
bool gui2::ttoggle_button::get_active | ( | ) | const [inline, virtual] |
Gets the active state of the control.
Implements gui2::tcontrol.
Definition at line 39 of file toggle_button.hpp.
References DISABLED, DISABLED_SELECTED, and state_.
unsigned gui2::ttoggle_button::get_state | ( | ) | const [inline, virtual] |
Returns the id of the state, which is also the index for the canvas.
Implements gui2::tcontrol.
Definition at line 41 of file toggle_button.hpp.
References state_.
bool gui2::ttoggle_button::is_selected | ( | ) | const [inline, virtual] |
Inherited from tselectable_.
Implements gui2::tselectable_.
Definition at line 44 of file toggle_button.hpp.
References ENABLED_SELECTED, and state_.
Referenced by mouse_enter(), mouse_leave(), mouse_left_button_click(), set_active(), and set_selected().
void gui2::ttoggle_button::set_selected | ( | const bool | selected = true |
) | [virtual] |
Inherited from tselectable_.
Implements gui2::tselectable_.
Definition at line 96 of file toggle_button.cpp.
References ENABLED_SELECTED, is_selected(), set_state(), and state_.
void gui2::ttoggle_button::set_callback_mouse_left_click | ( | void(*)(twidget *) | callback | ) | [inline] |
Definition at line 49 of file toggle_button.hpp.
References callback_mouse_left_click_.
Referenced by gui2::tlistbox::finalize_setup(), and gui2::tlistbox::trow::init_in_grid().
void gui2::ttoggle_button::set_state | ( | tstate | state | ) | [private] |
Definition at line 109 of file toggle_button.cpp.
References gui2::twidget::set_dirty(), and state_.
Referenced by mouse_enter(), mouse_leave(), mouse_left_button_click(), set_active(), and set_selected().
const std::string& gui2::ttoggle_button::get_control_type | ( | ) | const [inline, private, virtual] |
Inherited from tcontrol.
Implements gui2::tcontrol.
Definition at line 68 of file toggle_button.hpp.
References type.
tstate gui2::ttoggle_button::state_ [private] |
Definition at line 62 of file toggle_button.hpp.
Referenced by get_active(), get_state(), is_selected(), set_selected(), and set_state().
void(* gui2::ttoggle_button::callback_mouse_left_click_)(twidget *) [private] |
This callback is used when the control gets a left click.
Referenced by mouse_left_button_click(), and set_callback_mouse_left_click().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |