Move tselectable_ to its own header.

This commit is contained in:
Mark de Wever 2008-11-27 17:54:08 +00:00
parent f92ec60b51
commit 7256873571
7 changed files with 52 additions and 24 deletions

View file

@ -23,6 +23,7 @@
#ifndef GUI_DIALOGS_FIELD_HPP_INCLUDED
#define GUI_DIALOGS_FIELD_HPP_INCLUDED
#include "gui/widgets/selectable.hpp"
#include "gui/widgets/text_box.hpp"
#include "gui/widgets/window.hpp"
#include "wml_exception.hpp"

View file

@ -14,6 +14,7 @@
#include "gui/widgets/menubar.hpp"
#include "gui/widgets/selectable.hpp"
namespace gui2 {

View file

@ -19,6 +19,8 @@
namespace gui2 {
class tselectable_;
/**
* A menu bar.
*

View file

@ -0,0 +1,46 @@
/* $Id$ */
/*
copyright (C) 2007 - 2008 by mark de wever <koraq@xs4all.nl>
part of the battle for wesnoth project http://www.wesnoth.org/
this program is free software; you can redistribute it and/or modify
it under the terms of the gnu general public license version 2
or at your option any later version.
this program is distributed in the hope that it will be useful,
but without any warranty.
see the copying file for more details.
*/
#ifndef GUI_WIDGETS_SELECTABLE_HPP_INCLUDED
#define GUI_WIDGETS_SELECTABLE_HPP_INCLUDED
namespace gui2 {
/**
* Small abstract helper class.
*
* Parts of the engine inherit this class so we can have generic
* selectable items.
*/
class tselectable_
{
public:
virtual ~tselectable_() {}
/** Is the control selected? */
virtual bool get_value() const = 0;
/** Select the control. */
virtual void set_value(const bool) = 0;
/**
* 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.
*/
virtual void set_callback_state_change(void (*callback) (twidget*)) = 0;
};
} // namespace gui2
#endif

View file

@ -16,6 +16,7 @@
#define GUI_WIDGETS_TOGGLE_BUTTON_HPP_INCLUDED
#include "gui/widgets/control.hpp"
#include "gui/widgets/selectable.hpp"
namespace gui2 {

View file

@ -16,6 +16,7 @@
#define GUI_WIDGETS_TOGGLE_PANEL_HPP_INCLUDED
#include "gui/widgets/panel.hpp"
#include "gui/widgets/selectable.hpp"
namespace gui2 {

View file

@ -751,30 +751,6 @@ template<class T> T* get_parent(twidget* widget)
return result;
}
/**
* Small abstract helper class.
*
* Parts of the engine inherit this class so we can have generic
* selectable items.
*/
class tselectable_
{
public:
virtual ~tselectable_() {}
/** Is the control selected? */
virtual bool get_value() const = 0;
/** Select the control. */
virtual void set_value(const bool) = 0;
/**
* 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.
*/
virtual void set_callback_state_change(void (*callback) (twidget*)) = 0;
};
} // namespace gui2
#endif