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 CEGUIEXPORT 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_val) {d_step = step_val;} 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 00170 virtual bool testClassName_impl(const String& class_name) const 00171 { 00172 if (class_name==(const utf8*)"ProgressBar") return true; 00173 return Window::testClassName_impl(class_name); 00174 } 00175 00176 00177 /************************************************************************* 00178 Event handlers for progress bar specific events 00179 *************************************************************************/ 00184 virtual void onProgressChanged(WindowEventArgs& e); 00185 00186 00191 virtual void onProgressDone(WindowEventArgs& e); 00192 00193 00194 /************************************************************************* 00195 Implementation Data 00196 *************************************************************************/ 00197 float d_progress; 00198 float d_step; 00199 00200 00201 private: 00202 /************************************************************************* 00203 Static Properties for this class 00204 *************************************************************************/ 00205 static ProgressBarProperties::CurrentProgress d_currentProgressProperty; 00206 static ProgressBarProperties::StepSize d_stepSizeProperty; 00207 00208 00209 /************************************************************************* 00210 Private methods 00211 *************************************************************************/ 00212 void addProgressBarProperties(void); 00213 }; 00214 00215 00216 } // End of CEGUI namespace section 00217 00218 #if defined(_MSC_VER) 00219 # pragma warning(pop) 00220 #endif 00221 00222 #endif // end of guard _CEGUIProgressBar_h_