gui/widgets/selectable.hpp

Go to the documentation of this file.
00001 /* $Id: selectable.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2007 - 2012 by Mark de Wever <koraq@xs4all.nl>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY.
00012 
00013    See the COPYING file for more details.
00014 */
00015 
00016 #ifndef GUI_WIDGETS_SELECTABLE_HPP_INCLUDED
00017 #define GUI_WIDGETS_SELECTABLE_HPP_INCLUDED
00018 
00019 #include <boost/function.hpp>
00020 
00021 namespace gui2 {
00022 
00023 class twidget;
00024 
00025 /**
00026  * Small abstract helper class.
00027  *
00028  * Parts of the engine inherit this class so we can have generic
00029  * selectable items.
00030  */
00031 class tselectable_
00032 {
00033 public:
00034     virtual ~tselectable_() {}
00035 
00036     /** Is the control selected? */
00037     virtual bool get_value() const = 0;
00038 
00039     /** Select the control. */
00040     virtual void set_value(const bool) = 0;
00041 
00042     /**
00043      * When the user does something to change the widget state this event is
00044      * fired. Most of the time it will be a left click on the widget.
00045      */
00046     virtual void set_callback_state_change(boost::function<void (twidget*)> callback) = 0;
00047 };
00048 
00049 } // namespace gui2
00050 
00051 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:02:59 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs