UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ScrollBox.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
8#include "Widgets/SWidget.h"
11#include "Containers/Ticker.h"
12#include "ScrollBox.generated.h"
13
18
22UCLASS(MinimalAPI)
24{
26
27private:
28
29 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, Category = "Scroll", meta = (AllowPrivateAccess = "true", DisplayAfter = "bAnimateWheelScrolling"))
30 float ScrollAnimationInterpolationSpeed = 15.f;
31
33 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter="GetIsTouchScrollingEnabled", Setter="SetIsTouchScrollingEnabled", Category = "Scroll", meta = (AllowPrivateAccess = "true", DisplayAfter = "WheelScrollMultiplier"))
34 bool bEnableTouchScrolling = true;
35
37 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter = "GetConsumePointerInput", Setter = "SetConsumePointerInput", Category = "Scroll", meta = (AllowPrivateAccess = "true", DisplayAfter = "bEnableTouchScrolling"))
38 bool bConsumePointerInput = true;
39
41 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter = "GetAnalogMouseWheelKey", Setter = "SetAnalogMouseWheelKey", Category = "Scroll", meta = (AllowPrivateAccess = "true", DisplayAfter = "bConsumePointerInput"))
42 FKey AnalogMouseWheelKey;
43
45 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter = "GetIsFocusable", Setter = "SetIsFocusable", Category = "Scroll", meta = (AllowPrivateAccess = "true", DisplayAfter = "AnalogMouseWheelKey"))
46 bool bIsFocusable;
47
48public:
49
50 UE_DEPRECATED(5.2, "Direct access to WidgetStyle is deprecated. Please use the getter or setter.")
52 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, Category="Style", meta=( DisplayName="Style" ))
53 FScrollBoxStyle WidgetStyle;
54
55 UE_DEPRECATED(5.2, "Direct access to WidgetBarStyle is deprecated. Please use the getter or setter.")
57 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, Category="Style", meta=( DisplayName="Bar Style" ))
58 FScrollBarStyle WidgetBarStyle;
59
60 UE_DEPRECATED(5.2, "Direct access to Orientation is deprecated. Please use the getter or setter.")
62 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintSetter = "SetOrientation", Category="Scroll")
64
65 UE_DEPRECATED(5.2, "Direct access to ScrollBarVisibility is deprecated. Please use the getter or setter.")
67 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintSetter = "SetScrollBarVisibility", Category="Scroll")
68 ESlateVisibility ScrollBarVisibility;
69
70 UE_DEPRECATED(5.2, "Direct access to ConsumeMouseWheel is deprecated. Please use the getter or setter.")
72 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintSetter = "SetConsumeMouseWheel", Category = "Scroll")
73 EConsumeMouseWheel ConsumeMouseWheel;
74
75 UE_DEPRECATED(5.2, "Direct access to ScrollbarThickness is deprecated. Please use the getter or setter.")
77 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintSetter = "SetScrollbarThickness", Category="Scroll")
78 FVector2D ScrollbarThickness;
79
80 UE_DEPRECATED(5.2, "Direct access to ScrollbarPadding is deprecated. Please use the getter or setter.")
82 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintSetter = "SetScrollbarPadding", Category = "Scroll")
83 FMargin ScrollbarPadding;
84
86 UE_DEPRECATED(5.2, "Direct access to AlwaysShowScrollbar is deprecated. Please use the getter or setter.")
87 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter = "IsAlwaysShowScrollbar", Setter, BlueprintSetter = "SetAlwaysShowScrollbar", Category = "Scroll")
88 bool AlwaysShowScrollbar;
89
91 UE_DEPRECATED(5.2, "Direct access to AlwaysShowScrollbarTrack is deprecated. Please use the getter or setter.")
92 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter = "IsAlwaysShowScrollbarTrack", Setter, Category = "Scroll")
93 bool AlwaysShowScrollbarTrack;
94
95 UE_DEPRECATED(5.2, "Direct access to AllowOverscroll is deprecated. Please use the getter or setter.")
97 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter = "IsAllowOverscroll", Setter, BlueprintSetter = "SetAllowOverscroll", Category = "Scroll")
98 bool AllowOverscroll;
99
100 UE_DEPRECATED(5.2, "Direct access to BackPadScrolling is deprecated. Please use the getter. Note that BackPadScrolling is only set at construction and is not modifiable at runtime.")
102 UPROPERTY(EditAnywhere, BlueprintReadOnly, Getter = "IsBackPadScrolling", Category = "Scroll")
103 bool BackPadScrolling;
104
105 UE_DEPRECATED(5.2, "Direct access to FrontPadScrolling is deprecated. Please use the getter. Note that FrontPadScrolling is only set at construction and is not modifiable at runtime.")
107 UPROPERTY(EditAnywhere, BlueprintReadOnly, Getter = "IsFrontPadScrolling", Category = "Scroll")
108 bool FrontPadScrolling;
109
110 UE_DEPRECATED(5.2, "Direct access to bAnimateWheelScrolling is deprecated. Please use the getter or setter.")
112 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter = "IsAnimateWheelScrolling", Setter = "SetAnimateWheelScrolling", BlueprintSetter = "SetAnimateWheelScrolling", Category = "Scroll")
113 bool bAnimateWheelScrolling = false;
114
115 UE_DEPRECATED(5.2, "Direct access to NavigationDestination is deprecated. Please use the getter or setter.")
117 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintSetter = "SetNavigationDestination", Getter, Setter, Category = "Scroll")
118 EDescendantScrollDestination NavigationDestination;
119
120 UE_DEPRECATED(5.2, "Direct access to NavigationScrollPadding is deprecated. Please use the getter. Note that NavigationScrollPadding is only set at construction and is not modifiable at runtime.")
125 UPROPERTY(EditAnywhere, BlueprintReadOnly, Getter, Category="Scroll")
126 float NavigationScrollPadding;
127
128 UE_DEPRECATED(5.2, "Direct access to ScrollWhenFocusChanges is deprecated. Please use the getter or setter.")
130 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintSetter = "SetScrollWhenFocusChanges", Category="Scroll", meta=(DisplayName="Scroll When Focus Changes"))
131 EScrollWhenFocusChanges ScrollWhenFocusChanges;
132
133 UE_DEPRECATED(5.2, "Direct access to bAllowRightClickDragScrolling is deprecated. Please use the getter or setter.")
135 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter = "IsAllowRightClickDragScrolling", Setter = "SetAllowRightClickDragScrolling", Category = "Scroll")
136 bool bAllowRightClickDragScrolling;
137
138 UE_DEPRECATED(5.2, "Direct access to WheelScrollMultiplier is deprecated. Please use the getter or setter.")
140 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintSetter = "SetWheelScrollMultiplier", Category = "Scroll")
141 float WheelScrollMultiplier = 1.f;
142
143 UMG_API void SetWidgetStyle(const FScrollBoxStyle& NewWidgetStyle);
144
145 UMG_API const FScrollBoxStyle& GetWidgetStyle() const;
146
147 UMG_API void SetWidgetBarStyle(const FScrollBarStyle& NewWidgetBarStyle);
148
149 UMG_API const FScrollBarStyle& GetWidgetBarStyle() const;
150
151 UFUNCTION(BlueprintCallable, Category = "Scroll")
152 UMG_API void SetConsumeMouseWheel(EConsumeMouseWheel NewConsumeMouseWheel);
153
154 UMG_API EConsumeMouseWheel GetConsumeMouseWheel() const;
155
156 UFUNCTION(BlueprintCallable, Category = "Scroll")
157 UMG_API void SetOrientation(EOrientation NewOrientation);
158
159 UMG_API EOrientation GetOrientation() const;
160
161 UFUNCTION(BlueprintCallable, Category = "Scroll")
162 UMG_API void SetScrollBarVisibility(ESlateVisibility NewScrollBarVisibility);
163
164 UMG_API ESlateVisibility GetScrollBarVisibility() const;
165
166 UFUNCTION(BlueprintCallable, Category = "Scroll")
167 UMG_API void SetScrollbarThickness(const FVector2D& NewScrollbarThickness);
168
169 UMG_API FVector2D GetScrollbarThickness() const;
170
171 UFUNCTION(BlueprintCallable, Category = "Scroll")
172 UMG_API void SetScrollbarPadding(const FMargin& NewScrollbarPadding);
173
174 UMG_API FMargin GetScrollbarPadding() const;
175
176 UFUNCTION(BlueprintCallable, Category = "Scroll")
177 UMG_API void SetAlwaysShowScrollbar(bool NewAlwaysShowScrollbar);
178
179 UMG_API bool IsAlwaysShowScrollbar() const;
180
181 UFUNCTION(BlueprintCallable, Category = "Scroll")
182 UMG_API void SetAllowOverscroll(bool NewAllowOverscroll);
183
184 UMG_API bool IsAllowOverscroll() const;
185
186 UFUNCTION(BlueprintCallable, Category = "Scroll")
187 UMG_API void SetAnimateWheelScrolling(bool bShouldAnimateWheelScrolling);
188
189 UMG_API bool IsAnimateWheelScrolling() const;
190
191 UFUNCTION(BlueprintCallable, Category = "Scroll")
192 UMG_API void SetScrollAnimationInterpolationSpeed(float NewScrollAnimationInterpolationSpeed);
193
194 UMG_API float GetScrollAnimationInterpolationSpeed() const;
195
196 UFUNCTION(BlueprintCallable, Category = "Scroll")
197 UMG_API void SetWheelScrollMultiplier(float NewWheelScrollMultiplier);
198
199 UMG_API float GetWheelScrollMultiplier() const;
200
201 UFUNCTION(Category = "Scroll")
202 UMG_API void SetIsTouchScrollingEnabled(bool bInEnableTouchScrolling);
203
204 UMG_API bool GetIsTouchScrollingEnabled() const;
205
206 UFUNCTION(BlueprintCallable, Category = "Scroll")
207 UMG_API bool GetConsumePointerInput() const;
208
209 UFUNCTION(BlueprintCallable, Category = "Scroll")
210 UMG_API void SetConsumePointerInput(bool bInConsumePointerInput);
211
212 UFUNCTION(BlueprintCallable, Category = "Scroll")
213 UMG_API void SetScrollWhenFocusChanges(EScrollWhenFocusChanges NewScrollWhenFocusChanges);
214
215 UMG_API EScrollWhenFocusChanges GetScrollWhenFocusChanges() const;
216
217 UFUNCTION(BlueprintCallable, Category = "Scroll")
218 UMG_API void SetNavigationDestination(const EDescendantScrollDestination NewNavigationDestination);
219
220 UMG_API EDescendantScrollDestination GetNavigationDestination() const;
221
222 UMG_API void SetAlwaysShowScrollbarTrack(bool NewAlwaysShowScrollbarTrack);
223
224 UMG_API bool IsAlwaysShowScrollbarTrack() const;
225
226 UMG_API float GetNavigationScrollPadding() const;
227
228 UMG_API void SetAllowRightClickDragScrolling(bool bShouldAllowRightClickDragScrolling);
229
230 UMG_API bool IsAllowRightClickDragScrolling() const;
231
232 UMG_API bool IsFrontPadScrolling() const;
233
234 UMG_API bool IsBackPadScrolling() const;
235
237 UFUNCTION(BlueprintCallable, Category = "Scroll")
238 UMG_API void EndInertialScrolling();
239
240 UFUNCTION(BlueprintCallable, Category = "Scroll")
241 UMG_API FKey GetAnalogMouseWheelKey() const;
242
243 UFUNCTION(BlueprintCallable, Category = "Scroll")
244 UMG_API void SetAnalogMouseWheelKey(FKey InMouseWheelKey);
245
246 UFUNCTION(BlueprintCallable, Category = "Scroll")
247 UMG_API bool GetIsFocusable() const;
248
249 UFUNCTION(BlueprintCallable, Category = "Scroll")
250 UMG_API void SetIsFocusable(bool bInIsFocusable);
251
252public:
253
255 UPROPERTY(BlueprintAssignable, Category = "Button|Event")
256 FOnUserScrolledEvent OnUserScrolled;
257
259 UPROPERTY(BlueprintAssignable, Category = "Button|Event")
260 FOnScrollBarVisibilityChangedEvent OnScrollBarVisibilityChanged;
261
263 UPROPERTY(BlueprintAssignable, Category = "Scroll|Event")
265
267 UPROPERTY(BlueprintAssignable, Category = "Scroll|Event")
269
274 UFUNCTION(BlueprintCallable, Category="Widget")
275 UMG_API void SetScrollOffset(float NewScrollOffset);
276
280 UFUNCTION(BlueprintCallable, Category="Widget")
281 UMG_API float GetScrollOffset() const;
282
286 UFUNCTION(BlueprintCallable, Category="Widget")
287 UMG_API float GetOverscrollOffset() const;
291 UFUNCTION(BlueprintCallable, Category="Widget")
292 UMG_API float GetOverscrollPercentage() const;
293
295 UFUNCTION(BlueprintCallable, Category = "Widget")
296 UMG_API float GetScrollOffsetOfEnd() const;
297
299 UFUNCTION(BlueprintCallable, Category="Widget")
300 UMG_API float GetViewFraction() const;
301
302 UFUNCTION(BlueprintCallable, Category="Widget")
303 UMG_API float GetViewOffsetFraction() const;
304
306 UFUNCTION(BlueprintCallable, Category="Widget")
307 UMG_API void ScrollToStart();
308
310 UFUNCTION(BlueprintCallable, Category="Widget")
311 UMG_API void ScrollToEnd();
312
314 UFUNCTION(BlueprintCallable, Category="Widget")
316
318 UFUNCTION(BlueprintPure, Category="Widget")
319 UMG_API bool GetIsScrolling() const;
320
321 //~ Begin UWidget Interface
322 UMG_API virtual void SynchronizeProperties() override;
323 //~ End UWidget Interface
324
325 //~ Begin UVisual Interface
326 UMG_API virtual void ReleaseSlateResources(bool bReleaseChildren) override;
327 //~ End UVisual Interface
328
329 //~ Begin UObject Interface
330#if WITH_EDITORONLY_DATA
331 UMG_API virtual void Serialize(FArchive& Ar) override;
332#endif // if WITH_EDITORONLY_DATA
333 //~ End UObject Interface
334
335#if WITH_EDITOR
336 //~ Begin UWidget Interface
337 UMG_API virtual const FText GetPaletteCategory() override;
340 //~ End UWidget Interface
341#endif
342
343protected:
344
345 // UPanelWidget
346 UMG_API virtual UClass* GetSlotClass() const override;
347 UMG_API virtual void OnSlotAdded(UPanelSlot* Slot) override;
348 UMG_API virtual void OnSlotRemoved(UPanelSlot* Slot) override;
349 // End UPanelWidget
350
351 UMG_API void SlateHandleUserScrolled(float CurrentOffset);
352
353 UMG_API void SlateHandleScrollBarVisibilityChanged(EVisibility NewVisibility);
354
355 UMG_API void SlateHandleFocusReceived();
356
357 UMG_API void SlateHandleFocusLost();
358
359 // Initialize IsFocusable in the constructor before the SWidget is constructed.
360 UMG_API void InitBackPadScrolling(bool InBackPadScrolling);
361 // Initialize IsFocusable in the constructor before the SWidget is constructed.
362 UMG_API void InitFrontPadScrolling(bool InFrontPadScrolling);
363 // Initialize IsFocusable in the constructor before the SWidget is constructed.
364 UMG_API void InitNavigationScrollPadding(float InNavigationScrollPadding);
365
366protected:
369
371
372protected:
373 //~ Begin UWidget Interface
374 UMG_API virtual TSharedRef<SWidget> RebuildWidget() override;
375 //~ End UWidget Interface
376
377#if WITH_EDITOR
379#endif //WITH_EDITOR
380};
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE(DelegateName)
Definition DelegateCombinations.h:38
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type, Param1Name)
Definition DelegateCombinations.h:53
return true
Definition ExternalRpcRegistry.cpp:601
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
EDescendantScrollDestination
Definition SScrollBox.h:38
EScrollWhenFocusChanges
Definition SScrollBox.h:63
EOrientation
Definition SlateEnums.h:261
EConsumeMouseWheel
Definition SlateTypes.h:26
ESlateVisibility
Definition SlateWrapperTypes.h:22
Definition Archive.h:1208
Definition Text.h:385
Definition EnumAsByte.h:22
Definition SharedPointer.h:692
Definition SharedPointer.h:153
Definition Class.h:3793
Definition PanelSlot.h:13
Definition PanelWidget.h:15
Definition ScrollBox.h:24
float DesiredScrollOffset
Definition ScrollBox.h:368
TSharedPtr< class SScrollBox > MyScrollBox
Definition ScrollBox.h:370
Definition Widget.h:217
@ false
Definition radaudio_common.h:23
Definition Visibility.h:12
Definition InputCoreTypes.h:50
Definition Margin.h:17
Definition SlateTypes.h:932
Definition SlateTypes.h:2023