00001 /************************************************************************ 00002 filename: CEGUIProgressBar.h 00003 created: 13/4/2004 00004 author: Paul D Turner 00005 00006 purpose: Interface to base class for ProgressBar widget 00007 *************************************************************************/ 00008 /************************************************************************* 00009 Crazy Eddie's GUI System (http://www.cegui.org.uk) 00010 Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk) 00011 00012 This library is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU Lesser General Public 00014 License as published by the Free Software Foundation; either 00015 version 2.1 of the License, or (at your option) any later version. 00016 00017 This library is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 Lesser General Public License for more details. 00021 00022 You should have received a copy of the GNU Lesser General Public 00023 License along with this library; if not, write to the Free Software 00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 *************************************************************************/ 00026 #ifndef _CEGUIProgressBar_h_ 00027 #define _CEGUIProgressBar_h_ 00028 00029 #include "CEGUIBase.h" 00030 #include "CEGUIWindow.h" 00031 #include "elements/CEGUIProgressBarProperties.h" 00032 00033 00034 #if defined(_MSC_VER) 00035 # pragma warning(push) 00036 # pragma warning(disable : 4251) 00037 #endif 00038 00039 00040 // Start of CEGUI namespace section 00041 namespace CEGUI 00042 { 00047 class CEGUIBASE_API ProgressBar : public Window 00048 { 00049 public: 00050 static const String EventNamespace; 00051 00052 00053 /************************************************************************* 00054 Event name constants 00055 *************************************************************************/ 00056 static const String EventProgressChanged; 00057 static const String EventProgressDone; 00058 00059 00060 /************************************************************************ 00061 Accessor Functions 00062 ************************************************************************/ 00067 float getProgress(void) const {return d_progress;} 00068 00073 float getStep(void) const {return d_step;} 00074 00075 00076 /************************************************************************* 00077 Manipulator Functions 00078 *************************************************************************/ 00089 void setProgress(float progress); 00090 00091 00102 void setStepSize(float step) {d_step = step;} 00103 00104 00115 void step(void) {setProgress(d_progress + d_step);} 00116 00117 00129 void adjustProgress(float delta) {setProgress(d_progress + delta);} 00130 00131 00132 /************************************************************************* 00133 Construction / Destruction 00134 *************************************************************************/ 00139 ProgressBar(const String& type, const String& name); 00140 00141 00146 virtual ~ProgressBar(void); 00147 00148 00149 protected: 00150 /************************************************************************* 00151 Implementation methods 00152 *************************************************************************/ 00157 void addProgressBarEvents(void); 00158 00159 00160 /************************************************************************* 00161 Event handlers for progress bar specific events 00162 *************************************************************************/ 00167 virtual void onProgressChanged(WindowEventArgs& e); 00168 00169 00174 virtual void onProgressDone(WindowEventArgs& e); 00175 00176 00177 /************************************************************************* 00178 Implementation Data 00179 *************************************************************************/ 00180 float d_progress; 00181 float d_step; 00182 00183 00184 private: 00185 /************************************************************************* 00186 Static Properties for this class 00187 *************************************************************************/ 00188 static ProgressBarProperties::CurrentProgress d_currentProgressProperty; 00189 static ProgressBarProperties::StepSize d_stepSizeProperty; 00190 00191 00192 /************************************************************************* 00193 Private methods 00194 *************************************************************************/ 00195 void addProgressBarProperties(void); 00196 }; 00197 00198 00199 } // End of CEGUI namespace section 00200 00201 #if defined(_MSC_VER) 00202 # pragma warning(pop) 00203 #endif 00204 00205 #endif // end of guard _CEGUIProgressBar_h_