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 "elements/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 *************************************************************************/ 00060 static const String EventProgressChanged; 00061 static const String EventProgressDone; 00062 00063 00064 /************************************************************************ 00065 Accessor Functions 00066 ************************************************************************/ 00071 float getProgress(void) const {return d_progress;} 00072 00077 float getStep(void) const {return d_step;} 00078 00079 00080 /************************************************************************* 00081 Manipulator Functions 00082 *************************************************************************/ 00093 void setProgress(float progress); 00094 00095 00106 void setStepSize(float step_val) {d_step = step_val;} 00107 00108 00119 void step(void) {setProgress(d_progress + d_step);} 00120 00121 00133 void adjustProgress(float delta) {setProgress(d_progress + delta);} 00134 00135 00136 /************************************************************************* 00137 Construction / Destruction 00138 *************************************************************************/ 00143 ProgressBar(const String& type, const String& name); 00144 00145 00150 virtual ~ProgressBar(void); 00151 00152 00153 protected: 00154 /************************************************************************* 00155 Implementation methods 00156 *************************************************************************/ 00167 virtual bool testClassName_impl(const String& class_name) const 00168 { 00169 if (class_name=="ProgressBar") return true; 00170 return Window::testClassName_impl(class_name); 00171 } 00172 00173 00174 /************************************************************************* 00175 Event handlers for progress bar specific events 00176 *************************************************************************/ 00181 virtual void onProgressChanged(WindowEventArgs& e); 00182 00183 00188 virtual void onProgressDone(WindowEventArgs& e); 00189 00190 00191 /************************************************************************* 00192 Implementation Data 00193 *************************************************************************/ 00194 float d_progress; 00195 float d_step; 00196 00197 00198 private: 00199 /************************************************************************* 00200 Static Properties for this class 00201 *************************************************************************/ 00202 static ProgressBarProperties::CurrentProgress d_currentProgressProperty; 00203 static ProgressBarProperties::StepSize d_stepSizeProperty; 00204 00205 00206 /************************************************************************* 00207 Private methods 00208 *************************************************************************/ 00209 void addProgressBarProperties(void); 00210 }; 00211 00212 } // End of CEGUI namespace section 00213 00214 #if defined(_MSC_VER) 00215 # pragma warning(pop) 00216 #endif 00217 00218 #endif // end of guard _CEGUIProgressBar_h_