UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SWrapBox.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"
6#include "Misc/Attribute.h"
7#include "Layout/Visibility.h"
9#include "SlotBase.h"
10#include "Widgets/SWidget.h"
11#include "Layout/Children.h"
12#include "Widgets/SPanel.h"
13
15
50class SWrapBox : public SPanel
51{
53public:
54
56 class FSlot : public TBasicLayoutWidgetSlot<FSlot>
57 {
58 public:
61 , SlotFillLineWhenSizeLessThan()
62 , bSlotFillEmptySpace(false)
63 , bSlotForceNewLine(false)
64 {
65 }
66
70 SLATE_ARGUMENT(TOptional<bool>, ForceNewLine)
72
74 {
76 if (InArgs._FillLineWhenSizeLessThan.IsSet())
77 {
78 SlotFillLineWhenSizeLessThan = InArgs._FillLineWhenSizeLessThan;
79 }
80 bSlotFillEmptySpace = InArgs._FillEmptySpace.Get(bSlotFillEmptySpace);
81 bSlotForceNewLine = InArgs._ForceNewLine.Get(bSlotForceNewLine);
82 }
83
93
95 {
96 return SlotFillLineWhenSizeLessThan;
97 }
98
101 {
102 if (bSlotFillEmptySpace != bInFillEmptySpace)
103 {
104 bSlotFillEmptySpace = bInFillEmptySpace;
106 }
107 }
108
109 bool GetFillEmptySpace() const
110 {
111 return bSlotFillEmptySpace;
112 }
113
115 {
116 if (bSlotForceNewLine != bInForceNewLine)
117 {
118 bSlotForceNewLine = bInForceNewLine;
120 }
121 }
122
123 bool GetForceNewLine() const
124 {
125 return bSlotForceNewLine;
126 }
127
128 private:
129 TOptional<float> SlotFillLineWhenSizeLessThan;
130 bool bSlotFillEmptySpace;
131 bool bSlotForceNewLine;
132 };
133
134
144
146 SLATE_SLOT_ARGUMENT( FSlot, Slots )
147
148
149 SLATE_ATTRIBUTE( float, PreferredSize )
150
151
153
154
155 SLATE_ARGUMENT( FVector2D, InnerSlotPadding )
156
157
159
160
163
166
167 static FSlot::FSlotArguments Slot()
168 {
170 }
171
174
181
182 SLATE_API void Construct( const FArguments& InArgs );
183
184 SLATE_API virtual void Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime ) override;
185
186 SLATE_API virtual void OnArrangeChildren( const FGeometry& AllottedGeometry, FArrangedChildren& ArrangedChildren ) const override;
187
189
190 SLATE_API virtual FVector2D ComputeDesiredSize(float) const override;
191
192 SLATE_API virtual FChildren* GetChildren() override;
193
196
199
202
205
208
209private:
211 TSlateAttribute<float> PreferredSize;
212
215
218
220 FVector2D InnerSlotPadding;
221
223 bool bUseAllottedSize;
224
226 EOrientation Orientation;
227
228 class FChildArranger;
230};
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
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_SLOT_ARGUMENT(SlotType, SlotName)
Definition DeclarativeSyntaxSupport.h:348
#define SLATE_ATTRIBUTE(AttrType, AttrName)
Definition DeclarativeSyntaxSupport.h:192
#define SLATE_SLOT_BEGIN_ARGS(SlotType, SlotParentType)
Definition DeclarativeSyntaxSupport.h:361
#define SLATE_END_ARGS()
Definition DeclarativeSyntaxSupport.h:116
#define SLATE_SLOT_END_ARGS()
Definition DeclarativeSyntaxSupport.h:386
#define SLATE_ARGUMENT(ArgType, ArgName)
Definition DeclarativeSyntaxSupport.h:208
#define SLATE_DECLARE_WIDGET_API(WidgetType, ParentType, ModuleApiDefine)
Definition SlateControlledConstruction.h:22
EHorizontalAlignment
Definition SlateEnums.h:174
EOrientation
Definition SlateEnums.h:261
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
Definition ArrangedChildren.h:15
Definition ChildrenBase.h:27
SLATECORE_API void Invalidate(EInvalidateWidgetReason InvalidateReason)
Definition SlotBase.cpp:65
Definition SPanel.h:30
void Construct()
Definition SPanel.h:65
Definition SWrapBox.cpp:64
Definition SWrapBox.h:57
bool GetForceNewLine() const
Definition SWrapBox.h:123
bool GetFillEmptySpace() const
Definition SWrapBox.h:109
FSlot()
Definition SWrapBox.h:59
void SetFillLineWhenSizeLessThan(TOptional< float > InFillLineWhenSizeLessThan)
Definition SWrapBox.h:85
void SetFillEmptySpace(bool bInFillEmptySpace)
Definition SWrapBox.h:100
TOptional< float > GetFillLineWhenSizeLessThan() const
Definition SWrapBox.h:94
void SetForceNewLine(bool bInForceNewLine)
Definition SWrapBox.h:114
Definition SWrapBox.h:51
SLATE_API void SetWrapSize(TAttribute< float > InWrapSize)
Definition SWrapBox.cpp:460
SLATE_API void SetHorizontalAlignment(TAttribute< EHorizontalAlignment > InHAlignment)
Definition SWrapBox.cpp:484
virtual SLATE_API FVector2D ComputeDesiredSize(float) const override
Definition SWrapBox.cpp:432
SLATE_BEGIN_ARGS(SWrapBox)
Definition SWrapBox.h:135
SLATE_API void ClearChildren()
Definition SWrapBox.cpp:427
SLATE_API int32 RemoveSlot(const TSharedRef< SWidget > &SlotWidget)
Definition SWrapBox.cpp:30
SLATE_API void SetInnerSlotPadding(FVector2D InInnerSlotPadding)
Definition SWrapBox.cpp:451
virtual SLATE_API void OnArrangeChildren(const FGeometry &AllottedGeometry, FArrangedChildren &ArrangedChildren) const override
Definition SWrapBox.cpp:374
static FSlot::FSlotArguments Slot()
Definition SWrapBox.h:167
SLATE_API void SetUseAllottedSize(bool bInUseAllottedSize)
Definition SWrapBox.cpp:465
SLATE_API FScopedWidgetSlotArguments AddSlot()
Definition SWrapBox.cpp:25
virtual SLATE_API FChildren * GetChildren() override
Definition SWrapBox.cpp:446
SLATE_API void SetOrientation(EOrientation InOrientation)
Definition SWrapBox.cpp:475
Definition Attribute.h:17
Definition BasicLayoutWidgetSlot.h:599
FSlotArguments && InArgs
Definition BasicLayoutWidgetSlot.h:630
Definition Children.h:461
Definition SharedPointer.h:153
void Construct(const FChildren &SlotOwner, typename Super::FSlotArguments &&InArgs)
Definition WidgetSlotWithAttributeSupport.h:46
@ false
Definition radaudio_common.h:23
static SLATECORE_API const EVisibility SelfHitTestInvisible
Definition Visibility.h:26
Definition Geometry.h:40
Definition SlotBase.h:25
Definition SWidget.h:189
Definition Optional.h:131