Crazy Eddie's GUI System  0.8.5
widgets/ProgressBar.h
1 /***********************************************************************
2  created: 13/4/2004
3  author: Paul D Turner
4 
5  purpose: Interface to base class for ProgressBar widget
6 *************************************************************************/
7 /***************************************************************************
8  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  ***************************************************************************/
29 #ifndef _CEGUIProgressBar_h_
30 #define _CEGUIProgressBar_h_
31 
32 #include "../Base.h"
33 #include "../Window.h"
34 
35 
36 #if defined(_MSC_VER)
37 # pragma warning(push)
38 # pragma warning(disable : 4251)
39 #endif
40 
41 
42 // Start of CEGUI namespace section
43 namespace CEGUI
44 {
49 class CEGUIEXPORT ProgressBar : public Window
50 {
51 public:
52  static const String EventNamespace;
53  static const String WidgetTypeName;
54 
55  /*************************************************************************
56  Event name constants
57  *************************************************************************/
69  static const String EventProgressDone;
70 
71 
72  /************************************************************************
73  Accessor Functions
74  ************************************************************************/
79  float getProgress(void) const {return d_progress;}
80 
85  float getStepSize(void) const {return d_step;}
86 
87 
88  /*************************************************************************
89  Manipulator Functions
90  *************************************************************************/
101  void setProgress(float progress);
102 
103 
114  void setStepSize(float step_val) {d_step = step_val;}
115 
116 
127  void step(void) {setProgress(d_progress + d_step);}
128 
129 
141  void adjustProgress(float delta) {setProgress(d_progress + delta);}
142 
143 
144  /*************************************************************************
145  Construction / Destruction
146  *************************************************************************/
151  ProgressBar(const String& type, const String& name);
152 
153 
158  virtual ~ProgressBar(void);
159 
160 
161 protected:
162  /*************************************************************************
163  Event handlers for progress bar specific events
164  *************************************************************************/
169  virtual void onProgressChanged(WindowEventArgs& e);
170 
171 
176  virtual void onProgressDone(WindowEventArgs& e);
177 
178 
179  /*************************************************************************
180  Implementation Data
181  *************************************************************************/
182  float d_progress;
183  float d_step;
184 
185 
186 private:
187  /*************************************************************************
188  Private methods
189  *************************************************************************/
190  void addProgressBarProperties(void);
191 };
192 
193 } // End of CEGUI namespace section
194 
195 #if defined(_MSC_VER)
196 # pragma warning(pop)
197 #endif
198 
199 #endif // end of guard _CEGUIProgressBar_h_
static const String WidgetTypeName
Window factory name.
Definition: widgets/ProgressBar.h:53
float getProgress(void) const
return the current progress value
Definition: widgets/ProgressBar.h:79
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
Base class for progress bars.
Definition: widgets/ProgressBar.h:49
void setStepSize(float step_val)
set the size of the 'step' in percentage points (default is 0.01f or 1%).
Definition: widgets/ProgressBar.h:114
float d_progress
current progress (from 0.0f to 1.0f)
Definition: widgets/ProgressBar.h:182
void adjustProgress(float delta)
Modify the progress level by a specified delta.
Definition: widgets/ProgressBar.h:141
void step(void)
cause the progress to step
Definition: widgets/ProgressBar.h:127
float d_step
amount to 'step' progress by on a call to step()
Definition: widgets/ProgressBar.h:183
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:149
float getStepSize(void) const
return the current step size
Definition: widgets/ProgressBar.h:85
static const String EventProgressDone
Definition: widgets/ProgressBar.h:69
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: InputEvent.h:251
static const String EventProgressChanged
Definition: widgets/ProgressBar.h:63
String class used within the GUI system.
Definition: String.h:62
static const String EventNamespace
Namespace for global events.
Definition: widgets/ProgressBar.h:52