MyGUI: MyGUI_ScrollBar.h Source File

MyGUI 3.4.3

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
13namespace MyGUI
14{
15
16 class ControllerItem;
17
18 using EventHandle_ScrollBarPtrSizeT = delegates::MultiDelegate<ScrollBar*, size_t>;
19
23 class MYGUI_EXPORT ScrollBar : public Widget, public MemberObsolete<ScrollBar>
24 {
25 MYGUI_RTTI_DERIVED(ScrollBar)
26
27 public:
29 void setVerticalAlignment(bool _value);
31 bool getVerticalAlignment() const;
32
34 void setScrollRange(size_t _range);
36 size_t getScrollRange() const;
37
39 void setScrollPosition(size_t _position);
41 size_t getScrollPosition() const;
42
46 void setScrollPage(size_t _value);
48 size_t getScrollPage() const;
49
53 void setScrollViewPage(size_t _value);
55 size_t getScrollViewPage() const;
56
60 void setScrollWheelPage(size_t _value);
62 size_t getScrollWheelPage() const;
63
65 int getLineSize() const;
66
70 void setTrackSize(int _size);
72 int getTrackSize() const;
73
75 void setMinTrackSize(int _value);
77 int getMinTrackSize() const;
78
83 void setMoveToClick(bool _value);
85 bool getMoveToClick() const;
86
90 void setRepeatEnabled(bool enabled);
94 bool getRepeatEnabled() const;
95
97 void setRepeatTriggerTime(float time);
99 float getRepeatTriggerTime(float time) const;
100
102 void setRepeatStepTime(float time);
104 float getRepeatStepTime(float time) const;
105
107 void setPosition(const IntPoint& _point) override;
109 void setSize(const IntSize& _size) override;
111 void setCoord(const IntCoord& _coord) override;
112
113 using Widget::setPosition;
114 using Widget::setSize;
115 using Widget::setCoord;
116
117 /*events:*/
123 EventHandle_ScrollBarPtrSizeT eventScrollChangePosition;
124
125 protected:
126 void initialiseOverride() override;
127 void shutdownOverride() override;
128
129 void updateTrack();
130 void TrackMove(int _left, int _top);
131
132 void onMouseWheel(int _rel) override;
133
134 void notifyMousePressed(Widget* _sender, int _left, int _top, MouseButton _id);
135 void notifyMouseReleased(Widget* _sender, int _left, int _top, MouseButton _id);
136 void notifyMouseDrag(Widget* _sender, int _left, int _top, MouseButton _id);
137 void notifyMouseWheel(Widget* _sender, int _rel);
138
139 void setPropertyOverride(std::string_view _key, std::string_view _value) override;
140
141 int getTrackPlaceLength() const;
142
143 private:
144 void repeatClick(MyGUI::Widget* _widget, MyGUI::ControllerItem* _controller);
145 void widgetStartPressed();
146 void widgetEndPressed();
147 void widgetFirstPartPressed();
148 void widgetSecondPartPressed();
149
150 protected:
151 // наши кнопки
152 Button* mWidgetStart{nullptr};
153 Button* mWidgetEnd{nullptr};
154 Button* mWidgetTrack{nullptr};
155 // куски между кнопками
156 Widget* mWidgetFirstPart{nullptr};
157 Widget* mWidgetSecondPart{nullptr};
158
159 // смещение внутри окна
160 IntPoint mPreActionOffset;
161
162 // диапазон на который трек может двигаться
163 size_t mSkinRangeStart{0};
164 size_t mSkinRangeEnd{0};
165
166 size_t mScrollRange{0};
167 size_t mScrollPosition{0};
168 size_t mScrollPage{0}; // track step, when clicking buttons
169 size_t mScrollViewPage{0}; // track step, when clicking scroll line
170 size_t mScrollWheelPage{0}; // track step, when scrolling with mouse wheel
171
172 bool mEnableRepeat{true}; // Repeat clicks on the scrollbar buttons when the mouse button remains pressed down
173 float mRepeatTriggerTime{0.f}; // Time the mouse button needs to be held for repeating to start
174 float mRepeatStepTime{0.f}; // Time between repeats
175
176 int mMinTrackSize{0};
177 bool mMoveToClick{false};
178
179 bool mVerticalAlignment{true};
180 };
181
182} // namespace MyGUI
183
184#endif // MYGUI_SCROLL_BAR_H_
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition MyGUI_RTTI.h:69
MyGUI_Widget.h
MyGUI::Button
widget description should be here.
Definition MyGUI_Button.h:20
MyGUI::ControllerItem
Definition MyGUI_ControllerItem.h:26
MyGUI::MemberObsolete
Definition MyGUI_DeprecatedTypes.h:14
MyGUI::ScrollBar
widget description should be here.
Definition MyGUI_ScrollBar.h:24
MyGUI::ScrollBar::mScrollViewPage
size_t mScrollViewPage
Definition MyGUI_ScrollBar.h:169
MyGUI::ScrollBar::getMinTrackSize
int getMinTrackSize() const
Definition MyGUI_ScrollBar.cpp:635
MyGUI::ScrollBar::setVerticalAlignment
void setVerticalAlignment(bool _value)
Definition MyGUI_ScrollBar.cpp:661
MyGUI::ScrollBar::setRepeatEnabled
void setRepeatEnabled(bool enabled)
Definition MyGUI_ScrollBar.cpp:402
MyGUI::ScrollBar::eventScrollChangePosition
EventHandle_ScrollBarPtrSizeT eventScrollChangePosition
Definition MyGUI_ScrollBar.h:123
MyGUI::ScrollBar::setMoveToClick
void setMoveToClick(bool _value)
Definition MyGUI_ScrollBar.cpp:640
MyGUI::ScrollBar::shutdownOverride
void shutdownOverride() override
Definition MyGUI_ScrollBar.cpp:93
MyGUI::ScrollBar::mMinTrackSize
int mMinTrackSize
Definition MyGUI_ScrollBar.h:176
MyGUI::ScrollBar::getLineSize
int getLineSize() const
Definition MyGUI_ScrollBar.cpp:423
MyGUI::ScrollBar::setScrollWheelPage
void setScrollWheelPage(size_t _value)
Definition MyGUI_ScrollBar.cpp:621
MyGUI::ScrollBar::initialiseOverride
void initialiseOverride() override
Definition MyGUI_ScrollBar.cpp:18
MyGUI::ScrollBar::setMinTrackSize
void setMinTrackSize(int _value)
Definition MyGUI_ScrollBar.cpp:630
MyGUI::ScrollBar::getScrollPage
size_t getScrollPage() const
Definition MyGUI_ScrollBar.cpp:606
MyGUI::ScrollBar::mScrollWheelPage
size_t mScrollWheelPage
Definition MyGUI_ScrollBar.h:170
MyGUI::ScrollBar::setTrackSize
void setTrackSize(int _size)
Definition MyGUI_ScrollBar.cpp:366
MyGUI::ScrollBar::notifyMousePressed
void notifyMousePressed(Widget *_sender, int _left, int _top, MouseButton _id)
Definition MyGUI_ScrollBar.cpp:255
MyGUI::ScrollBar::setRepeatTriggerTime
void setRepeatTriggerTime(float time)
Definition MyGUI_ScrollBar.cpp:382
MyGUI::ScrollBar::setRepeatStepTime
void setRepeatStepTime(float time)
Definition MyGUI_ScrollBar.cpp:387
MyGUI::ScrollBar::mWidgetFirstPart
Widget * mWidgetFirstPart
Definition MyGUI_ScrollBar.h:156
MyGUI::ScrollBar::getVerticalAlignment
bool getVerticalAlignment() const
Definition MyGUI_ScrollBar.cpp:668
MyGUI::ScrollBar::getRepeatEnabled
bool getRepeatEnabled() const
Definition MyGUI_ScrollBar.cpp:407
MyGUI::ScrollBar::getScrollPosition
size_t getScrollPosition() const
Definition MyGUI_ScrollBar.cpp:596
MyGUI::ScrollBar::mSkinRangeEnd
size_t mSkinRangeEnd
Definition MyGUI_ScrollBar.h:164
MyGUI::ScrollBar::TrackMove
void TrackMove(int _left, int _top)
Definition MyGUI_ScrollBar.cpp:187
MyGUI::ScrollBar::notifyMouseReleased
void notifyMouseReleased(Widget *_sender, int _left, int _top, MouseButton _id)
Definition MyGUI_ScrollBar.cpp:311
MyGUI::ScrollBar::mWidgetSecondPart
Widget * mWidgetSecondPart
Definition MyGUI_ScrollBar.h:157
MyGUI::ScrollBar::mScrollRange
size_t mScrollRange
Definition MyGUI_ScrollBar.h:166
MyGUI::ScrollBar::getScrollViewPage
size_t getScrollViewPage() const
Definition MyGUI_ScrollBar.cpp:616
MyGUI::ScrollBar::setScrollPosition
void setScrollPosition(size_t _position)
Definition MyGUI_ScrollBar.cpp:335
MyGUI::ScrollBar::mScrollPage
size_t mScrollPage
Definition MyGUI_ScrollBar.h:168
MyGUI::ScrollBar::getScrollRange
size_t getScrollRange() const
Definition MyGUI_ScrollBar.cpp:591
MyGUI::ScrollBar::getTrackPlaceLength
int getTrackPlaceLength() const
Definition MyGUI_ScrollBar.cpp:650
MyGUI::ScrollBar::setScrollViewPage
void setScrollViewPage(size_t _value)
Definition MyGUI_ScrollBar.cpp:611
MyGUI::ScrollBar::getMoveToClick
bool getMoveToClick() const
Definition MyGUI_ScrollBar.cpp:645
MyGUI::ScrollBar::setCoord
void setCoord(const IntCoord &_coord) override
Definition MyGUI_ScrollBar.cpp:359
MyGUI::ScrollBar::mVerticalAlignment
bool mVerticalAlignment
Definition MyGUI_ScrollBar.h:179
MyGUI::ScrollBar::mEnableRepeat
bool mEnableRepeat
Definition MyGUI_ScrollBar.h:172
MyGUI::ScrollBar::notifyMouseDrag
void notifyMouseDrag(Widget *_sender, int _left, int _top, MouseButton _id)
Definition MyGUI_ScrollBar.cpp:317
MyGUI::ScrollBar::setSize
void setSize(const IntSize &_size) override
Definition MyGUI_ScrollBar.cpp:352
MyGUI::ScrollBar::getTrackSize
int getTrackSize() const
Definition MyGUI_ScrollBar.cpp:412
MyGUI::ScrollBar::setPosition
void setPosition(const IntPoint &_point) override
Definition MyGUI_ScrollBar.cpp:347
MyGUI::ScrollBar::mWidgetStart
Button * mWidgetStart
Definition MyGUI_ScrollBar.h:152
MyGUI::ScrollBar::mMoveToClick
bool mMoveToClick
Definition MyGUI_ScrollBar.h:177
MyGUI::ScrollBar::onMouseWheel
void onMouseWheel(int _rel) override
Definition MyGUI_ScrollBar.cpp:428
MyGUI::ScrollBar::setScrollRange
void setScrollRange(size_t _range)
Definition MyGUI_ScrollBar.cpp:325
MyGUI::ScrollBar::getRepeatTriggerTime
float getRepeatTriggerTime(float time) const
Definition MyGUI_ScrollBar.cpp:392
MyGUI::ScrollBar::setScrollPage
void setScrollPage(size_t _value)
Definition MyGUI_ScrollBar.cpp:601
MyGUI::ScrollBar::mPreActionOffset
IntPoint mPreActionOffset
Definition MyGUI_ScrollBar.h:160
MyGUI::ScrollBar::getScrollWheelPage
size_t getScrollWheelPage() const
Definition MyGUI_ScrollBar.cpp:625
MyGUI::ScrollBar::mRepeatTriggerTime
float mRepeatTriggerTime
Definition MyGUI_ScrollBar.h:173
MyGUI::ScrollBar::notifyMouseWheel
void notifyMouseWheel(Widget *_sender, int _rel)
Definition MyGUI_ScrollBar.cpp:435
MyGUI::ScrollBar::mWidgetTrack
Button * mWidgetTrack
Definition MyGUI_ScrollBar.h:154
MyGUI::ScrollBar::getRepeatStepTime
float getRepeatStepTime(float time) const
Definition MyGUI_ScrollBar.cpp:397
MyGUI::ScrollBar::mWidgetEnd
Button * mWidgetEnd
Definition MyGUI_ScrollBar.h:153
MyGUI::ScrollBar::updateTrack
void updateTrack()
Definition MyGUI_ScrollBar.cpp:104
MyGUI::ScrollBar::mScrollPosition
size_t mScrollPosition
Definition MyGUI_ScrollBar.h:167
MyGUI::ScrollBar::mRepeatStepTime
float mRepeatStepTime
Definition MyGUI_ScrollBar.h:174
MyGUI::ScrollBar::setPropertyOverride
void setPropertyOverride(std::string_view _key, std::string_view _value) override
Definition MyGUI_ScrollBar.cpp:540
MyGUI::ScrollBar::mSkinRangeStart
size_t mSkinRangeStart
Definition MyGUI_ScrollBar.h:163
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:40
MyGUI::Widget::setSize
void setSize(const IntSize &_size) override
Definition MyGUI_Widget.cpp:693
MyGUI::Widget::setPosition
void setPosition(const IntPoint &_point) override
Definition MyGUI_Widget.cpp:676
MyGUI::Widget::setCoord
void setCoord(const IntCoord &_coord) override
Definition MyGUI_Widget.cpp:730
MyGUI::delegates::MultiDelegate
Definition MyGUI_Delegate.h:190
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::EventHandle_ScrollBarPtrSizeT
delegates::MultiDelegate< ScrollBar *, size_t > EventHandle_ScrollBarPtrSizeT
Definition MyGUI_ScrollBar.h:18
MyGUI::IntPoint
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:27
MyGUI::IntCoord
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36
MyGUI::IntSize
types::TSize< int > IntSize
Definition MyGUI_Types.h:30
MyGUI::MouseButton
Definition MyGUI_MouseButton.h:16