33 virtual void Create()
override;
35 virtual void Tick(
float deltaTime)
override;
39 void SetScrollOffset(glm::vec2 offset);
40 glm::vec2 GetScrollOffset()
const;
41 void SetScrollOffsetX(
float x);
42 void SetScrollOffsetY(
float y);
44 void ScrollToBottom();
57 void SetScrollbarWidth(
float width);
58 float GetScrollbarWidth()
const;
61 void SetScrollSpeed(
float speed);
62 float GetScrollSpeed()
const;
63 void SetMomentumEnabled(
bool enabled);
64 bool IsMomentumEnabled()
const;
65 void SetMomentumFriction(
float friction);
66 float GetMomentumFriction()
const;
69 bool CanScrollHorizontally()
const;
70 bool CanScrollVertically()
const;
71 glm::vec2 GetContentSize()
const;
72 glm::vec2 GetMaxScrollOffset()
const;
73 bool IsDragging()
const;
74 bool IsScrolling()
const;
77 void SetChildInputPriority(
bool priority);
78 bool GetChildInputPriority()
const;
81 Widget* GetContentWidget();
88 void SetContentWidget(
Widget* widget);
91 void SetScrollbarColor(glm::vec4 color);
92 glm::vec4 GetScrollbarColor()
const;
93 void SetScrollbarHoveredColor(glm::vec4 color);
94 glm::vec4 GetScrollbarHoveredColor()
const;
95 void SetScrollbarTrackColor(glm::vec4 color);
96 glm::vec4 GetScrollbarTrackColor()
const;
99 void SetScrollbarTexture(
Texture* texture);
100 Texture* GetScrollbarTexture();
101 void SetTrackTexture(
Texture* texture);
105 void SetShowScrollButtons(
bool show);
106 bool GetShowScrollButtons()
const;
107 void SetButtonSize(
float size);
108 float GetButtonSize()
const;
109 void SetUpButtonTexture(
Texture* texture);
111 void SetDownButtonTexture(
Texture* texture);
112 Texture* GetDownButtonTexture();
113 void SetLeftButtonTexture(
Texture* texture);
114 Texture* GetLeftButtonTexture();
115 void SetRightButtonTexture(
Texture* texture);
116 Texture* GetRightButtonTexture();
117 void SetButtonColor(glm::vec4 color);
118 glm::vec4 GetButtonColor()
const;
121 Quad* GetHScrollbar();
122 Quad* GetVScrollbar();
134 void UpdateScrollbars();
135 void UpdateContentPosition();
136 void UpdateScrollButtons();
137 void ClampScrollOffset();
138 void HandleInput(
float deltaTime);
139 void HandleMomentum(
float deltaTime);
140 void HandleButtonInput();
141 bool ShouldShowHScrollbar()
const;
142 bool ShouldShowVScrollbar()
const;
143 bool IsPointerOverChildWidget(
float x,
float y)
const;
146 glm::vec2 mScrollOffset = glm::vec2(0.0f);
147 glm::vec2 mScrollVelocity = glm::vec2(0.0f);
148 glm::vec2 mDragStartOffset = glm::vec2(0.0f);
149 glm::vec2 mDragStartMouse = glm::vec2(0.0f);
150 glm::vec2 mLastMousePos = glm::vec2(0.0f);
158 float mScrollSpeed = 30.0f;
159 float mMomentumFriction = 5.0f;
160 bool mMomentumEnabled =
true;
163 float mScrollbarWidth = 8.0f;
164 float mButtonSize = 16.0f;
165 bool mShowScrollButtons =
false;
168 glm::vec4 mScrollbarColor = glm::vec4(0.5f, 0.5f, 0.5f, 0.8f);
169 glm::vec4 mScrollbarHoveredColor = glm::vec4(0.7f, 0.7f, 0.7f, 1.0f);
170 glm::vec4 mScrollbarTrackColor = glm::vec4(0.2f, 0.2f, 0.2f, 0.5f);
171 glm::vec4 mButtonColor = glm::vec4(0.4f, 0.4f, 0.4f, 1.0f);
182 bool mDragging =
false;
183 bool mDraggingHScrollbar =
false;
184 bool mDraggingVScrollbar =
false;
185 bool mHScrollbarHovered =
false;
186 bool mVScrollbarHovered =
false;
189 bool mChildInputPriority =
false;
192 glm::vec2 mCachedContentSize = glm::vec2(0.0f);
203 Quad* mHScrollbarTrack =
nullptr;
204 Quad* mHScrollbarGrabber =
nullptr;
205 Quad* mVScrollbarTrack =
nullptr;
206 Quad* mVScrollbarGrabber =
nullptr;