UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SScaleBox.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"
7#include "Misc/Attribute.h"
9#include "Widgets/SWidget.h"
11#include "SScaleBox.generated.h"
12
14class FPaintArgs;
16
17UENUM(BlueprintType)
19{
20 enum Type : int
21 {
27 UpOnly
28 };
29}
30
31UENUM(BlueprintType)
70
77{
79
80public:
91 SLATE_DEFAULT_SLOT(FArguments, Content)
92
93
95
96
98
99
101
102
104
105
106 SLATE_ATTRIBUTE(float, UserSpecifiedScale)
107
108
109 SLATE_ATTRIBUTE(bool, IgnoreInheritedScale)
110
111#if WITH_EDITOR
114#endif
115
117
121
122public:
124
125 SLATE_API void Construct(const FArguments& InArgs);
126
127 // SWidget interface
129 SLATE_API virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
130 // End SWidget of interface
131
134
137
140
143
146
149
152
153#if WITH_EDITOR
155#endif
156
157protected:
158 // Begin SWidget overrides.
159 SLATE_API virtual bool CustomPrepass(float LayoutScaleMultiplier) override;
160 SLATE_API virtual FVector2D ComputeDesiredSize(float InScale) const override;
161 SLATE_API virtual float GetRelativeLayoutScale(int32 ChildIndex, float LayoutScaleMultiplier) const override;
162 // End SWidget overrides.
163
167
170
171#if WITH_EDITOR
173#endif
174
175private:
177 TSlateAttribute<EStretchDirection::Type> StretchDirectionAttribute;
178
180 TSlateAttribute<EStretch::Type> StretchAttribute;
181
183 TSlateAttribute<float> UserSpecifiedScaleAttribute;
184
186 TSlateAttribute<bool> IgnoreInheritedScaleAttribute;
187
189 float SafeZoneScale;
190
192 FDelegateHandle OnSafeFrameChangedHandle;
193
194 mutable TOptional<FVector2D> LastAllocatedArea;
195 mutable TOptional<FGeometry> LastPaintGeometry;
196
197 mutable TOptional<FVector2D> NormalizedContentDesiredSize;
198
200 mutable TOptional<float> ComputedContentScale;
201
202
203
204
206 mutable FVector2D LastFinalOffset;
207
209 mutable FVector2D LastSlotWidgetDesiredSize;
210
211#if WITH_EDITOR
213#endif
214};
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define SLATE_ATTRIBUTE(AttrType, AttrName)
Definition DeclarativeSyntaxSupport.h:192
#define SLATE_END_ARGS()
Definition DeclarativeSyntaxSupport.h:116
#define SLATE_DEFAULT_SLOT(DeclarationType, SlotName)
Definition DeclarativeSyntaxSupport.h:444
#define SLATE_ARGUMENT(ArgType, ArgName)
Definition DeclarativeSyntaxSupport.h:208
#define UENUM(...)
Definition ObjectMacros.h:749
#define SLATE_DECLARE_WIDGET_API(WidgetType, ParentType, ModuleApiDefine)
Definition SlateControlledConstruction.h:22
EHorizontalAlignment
Definition SlateEnums.h:174
EVerticalAlignment
Definition SlateEnums.h:194
Definition ArrangedChildren.h:15
Definition IDelegateInstance.h:14
Definition PaintArgs.h:23
Definition SlateRect.h:26
Definition DrawElements.h:220
Definition WidgetStyle.h:15
Definition SCompoundWidget.h:22
Definition SScaleBox.h:77
SLATE_API void SetStretchDirection(EStretchDirection::Type InStretchDirection)
Definition SScaleBox.cpp:358
virtual SLATE_API void OnArrangeChildren(const FGeometry &AllottedGeometry, FArrangedChildren &ArrangedChildren) const override
Definition SScaleBox.cpp:226
SLATE_API void SetIgnoreInheritedScale(bool InIgnoreInheritedScale)
Definition SScaleBox.cpp:373
SLATE_API void RefreshSafeZoneScale()
Definition SScaleBox.cpp:428
SLATE_API void SetContent(TSharedRef< SWidget > InContent)
Definition SScaleBox.cpp:340
SLATE_API void SetUserSpecifiedScale(float InUserSpecifiedScale)
Definition SScaleBox.cpp:368
virtual SLATE_API int32 OnPaint(const FPaintArgs &Args, const FGeometry &AllottedGeometry, const FSlateRect &MyCullingRect, FSlateWindowElementList &OutDrawElements, int32 LayerId, const FWidgetStyle &InWidgetStyle, bool bParentEnabled) const override
Definition SScaleBox.cpp:291
virtual SLATE_API FVector2D ComputeDesiredSize(float InScale) const override
Definition SScaleBox.cpp:378
SLATE_API void HandleSafeFrameChangedEvent()
Definition SScaleBox.cpp:469
SLATE_BEGIN_ARGS(SScaleBox)
Definition SScaleBox.h:81
SLATE_API float ComputeContentScale(const FGeometry &PaintGeometry) const
Definition SScaleBox.cpp:162
SLATE_API bool IsDesiredSizeDependentOnAreaAndScale() const
Definition SScaleBox.cpp:149
SLATE_API bool DoesScaleRequireNormalizingPrepassOrLocalGeometry() const
Definition SScaleBox.cpp:133
SLATE_API void SetHAlign(EHorizontalAlignment HAlign)
Definition SScaleBox.cpp:348
SLATE_API void SetStretch(EStretch::Type InStretch)
Definition SScaleBox.cpp:363
SLATE_API void SetVAlign(EVerticalAlignment VAlign)
Definition SScaleBox.cpp:353
virtual SLATE_API bool CustomPrepass(float LayoutScaleMultiplier) override
Definition SScaleBox.cpp:71
virtual SLATE_API float GetRelativeLayoutScale(int32 ChildIndex, float LayoutScaleMultiplier) const override
Definition SScaleBox.cpp:423
SLATE_API void Construct(const FArguments &InArgs)
Definition SScaleBox.cpp:38
Definition SWidget.h:165
Definition SharedPointer.h:153
Definition SScaleBox.h:19
Type
Definition SScaleBox.h:21
@ DownOnly
Definition SScaleBox.h:25
@ UpOnly
Definition SScaleBox.h:27
Definition SScaleBox.h:33
Type
Definition SScaleBox.h:35
@ ScaleToFill
Definition SScaleBox.h:61
@ ScaleToFitX
Definition SScaleBox.h:50
@ UserSpecified
Definition SScaleBox.h:65
@ ScaleToFitY
Definition SScaleBox.h:56
@ ScaleBySafeZone
Definition SScaleBox.h:63
@ UserSpecifiedWithClipping
Definition SScaleBox.h:67
@ false
Definition radaudio_common.h:23
Definition Geometry.h:40
Definition Margin.h:17
Definition Optional.h:131