MyGUI  3.0.1
MyGUI_Progress.h
Go to the documentation of this file.
1 
7 /*
8  This file is part of MyGUI.
9 
10  MyGUI is free software: you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  MyGUI is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22 */
23 #ifndef __MYGUI_PROGRESS_H__
24 #define __MYGUI_PROGRESS_H__
25 
26 #include "MyGUI_Prerequest.h"
27 #include "MyGUI_Align.h"
28 #include "MyGUI_Widget.h"
29 
30 namespace MyGUI
31 {
32 
34  public Widget
35  {
37 
38  public:
39  Progress();
40 
42  void setProgressRange(size_t _value);
44  size_t getProgressRange() { return mRange; }
45 
47  void setProgressPosition(size_t _value);
49  size_t getProgressPosition() { return mEndPosition; }
50 
52  void setProgressAutoTrack(bool _value);
54  bool getProgressAutoTrack() { return mAutoTrack; }
55 
59  void setProgressStartPoint(Align _value);
61  Align getProgressStartPoint() { return mStartPoint; }
62 
64  virtual void setPosition(const IntPoint& _value);
66  virtual void setSize(const IntSize& _value);
68  virtual void setCoord(const IntCoord& _value);
69 
71  void setPosition(int _left, int _top) { setPosition(IntPoint(_left, _top)); }
73  void setSize(int _width, int _height) { setSize(IntSize(_width, _height)); }
75  void setCoord(int _left, int _top, int _width, int _height) { setCoord(IntCoord(_left, _top, _width, _height)); }
76 
78  virtual void setProperty(const std::string& _key, const std::string& _value);
79 
80  /*obsolete:*/
81 #ifndef MYGUI_DONT_USE_OBSOLETE
82 
83  MYGUI_OBSOLETE("use : void Widget::setCoord(const IntCoord& _coord)")
84  void setPosition(const IntCoord& _coord) { setCoord(_coord); }
85  MYGUI_OBSOLETE("use : void Widget::setCoord(int _left, int _top, int _width, int _height)")
86  void setPosition(int _left, int _top, int _width, int _height) { setCoord(_left, _top, _width, _height); }
87 
88 #endif // MYGUI_DONT_USE_OBSOLETE
89 
90  /*internal:*/
91  virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
92 
93  protected:
94  virtual ~Progress();
95 
96  void baseChangeWidgetSkin(ResourceSkin* _info);
97 
98  private:
99  void initialiseWidgetSkin(ResourceSkin* _info);
100  void shutdownWidgetSkin();
101 
102  void frameEntered(float _time);
103  void updateTrack();
104 
105  int getClientWidth() { return ((mStartPoint.isLeft()) || (mStartPoint.isRight())) ? mClient->getWidth() : mClient->getHeight(); }
106  int getClientHeight() { return ((mStartPoint.isLeft()) || (mStartPoint.isRight())) ? mClient->getHeight() : mClient->getWidth(); }
107 
108  void setTrackPosition(Widget* _widget, int _left, int _top, int _width, int _height);
109 
110  private:
111  std::string mTrackSkin;
112  int mTrackWidth;
113  int mTrackStep;
114  int mTrackMin;
115 
116  VectorWidgetPtr mVectorTrack;
117  size_t mRange;
118  size_t mStartPosition, mEndPosition;
119  float mAutoPosition;
120  bool mAutoTrack;
121  bool mFillTrack;
122 
123  Align mStartPoint;
124 
125  Widget* mClient;
126 
127  };
128 
129 } // namespace MyGUI
130 
131 #endif // __MYGUI_PROGRESS_H__