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();
84 void SetScrollbarColor(glm::vec4 color);
85 glm::vec4 GetScrollbarColor()
const;
86 void SetScrollbarHoveredColor(glm::vec4 color);
87 glm::vec4 GetScrollbarHoveredColor()
const;
88 void SetScrollbarTrackColor(glm::vec4 color);
89 glm::vec4 GetScrollbarTrackColor()
const;
92 void SetScrollbarTexture(
Texture* texture);
94 void SetTrackTexture(
Texture* texture);
98 void SetShowScrollButtons(
bool show);
99 bool GetShowScrollButtons()
const;
100 void SetButtonSize(
float size);
101 float GetButtonSize()
const;
102 void SetUpButtonTexture(
Texture* texture);
104 void SetDownButtonTexture(
Texture* texture);
105 Texture* GetDownButtonTexture();
106 void SetLeftButtonTexture(
Texture* texture);
107 Texture* GetLeftButtonTexture();
108 void SetRightButtonTexture(
Texture* texture);
109 Texture* GetRightButtonTexture();
110 void SetButtonColor(glm::vec4 color);
111 glm::vec4 GetButtonColor()
const;
114 Quad* GetHScrollbar();
115 Quad* GetVScrollbar();
127 void UpdateScrollbars();
128 void UpdateContentPosition();
129 void UpdateScrollButtons();
130 void ClampScrollOffset();
131 void HandleInput(
float deltaTime);
132 void HandleMomentum(
float deltaTime);
133 void HandleButtonInput();
134 bool ShouldShowHScrollbar()
const;
135 bool ShouldShowVScrollbar()
const;
136 bool IsPointerOverChildWidget(
float x,
float y)
const;
139 glm::vec2 mScrollOffset = glm::vec2(0.0f);
140 glm::vec2 mScrollVelocity = glm::vec2(0.0f);
141 glm::vec2 mDragStartOffset = glm::vec2(0.0f);
142 glm::vec2 mDragStartMouse = glm::vec2(0.0f);
143 glm::vec2 mLastMousePos = glm::vec2(0.0f);
151 float mScrollSpeed = 30.0f;
152 float mMomentumFriction = 5.0f;
153 bool mMomentumEnabled =
true;
156 float mScrollbarWidth = 8.0f;
157 float mButtonSize = 16.0f;
158 bool mShowScrollButtons =
false;
161 glm::vec4 mScrollbarColor = glm::vec4(0.5f, 0.5f, 0.5f, 0.8f);
162 glm::vec4 mScrollbarHoveredColor = glm::vec4(0.7f, 0.7f, 0.7f, 1.0f);
163 glm::vec4 mScrollbarTrackColor = glm::vec4(0.2f, 0.2f, 0.2f, 0.5f);
164 glm::vec4 mButtonColor = glm::vec4(0.4f, 0.4f, 0.4f, 1.0f);
175 bool mDragging =
false;
176 bool mDraggingHScrollbar =
false;
177 bool mDraggingVScrollbar =
false;
178 bool mHScrollbarHovered =
false;
179 bool mVScrollbarHovered =
false;
182 bool mChildInputPriority =
false;
185 glm::vec2 mCachedContentSize = glm::vec2(0.0f);
188 Quad* mHScrollbarTrack =
nullptr;
189 Quad* mHScrollbarGrabber =
nullptr;
190 Quad* mVScrollbarTrack =
nullptr;
191 Quad* mVScrollbarGrabber =
nullptr;