MyGUI
3.0.3
|
00001 00007 /* 00008 This file is part of MyGUI. 00009 00010 MyGUI is free software: you can redistribute it and/or modify 00011 it under the terms of the GNU Lesser General Public License as published by 00012 the Free Software Foundation, either version 3 of the License, or 00013 (at your option) any later version. 00014 00015 MyGUI is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public License 00021 along with MyGUI. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 #ifndef __MYGUI_PROGRESS_H__ 00024 #define __MYGUI_PROGRESS_H__ 00025 00026 #include "MyGUI_Prerequest.h" 00027 #include "MyGUI_Align.h" 00028 #include "MyGUI_Widget.h" 00029 00030 namespace MyGUI 00031 { 00032 00033 class MYGUI_EXPORT Progress : 00034 public Widget 00035 { 00036 MYGUI_RTTI_DERIVED( Progress ) 00037 00038 public: 00039 Progress(); 00040 00042 void setProgressRange(size_t _value); 00044 size_t getProgressRange() { return mRange; } 00045 00047 void setProgressPosition(size_t _value); 00049 size_t getProgressPosition() { return mEndPosition; } 00050 00052 void setProgressAutoTrack(bool _value); 00054 bool getProgressAutoTrack() { return mAutoTrack; } 00055 00059 void setProgressStartPoint(Align _value); 00061 Align getProgressStartPoint() { return mStartPoint; } 00062 00064 virtual void setPosition(const IntPoint& _value); 00066 virtual void setSize(const IntSize& _value); 00068 virtual void setCoord(const IntCoord& _value); 00069 00071 void setPosition(int _left, int _top) { setPosition(IntPoint(_left, _top)); } 00073 void setSize(int _width, int _height) { setSize(IntSize(_width, _height)); } 00075 void setCoord(int _left, int _top, int _width, int _height) { setCoord(IntCoord(_left, _top, _width, _height)); } 00076 00078 virtual void setProperty(const std::string& _key, const std::string& _value); 00079 00080 /*obsolete:*/ 00081 #ifndef MYGUI_DONT_USE_OBSOLETE 00082 00083 MYGUI_OBSOLETE("use : void Widget::setCoord(const IntCoord& _coord)") 00084 void setPosition(const IntCoord& _coord) { setCoord(_coord); } 00085 MYGUI_OBSOLETE("use : void Widget::setCoord(int _left, int _top, int _width, int _height)") 00086 void setPosition(int _left, int _top, int _width, int _height) { setCoord(_left, _top, _width, _height); } 00087 00088 #endif // MYGUI_DONT_USE_OBSOLETE 00089 00090 /*internal:*/ 00091 virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name); 00092 00093 protected: 00094 virtual ~Progress(); 00095 00096 void baseChangeWidgetSkin(ResourceSkin* _info); 00097 00098 private: 00099 void initialiseWidgetSkin(ResourceSkin* _info); 00100 void shutdownWidgetSkin(); 00101 00102 void frameEntered(float _time); 00103 void updateTrack(); 00104 00105 int getClientWidth() { return ((mStartPoint.isLeft()) || (mStartPoint.isRight())) ? mClient->getWidth() : mClient->getHeight(); } 00106 int getClientHeight() { return ((mStartPoint.isLeft()) || (mStartPoint.isRight())) ? mClient->getHeight() : mClient->getWidth(); } 00107 00108 void setTrackPosition(Widget* _widget, int _left, int _top, int _width, int _height); 00109 00110 private: 00111 std::string mTrackSkin; 00112 int mTrackWidth; 00113 int mTrackStep; 00114 int mTrackMin; 00115 00116 VectorWidgetPtr mVectorTrack; 00117 size_t mRange; 00118 size_t mStartPosition, mEndPosition; 00119 float mAutoPosition; 00120 bool mAutoTrack; 00121 bool mFillTrack; 00122 00123 Align mStartPoint; 00124 00125 Widget* mClient; 00126 00127 }; 00128 00129 } // namespace MyGUI 00130 00131 #endif // __MYGUI_PROGRESS_H__