MyGUI_ScrollBar.h
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#ifndef MYGUI_SCROLL_BAR_H_
#define MYGUI_SCROLL_BAR_H_
#include "MyGUI_Prerequest.h"
#include "MyGUI_Widget.h"
namespace MyGUI
{
class ControllerItem;
using EventHandle_ScrollBarPtrSizeT = delegates::MultiDelegate<ScrollBar*, size_t>;
class MYGUI_EXPORT ScrollBar : public Widget, public MemberObsolete<ScrollBar>
{
MYGUI_RTTI_DERIVED(ScrollBar)
public:
void setVerticalAlignment(bool _value);
bool getVerticalAlignment() const;
void setScrollRange(size_t _range);
size_t getScrollRange() const;
void setScrollPosition(size_t _position);
size_t getScrollPosition() const;
void setScrollPage(size_t _value);
size_t getScrollPage() const;
void setScrollViewPage(size_t _value);
size_t getScrollViewPage() const;
void setScrollWheelPage(size_t _value);
size_t getScrollWheelPage() const;
int getLineSize() const;
void setTrackSize(int _size);
int getTrackSize() const;
void setMinTrackSize(int _value);
int getMinTrackSize() const;
void setMoveToClick(bool _value);
bool getMoveToClick() const;
void setRepeatEnabled(bool enabled);
bool getRepeatEnabled() const;
void setRepeatTriggerTime(float time);
float getRepeatTriggerTime(float time) const;
void setRepeatStepTime(float time);
float getRepeatStepTime(float time) const;
void setPosition(const IntPoint& _point) override;
void setSize(const IntSize& _size) override;
void setCoord(const IntCoord& _coord) override;
using Widget::setPosition;
using Widget::setSize;
using Widget::setCoord;
/*events:*/
EventHandle_ScrollBarPtrSizeT eventScrollChangePosition;
protected:
void initialiseOverride() override;
void shutdownOverride() override;
void updateTrack();
void TrackMove(int _left, int _top);
void onMouseWheel(int _rel) override;
void notifyMousePressed(Widget* _sender, int _left, int _top, MouseButton _id);
void notifyMouseReleased(Widget* _sender, int _left, int _top, MouseButton _id);
void notifyMouseDrag(Widget* _sender, int _left, int _top, MouseButton _id);
void notifyMouseWheel(Widget* _sender, int _rel);
void setPropertyOverride(std::string_view _key, std::string_view _value) override;
int getTrackPlaceLength() const;
private:
void repeatClick(MyGUI::Widget* _widget, MyGUI::ControllerItem* _controller);
void widgetStartPressed();
void widgetEndPressed();
void widgetFirstPartPressed();
void widgetSecondPartPressed();
protected:
// наши кнопки
Button* mWidgetStart{nullptr};
Button* mWidgetEnd{nullptr};
Button* mWidgetTrack{nullptr};
// куски между кнопками
Widget* mWidgetFirstPart{nullptr};
Widget* mWidgetSecondPart{nullptr};
// смещение внутри окна
IntPoint mPreActionOffset;
// диапазон на который трек может двигаться
size_t mSkinRangeStart{0};
size_t mSkinRangeEnd{0};
size_t mScrollRange{0};
size_t mScrollPosition{0};
size_t mScrollPage{0}; // track step, when clicking buttons
size_t mScrollViewPage{0}; // track step, when clicking scroll line
size_t mScrollWheelPage{0}; // track step, when scrolling with mouse wheel
bool mEnableRepeat{true}; // Repeat clicks on the scrollbar buttons when the mouse button remains pressed down
float mRepeatTriggerTime{0.f}; // Time the mouse button needs to be held for repeating to start
float mRepeatStepTime{0.f}; // Time between repeats
int mMinTrackSize{0};
bool mMoveToClick{false};
bool mVerticalAlignment{true};
};
} // namespace MyGUI
#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