Crazy Eddies GUI System  0.6.0
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 "elements/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  *************************************************************************/
61  static const String EventProgressDone;
62 
63 
64  /************************************************************************
65  Accessor Functions
66  ************************************************************************/
71  float getProgress(void) const {return d_progress;}
72 
77  float getStep(void) const {return d_step;}
78 
79 
80  /*************************************************************************
81  Manipulator Functions
82  *************************************************************************/
93  void setProgress(float progress);
94 
95 
106  void setStepSize(float step_val) {d_step = step_val;}
107 
108 
119  void step(void) {setProgress(d_progress + d_step);}
120 
121 
133  void adjustProgress(float delta) {setProgress(d_progress + delta);}
134 
135 
136  /*************************************************************************
137  Construction / Destruction
138  *************************************************************************/
143  ProgressBar(const String& type, const String& name);
144 
145 
150  virtual ~ProgressBar(void);
151 
152 
153 protected:
154  /*************************************************************************
155  Implementation methods
156  *************************************************************************/
167  virtual bool testClassName_impl(const String& class_name) const
168  {
169  if (class_name=="ProgressBar") return true;
170  return Window::testClassName_impl(class_name);
171  }
172 
173 
174  /*************************************************************************
175  Event handlers for progress bar specific events
176  *************************************************************************/
181  virtual void onProgressChanged(WindowEventArgs& e);
182 
183 
188  virtual void onProgressDone(WindowEventArgs& e);
189 
190 
191  /*************************************************************************
192  Implementation Data
193  *************************************************************************/
194  float d_progress;
195  float d_step;
196 
197 
198 private:
199  /*************************************************************************
200  Static Properties for this class
201  *************************************************************************/
202  static ProgressBarProperties::CurrentProgress d_currentProgressProperty;
203  static ProgressBarProperties::StepSize d_stepSizeProperty;
204 
205 
206  /*************************************************************************
207  Private methods
208  *************************************************************************/
209  void addProgressBarProperties(void);
210 };
211 
212 } // End of CEGUI namespace section
213 
214 #if defined(_MSC_VER)
215 # pragma warning(pop)
216 #endif
217 
218 #endif // end of guard _CEGUIProgressBar_h_