gui2::ttoggle_button Class Reference

#include <toggle_button.hpp>

Inheritance diagram for gui2::ttoggle_button:

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

Collaboration graph
[legend]

List of all members.

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.


Detailed Description

Definition at line 23 of file toggle_button.hpp.


Member Enumeration Documentation

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'.

Enumerator:
ENABLED 
DISABLED 
FOCUSSED 
ENABLED_SELECTED 
DISABLED_SELECTED 
FOCUSSED_SELECTED 
COUNT 

Definition at line 56 of file toggle_button.hpp.


Constructor & Destructor Documentation

gui2::ttoggle_button::ttoggle_button (  )  [inline]

Definition at line 26 of file toggle_button.hpp.


Member Function Documentation

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]

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]

void gui2::ttoggle_button::set_state ( tstate  state  )  [private]

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.


Member Data Documentation

Definition at line 62 of file toggle_button.hpp.

Referenced by get_active(), get_state(), is_selected(), set_selected(), and set_state().

This callback is used when the control gets a left click.

Referenced by mouse_left_button_click(), and set_callback_mouse_left_click().


The documentation for this class was generated from the following files:

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs