The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | List of all members
gui2::tselectable_ Class Referenceabstract

Small abstract helper class. More...

#include <selectable.hpp>

Inheritance diagram for gui2::tselectable_:
Inheritance graph

Public Member Functions

virtual ~tselectable_ ()
 
virtual unsigned get_value () const =0
 Is the control selected? More...
 
virtual void set_value (const unsigned)=0
 Select the control. More...
 
virtual unsigned num_states () const =0
 The number of states, that is 2 for normal buttons, 3 for tristate buttons. More...
 
bool get_value_bool () const
 
void set_value_bool (const bool value)
 
virtual void set_callback_state_change (std::function< void(twidget &)> callback)=0
 When the user does something to change the widget state this event is fired. More...
 

Detailed Description

Small abstract helper class.

Parts of the engine inherit this class so we can have generic selectable items.

Definition at line 32 of file selectable.hpp.

Constructor & Destructor Documentation

virtual gui2::tselectable_::~tselectable_ ( )
inlinevirtual

Definition at line 35 of file selectable.hpp.

Member Function Documentation

virtual unsigned gui2::tselectable_::get_value ( ) const
pure virtual
bool gui2::tselectable_::get_value_bool ( ) const
inline
virtual unsigned gui2::tselectable_::num_states ( ) const
pure virtual

The number of states, that is 2 for normal buttons, 3 for tristate buttons.

Implemented in gui2::ttoggle_panel, gui2::tcombobox, and gui2::ttoggle_button.

Referenced by get_value_bool(), and set_value_bool().

virtual void gui2::tselectable_::set_callback_state_change ( std::function< void(twidget &)>  callback)
pure virtual

When the user does something to change the widget state this event is fired.

Most of the time it will be a left click on the widget.

Implemented in gui2::ttoggle_panel, gui2::tcombobox, and gui2::ttoggle_button.

Referenced by gui2::tfield_bool::init_specialized(), and gui2::taddon_list::register_sort_button().

virtual void gui2::tselectable_::set_value ( const unsigned  )
pure virtual
void gui2::tselectable_::set_value_bool ( const bool  value)
inline

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