00001 /* $Id: progress_bar.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */ 00002 /* 00003 Copyright (C) 2010 - 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_PROGRESS_BAR_HPP_INCLUDED 00017 #define GUI_WIDGETS_PROGRESS_BAR_HPP_INCLUDED 00018 00019 #include "gui/widgets/control.hpp" 00020 00021 namespace gui2 { 00022 00023 class tprogress_bar 00024 : public tcontrol 00025 { 00026 public: 00027 00028 tprogress_bar() 00029 : tcontrol(COUNT) 00030 , percentage_(static_cast<unsigned>(-1)) 00031 { 00032 // Force canvas update 00033 set_percentage(0); 00034 } 00035 00036 /***** ***** ***** ***** Inherited ***** ***** ***** *****/ 00037 00038 /** Inherited from tcontrol. */ 00039 void set_active(const bool /*active*/) {} 00040 00041 /** Inherited from tcontrol. */ 00042 bool get_active() const { return true; } 00043 00044 /** Inherited from tcontrol. */ 00045 unsigned get_state() const { return ENABLED; } 00046 00047 /** Inherited from tcontrol. */ 00048 bool disable_click_dismiss() const { return false; } 00049 00050 00051 /***** ***** ***** setters / getters for members ***** ****** *****/ 00052 00053 void set_percentage(const unsigned percentage); 00054 unsigned get_percentage() const { return percentage_; } 00055 00056 private: 00057 00058 /** 00059 * Possible states of the widget. 00060 * 00061 * Note the order of the states must be the same as defined in settings.hpp. 00062 */ 00063 enum tstate { ENABLED, COUNT }; 00064 00065 /** The percentage done. */ 00066 unsigned percentage_; 00067 00068 /** Inherited from tcontrol. */ 00069 const std::string& get_control_type() const; 00070 }; 00071 00072 } // namespace gui2 00073 00074 #endif 00075
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:02:55 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |