gui2::tbutton Class Reference

#include <button.hpp>

Inheritance diagram for gui2::tbutton:

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

Collaboration graph
[legend]

List of all members.

Public Types

enum  RETVAL { NONE = 0, OK = -1, CANCEL = -2 }
 Default button values, values are subject to change. More...

Public Member Functions

 tbutton ()
void mouse_enter (tevent_handler &)
void mouse_leave (tevent_handler &)
void mouse_left_button_down (tevent_handler &event)
void mouse_left_button_up (tevent_handler &)
void mouse_left_button_click (tevent_handler &)
void set_retval (const int retval)
void set_active (const bool active)
 Inherited from tcontrol.
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.
void set_callback_mouse_left_click (void(*callback)(twidget *))

Static Public Member Functions

static RETVAL get_retval_by_id (const std::string &id)
 Gets the retval for the default buttons.

Private Types

enum  tstate {
  ENABLED, DISABLED, PRESSED, FOCUSSED,
  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_
int retval_
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 gui/widgets/button.hpp.


Member Enumeration Documentation

Default button values, values are subject to change.

Note this might be moved somewhere else since it will force people to include the button, while it should be and implementation detail for most callers.

Enumerator:
NONE  Dialog is closed with no return value, should be rare but eg a message popup can do it.

OK  Dialog is closed with ok button.
CANCEL  Dialog is closed with the cancel button.

Definition at line 47 of file gui/widgets/button.hpp.

enum gui2::tbutton::tstate [private]

Note the order of the states must be the same as defined in settings.hpp.

Enumerator:
ENABLED 
DISABLED 
PRESSED 
FOCUSSED 
COUNT 

Definition at line 70 of file gui/widgets/button.hpp.


Constructor & Destructor Documentation

gui2::tbutton::tbutton (  )  [inline]

Definition at line 26 of file gui/widgets/button.hpp.


Member Function Documentation

void gui2::tbutton::mouse_enter ( tevent_handler  )  [virtual]

Reimplemented from gui2::tevent_executor.

Definition at line 43 of file gui/widgets/button.cpp.

References DBG_G_E, FOCUSSED, and set_state().

void gui2::tbutton::mouse_leave ( tevent_handler  )  [virtual]

Reimplemented from gui2::tevent_executor.

Definition at line 50 of file gui/widgets/button.cpp.

References DBG_G_E, ENABLED, and set_state().

void gui2::tbutton::mouse_left_button_down ( tevent_handler event  )  [virtual]

Reimplemented from gui2::tevent_executor.

Definition at line 57 of file gui/widgets/button.cpp.

References DBG_G_E, PRESSED, and set_state().

void gui2::tbutton::mouse_left_button_up ( tevent_handler  )  [virtual]

Reimplemented from gui2::tevent_executor.

Definition at line 66 of file gui/widgets/button.cpp.

References DBG_G_E, FOCUSSED, and set_state().

void gui2::tbutton::mouse_left_button_click ( tevent_handler  )  [virtual]

void gui2::tbutton::set_retval ( const int  retval  )  [inline]

Definition at line 41 of file gui/widgets/button.hpp.

References retval_.

Referenced by gui2::tbuilder_button::build().

tbutton::RETVAL gui2::tbutton::get_retval_by_id ( const std::string &  id  )  [static]

Gets the retval for the default buttons.

Note it might change to a map later depending on the number of items.

Definition at line 91 of file gui/widgets/button.cpp.

References CANCEL, NONE, and OK.

Referenced by gui2::tbuilder_button::build().

void gui2::tbutton::set_active ( const bool  active  )  [inline, virtual]

Inherited from tcontrol.

Implements gui2::tcontrol.

Definition at line 60 of file gui/widgets/button.hpp.

References DISABLED, ENABLED, get_active(), and set_state().

Referenced by gui2::tlistbox::set_scrollbar_button_status().

bool gui2::tbutton::get_active (  )  const [inline, virtual]

Gets the active state of the control.

Implements gui2::tcontrol.

Definition at line 62 of file gui/widgets/button.hpp.

References DISABLED, and state_.

Referenced by set_active().

unsigned gui2::tbutton::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 63 of file gui/widgets/button.hpp.

References state_.

void gui2::tbutton::set_callback_mouse_left_click ( void(*)(twidget *)  callback  )  [inline]

Definition at line 65 of file gui/widgets/button.hpp.

References callback_mouse_left_click_.

Referenced by gui2::tlistbox::finalize_setup().

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

const std::string& gui2::tbutton::get_control_type (  )  const [inline, private, virtual]

Inherited from tcontrol.

Implements gui2::tcontrol.

Definition at line 84 of file gui/widgets/button.hpp.

References type.


Member Data Documentation

Definition at line 73 of file gui/widgets/button.hpp.

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

int gui2::tbutton::retval_ [private]

Definition at line 75 of file gui/widgets/button.hpp.

Referenced by mouse_left_button_click(), and set_retval().

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

Except when the button has a retval_, then retval_ is set.

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