Crazy Eddies GUI System  0.7.2
CEGUIProgressBar.h
1 /***********************************************************************
2  filename: CEGUIProgressBar.h
3  created: 13/4/2004
4  author: Paul D Turner
5 
6  purpose: Interface to base class for ProgressBar widget
7 *************************************************************************/
8 /***************************************************************************
9  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining
12  * a copy of this software and associated documentation files (the
13  * "Software"), to deal in the Software without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Software, and to
16  * permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be
20  * included in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  ***************************************************************************/
30 #ifndef _CEGUIProgressBar_h_
31 #define _CEGUIProgressBar_h_
32 
33 #include "../CEGUIBase.h"
34 #include "../CEGUIWindow.h"
35 #include "CEGUIProgressBarProperties.h"
36 
37 
38 #if defined(_MSC_VER)
39 # pragma warning(push)
40 # pragma warning(disable : 4251)
41 #endif
42 
43 
44 // Start of CEGUI namespace section
45 namespace CEGUI
46 {
51 class CEGUIEXPORT ProgressBar : public Window
52 {
53 public:
54  static const String EventNamespace;
55  static const String WidgetTypeName;
56 
57  /*************************************************************************
58  Event name constants
59  *************************************************************************/
71  static const String EventProgressDone;
72 
73 
74  /************************************************************************
75  Accessor Functions
76  ************************************************************************/
81  float getProgress(void) const {return d_progress;}
82 
87  float getStep(void) const {return d_step;}
88 
89 
90  /*************************************************************************
91  Manipulator Functions
92  *************************************************************************/
103  void setProgress(float progress);
104 
105 
116  void setStepSize(float step_val) {d_step = step_val;}
117 
118 
129  void step(void) {setProgress(d_progress + d_step);}
130 
131 
143  void adjustProgress(float delta) {setProgress(d_progress + delta);}
144 
145 
146  /*************************************************************************
147  Construction / Destruction
148  *************************************************************************/
153  ProgressBar(const String& type, const String& name);
154 
155 
160  virtual ~ProgressBar(void);
161 
162 
163 protected:
164  /*************************************************************************
165  Implementation methods
166  *************************************************************************/
177  virtual bool testClassName_impl(const String& class_name) const
178  {
179  if (class_name=="ProgressBar") return true;
180  return Window::testClassName_impl(class_name);
181  }
182 
183 
184  /*************************************************************************
185  Event handlers for progress bar specific events
186  *************************************************************************/
191  virtual void onProgressChanged(WindowEventArgs& e);
192 
193 
198  virtual void onProgressDone(WindowEventArgs& e);
199 
200 
201  /*************************************************************************
202  Implementation Data
203  *************************************************************************/
204  float d_progress;
205  float d_step;
206 
207 
208 private:
209  /*************************************************************************
210  Static Properties for this class
211  *************************************************************************/
212  static ProgressBarProperties::CurrentProgress d_currentProgressProperty;
213  static ProgressBarProperties::StepSize d_stepSizeProperty;
214 
215 
216  /*************************************************************************
217  Private methods
218  *************************************************************************/
219  void addProgressBarProperties(void);
220 };
221 
222 } // End of CEGUI namespace section
223 
224 #if defined(_MSC_VER)
225 # pragma warning(pop)
226 #endif
227 
228 #endif // end of guard _CEGUIProgressBar_h_