00001 /* $Id: label.hpp 26682 2008-05-18 07:14:57Z mordante $ */ 00002 /* 00003 copyright (C) 2008 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 version 2 00008 or at your option any later version. 00009 this program is distributed in the hope that it will be useful, 00010 but without any warranty. 00011 00012 see the copying file for more details. 00013 */ 00014 00015 #ifndef __GUI_WIDGETS_LABEL_HPP_INCLUDED__ 00016 #define __GUI_WIDGETS_LABEL_HPP_INCLUDED__ 00017 00018 #include "gui/widgets/control.hpp" 00019 00020 namespace gui2 { 00021 00022 class tlabel : public tcontrol 00023 { 00024 public: 00025 00026 tlabel() : 00027 tcontrol(COUNT), 00028 state_(ENABLED) 00029 { 00030 } 00031 00032 //! Inherited from tcontrol. 00033 void set_active(const bool active) 00034 { if(get_active() != active) set_state(active ? ENABLED : DISABLED); }; 00035 bool get_active() const { return state_ != DISABLED; } 00036 unsigned get_state() const { return state_; } 00037 00038 private: 00039 //! Note the order of the states must be the same as defined in settings.hpp. 00040 enum tstate { ENABLED, DISABLED, COUNT }; 00041 00042 void set_state(tstate state); 00043 tstate state_; 00044 00045 //! Inherited from tcontrol. 00046 const std::string& get_control_type() const 00047 { static const std::string type = "label"; return type; } 00048 }; 00049 00050 } // namespace gui2 00051 00052 #endif 00053
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |