Crazy Eddies GUI System 0.7.5
CEGUIProgressBar.h
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  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00010  *
00011  *   Permission is hereby granted, free of charge, to any person obtaining
00012  *   a copy of this software and associated documentation files (the
00013  *   "Software"), to deal in the Software without restriction, including
00014  *   without limitation the rights to use, copy, modify, merge, publish,
00015  *   distribute, sublicense, and/or sell copies of the Software, and to
00016  *   permit persons to whom the Software is furnished to do so, subject to
00017  *   the following conditions:
00018  *
00019  *   The above copyright notice and this permission notice shall be
00020  *   included in all copies or substantial portions of the Software.
00021  *
00022  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00023  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00024  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00025  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00026  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00027  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00028  *   OTHER DEALINGS IN THE SOFTWARE.
00029  ***************************************************************************/
00030 #ifndef _CEGUIProgressBar_h_
00031 #define _CEGUIProgressBar_h_
00032 
00033 #include "../CEGUIBase.h"
00034 #include "../CEGUIWindow.h"
00035 #include "CEGUIProgressBarProperties.h"
00036 
00037 
00038 #if defined(_MSC_VER)
00039 #       pragma warning(push)
00040 #       pragma warning(disable : 4251)
00041 #endif
00042 
00043 
00044 // Start of CEGUI namespace section
00045 namespace CEGUI
00046 {
00051 class CEGUIEXPORT ProgressBar : public Window
00052 {
00053 public:
00054         static const String EventNamespace;                             
00055     static const String WidgetTypeName;             
00056 
00057         /*************************************************************************
00058                 Event name constants
00059         *************************************************************************/
00065         static const String EventProgressChanged;
00071         static const String EventProgressDone;
00072 
00073 
00074         /************************************************************************
00075                 Accessor Functions
00076         ************************************************************************/
00081         float   getProgress(void) const         {return d_progress;}
00082 
00087         float   getStep(void) const                     {return d_step;}
00088 
00089 
00090         /*************************************************************************
00091                 Manipulator Functions
00092         *************************************************************************/
00103         void    setProgress(float progress);
00104 
00105 
00116         void    setStepSize(float step_val)             {d_step = step_val;}
00117 
00118 
00129         void    step(void)                      {setProgress(d_progress + d_step);}
00130 
00131 
00143         void    adjustProgress(float delta)             {setProgress(d_progress + delta);}
00144 
00145 
00146         /*************************************************************************
00147                 Construction / Destruction
00148         *************************************************************************/
00153         ProgressBar(const String& type, const String& name);
00154 
00155 
00160         virtual ~ProgressBar(void);
00161 
00162 
00163 protected:
00164         /*************************************************************************
00165                 Implementation methods
00166         *************************************************************************/
00177         virtual bool    testClassName_impl(const String& class_name) const
00178         {
00179                 if (class_name=="ProgressBar")  return true;
00180                 return Window::testClassName_impl(class_name);
00181         }
00182 
00183 
00184         /*************************************************************************
00185                 Event handlers for progress bar specific events
00186         *************************************************************************/
00191         virtual void    onProgressChanged(WindowEventArgs& e);
00192 
00193 
00198         virtual void    onProgressDone(WindowEventArgs& e);
00199 
00200 
00201         /*************************************************************************
00202                 Implementation Data
00203         *************************************************************************/
00204         float   d_progress;             
00205         float   d_step;                 
00206 
00207 
00208 private:
00209         /*************************************************************************
00210                 Static Properties for this class
00211         *************************************************************************/
00212         static ProgressBarProperties::CurrentProgress   d_currentProgressProperty;
00213         static ProgressBarProperties::StepSize                  d_stepSizeProperty;
00214 
00215 
00216         /*************************************************************************
00217                 Private methods
00218         *************************************************************************/
00219         void    addProgressBarProperties(void);
00220 };
00221 
00222 } // End of  CEGUI namespace section
00223 
00224 #if defined(_MSC_VER)
00225 #       pragma warning(pop)
00226 #endif
00227 
00228 #endif  // end of guard _CEGUIProgressBar_h_