MyGUI 3.2.2

MyGUI_ScrollBar.h
Go to the documentation of this file.
1 /*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7 #ifndef MYGUI_SCROLL_BAR_H_
8 #define MYGUI_SCROLL_BAR_H_
9
10 #include "MyGUI_Prerequest.h"
11 #include "MyGUI_Widget.h"
12
13 namespace MyGUI
14 {
15
16 class ControllerItem;
17
18 typedef delegates::CMultiDelegate2<ScrollBar*, size_t> EventHandle_ScrollBarPtrSizeT;
19
23 class MYGUI_EXPORT ScrollBar :
24 public Widget,
25 public MemberObsolete<ScrollBar>
26 {
27 MYGUI_RTTI_DERIVED( ScrollBar )
28
29 public:
30 ScrollBar();
31
33 void setVerticalAlignment(bool _value);
35 bool getVerticalAlignment() const;
36
38 void setScrollRange(size_t _value);
40 size_t getScrollRange() const;
41
43 void setScrollPosition(size_t _value);
45 size_t getScrollPosition() const;
46
50 void setScrollPage(size_t _value);
52 size_t getScrollPage() const;
53
57 void setScrollViewPage(size_t _value);
59 size_t getScrollViewPage() const;
60
64 void setScrollWheelPage(size_t _value);
66 size_t getScrollWheelPage() const;
67
69 int getLineSize() const;
70
74 void setTrackSize(int _value);
76 int getTrackSize() const;
77
79 void setMinTrackSize(int _value);
81 int getMinTrackSize() const;
82
87 void setMoveToClick(bool _value);
89 bool getMoveToClick() const;
90
94 void setRepeatEnabled(bool enabled);
98 bool getRepeatEnabled() const;
99
101 void setRepeatTriggerTime(float time);
103 float getRepeatTriggerTime(float time) const;
104
106 void setRepeatStepTime(float time);
108 float getRepeatStepTime(float time) const;
109
111 virtual void setPosition(const IntPoint& _value);
113 virtual void setSize(const IntSize& _value);
115 virtual void setCoord(const IntCoord& _value);
116
118 void setPosition(int _left, int _top);
120 void setSize(int _width, int _height);
122 void setCoord(int _left, int _top, int _width, int _height);
123
124 /*events:*/
130 EventHandle_ScrollBarPtrSizeT eventScrollChangePosition;
131
132 protected:
133 virtual void initialiseOverride();
134 virtual void shutdownOverride();
135
136 void updateTrack();
137 void TrackMove(int _left, int _top);
138
139 virtual void onMouseWheel(int _rel);
140
141 void notifyMousePressed(Widget* _sender, int _left, int _top, MouseButton _id);
142 void notifyMouseReleased(Widget* _sender, int _left, int _top, MouseButton _id);
143 void notifyMouseDrag(Widget* _sender, int _left, int _top, MouseButton _id);
144 void notifyMouseWheel(Widget* _sender, int _rel);
145
146 virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
147
148 int getTrackPlaceLength() const;
149
150 private:
151 void repeatClick(MyGUI::Widget* _widget, MyGUI::ControllerItem* _controller);
152 void widgetStartPressed();
153 void widgetEndPressed();
154 void widgetFirstPartPressed();
155 void widgetSecondPartPressed();
156
157 protected:
158 // наши кнопки
159 Button* mWidgetStart;
160 Button* mWidgetEnd;
161 Button* mWidgetTrack;
162 // куски между кнопками
163 Widget* mWidgetFirstPart;
164 Widget* mWidgetSecondPart;
165
166 // смещение внутри окна
167 IntPoint mPreActionOffset;
168
169 // диапазон на который трек может двигаться
170 size_t mSkinRangeStart;
171 size_t mSkinRangeEnd;
172
173 size_t mScrollRange;
174 size_t mScrollPosition;
175 size_t mScrollPage; // track step, when clicking buttons
176 size_t mScrollViewPage; // track step, when clicking scroll line
177 size_t mScrollWheelPage; // track step, when scrolling with mouse wheel
178
179 bool mEnableRepeat; // Repeat clicks on the scrollbar buttons when the mouse button remains pressed down
180 float mRepeatTriggerTime; // Time the mouse button needs to be held for repeating to start
181 float mRepeatStepTime; // Time between repeats
182
183 int mMinTrackSize;
184 bool mMoveToClick;
185
186 bool mVerticalAlignment;
187 };
188
189 } // namespace MyGUI
190
191 #endif // MYGUI_SCROLL_BAR_H_
MyGUI::types::TCoord< int >
MyGUI::ScrollBar::mScrollWheelPage
size_t mScrollWheelPage
Definition: MyGUI_ScrollBar.h:177
MyGUI::Widget
Widget properties. Widget_skin_childs Skin childs. Widget widget description should be here...
Definition: MyGUI_Widget.h:29
MyGUI::ScrollBar::mScrollViewPage
size_t mScrollViewPage
Definition: MyGUI_ScrollBar.h:176
MyGUI::ScrollBar::eventScrollChangePosition
EventHandle_ScrollBarPtrSizeT eventScrollChangePosition
Definition: MyGUI_ScrollBar.h:130
MyGUI::types::TPoint< int >
MyGUI_Prerequest.h
MyGUI::ScrollBar::mScrollRange
size_t mScrollRange
Definition: MyGUI_ScrollBar.h:173
MyGUI::types::TSize< int >
MyGUI::ScrollBar::mPreActionOffset
IntPoint mPreActionOffset
Definition: MyGUI_ScrollBar.h:167
MyGUI::ScrollBar::mMoveToClick
bool mMoveToClick
Definition: MyGUI_ScrollBar.h:184
MyGUI::ScrollBar::mWidgetSecondPart
Widget * mWidgetSecondPart
Definition: MyGUI_ScrollBar.h:164
MyGUI::ScrollBar::mSkinRangeStart
size_t mSkinRangeStart
Definition: MyGUI_ScrollBar.h:170
MyGUI::ScrollBar::mVerticalAlignment
bool mVerticalAlignment
Definition: MyGUI_ScrollBar.h:186
MyGUI::ScrollBar::mRepeatStepTime
float mRepeatStepTime
Definition: MyGUI_ScrollBar.h:181
MyGUI::MouseButton
Definition: MyGUI_MouseButton.h:15
MyGUI::Button
Button properties. Button_skin_childs Skin childs. Button widget description should be here...
Definition: MyGUI_Button.h:19
MyGUI
Definition: MyGUI_ActionController.h:14
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition: MyGUI_RTTI.h:65
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition: MyGUI_Platform.h:103
MyGUI::ScrollBar::mScrollPage
size_t mScrollPage
Definition: MyGUI_ScrollBar.h:175
MyGUI::ScrollBar::mEnableRepeat
bool mEnableRepeat
Definition: MyGUI_ScrollBar.h:179
MyGUI::delegates::CMultiDelegate2< ScrollBar *, size_t >
MyGUI::ScrollBar::mSkinRangeEnd
size_t mSkinRangeEnd
Definition: MyGUI_ScrollBar.h:171
MyGUI::ScrollBar::mScrollPosition
size_t mScrollPosition
Definition: MyGUI_ScrollBar.h:174
MyGUI::ScrollBar::mRepeatTriggerTime
float mRepeatTriggerTime
Definition: MyGUI_ScrollBar.h:180
MyGUI_Widget.h
MyGUI::ScrollBar::mMinTrackSize
int mMinTrackSize
Definition: MyGUI_ScrollBar.h:183
MyGUI::ControllerItem
Definition: MyGUI_ControllerItem.h:25
MyGUI::MemberObsolete
Definition: MyGUI_DeprecatedTypes.h:13
MyGUI::ScrollBar::mWidgetStart
Button * mWidgetStart
Definition: MyGUI_ScrollBar.h:159
MyGUI::EventHandle_ScrollBarPtrSizeT
delegates::CMultiDelegate2< ScrollBar *, size_t > EventHandle_ScrollBarPtrSizeT
Definition: MyGUI_ScrollBar.h:16
MyGUI::ScrollBar::mWidgetFirstPart
Widget * mWidgetFirstPart
Definition: MyGUI_ScrollBar.h:163
MyGUI::ScrollBar::mWidgetTrack
Button * mWidgetTrack
Definition: MyGUI_ScrollBar.h:161
MyGUI::ScrollBar
ScrollBar properties. ScrollBar_skin_childs Skin childs. ScrollBar widget description should be here...
Definition: MyGUI_ScrollBar.h:23
MyGUI::ScrollBar::mWidgetEnd
Button * mWidgetEnd
Definition: MyGUI_ScrollBar.h:160