You.i Engine
YiScrollBarView.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_SCROLL_BAR_VIEW_H_
3 #define _YI_SCROLL_BAR_VIEW_H_
4 
5 #include "view/YiSceneView.h"
6 
7 class CYIScrollBarViewPriv;
8 
31 {
32  friend class CYIScrollBarViewPriv;
33 
34 public:
38  class Listener
39  {
40  public:
41  Listener(){};
42  virtual ~Listener(){};
43 
47  virtual void OnScroll(const CYIScrollBarView *pScrollBar, float percentage) = 0;
48 
52  virtual void OnScrollBegin(const CYIScrollBarView *pScrollBar) = 0;
53 
57  virtual void OnScrollEnd(const CYIScrollBarView *pScrollBar) = 0;
58  };
59 
61  virtual ~CYIScrollBarView();
62 
66  virtual bool Init() override;
67 
68  virtual void FocusLost() override;
69 
76  void ScrollThumbToPosition(float normalizedPosition);
77 
85  void SetThumbPosition(float normalizedPosition);
86 
90  float GetThumbPosition() const;
91 
100  void SetThumbSize(float percentage);
101 
105  float GetThumbSize() const;
106 
110  void AddListener(CYIScrollBarView::Listener *pListener);
111 
116 
120  void SetAutoHideTimeout(uint64_t delayMs);
121 
125  uint64_t GetAutoHideTimeout() const;
126 
130  virtual const CYISceneView::AssetRequirement *GetAssetRequirements(uint32_t *pRequirementCount) override;
131 
135 
136 protected:
137  virtual bool HandleEvent(const std::shared_ptr<CYIEventDispatcher> &pDispatcher, CYIEvent *pEvent) override;
138 
139  virtual void UpdateEnd() override;
140 
141 private:
142  std::unique_ptr<CYIScrollBarViewPriv> m_pPriv;
143 
146 };
147 
150 #endif // _YI_SCROLL_BAR_VIEW_H_
void AddListener(CYIScrollBarView::Listener *pListener)
friend class CYIScrollBarViewPriv
Definition: YiScrollBarView.h:32
virtual bool Init() override
void RemoveListener(CYIScrollBarView::Listener *pListener)
#define YI_DISALLOW_COPY_AND_ASSIGN(TypeName)
Delete the copy constructor and assignment operator (and consequently the move constructor as well) ...
Definition: YiPredef.h:122
Base class for events.
Definition: YiEvent.h:27
The base class for all view types. Views are containers of renderable elements that often define inte...
Definition: YiSceneView.h:47
virtual ~CYIScrollBarView()
CYISignal< float > Scrolled
Emitted as the scroll bar view is moved. The float parameter indicates the current scroll percentage...
Definition: YiScrollBarView.h:132
virtual void OnScrollBegin(const CYIScrollBarView *pScrollBar)=0
CYISignal ScrolledBegin
Emitted when the scroll bar starts to move.
Definition: YiScrollBarView.h:133
void SetThumbPosition(float normalizedPosition)
void ScrollThumbToPosition(float normalizedPosition)
virtual void OnScroll(const CYIScrollBarView *pScrollBar, float percentage)=0
Definition: YiSceneView.h:76
float GetThumbSize() const
virtual bool HandleEvent(const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent) override
virtual void OnScrollEnd(const CYIScrollBarView *pScrollBar)=0
virtual ~Listener()
Definition: YiScrollBarView.h:42
void SetAutoHideTimeout(uint64_t delayMs)
virtual void FocusLost() override
float GetThumbPosition() const
Listener()
Definition: YiScrollBarView.h:41
virtual const CYISceneView::AssetRequirement * GetAssetRequirements(uint32_t *pRequirementCount) override
void SetThumbSize(float percentage)
CYISignal ScrolledEnd
Emitted when the scroll bar has finished moving.
Definition: YiScrollBarView.h:134
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:257
virtual void UpdateEnd() override
uint64_t GetAutoHideTimeout() const
A scrollbar that offers thumb size adjustment, and an auto-hide feature.
Definition: YiScrollBarView.h:30
Interface through which an object can be notified that the thumb of a specific scroll bar was moved...
Definition: YiScrollBarView.h:38