UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SPrioritizedWrapBox.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
10#include "Widgets/SBoxPanel.h"
11
13class FPaintArgs;
15class SComboButton;
16
18
20{
21 class FChildArranger;
22}; // namespace UE::Slate
23
30{
32
33public:
34 class FSlot : public TBasicLayoutWidgetSlot<FSlot>, public TResizingWidgetSlotMixin<FSlot>
35 {
36 public:
38 SLATE_ATTRIBUTE(bool, AllowWrapping) // If set to false, this widget won't be considered for wrapping and will always be in the first line
39 SLATE_ATTRIBUTE(int32, WrapPriority)
42 SLATE_ARGUMENT(TOptional<float>, VerticalExpansionThreshold) // Vertical expansion will occur when the widget's desired size is at or beyond this value
43 SLATE_ARGUMENT_DEFAULT(bool, ForceNewLine) = false; // If true, this will forcibly place this slot on a new line, regardless of the wrapping behavior. This affects all slots after this one with the same or higher wrapping priorities.
46
47 FSlot();
48
49 public:
51
53
55 bool GetAllowWrapping() const { return bAllowWrapping.Get(); }
56
58 int32 GetWrapPriority() const { return WrapPriority.Get(); }
59
61 void SetWrapPriority(int32 InPriority) { WrapPriority.Set(*this, InPriority); }
62
64 UE::Slate::PrioritizedWrapBox::EWrapMode GetWrapMode() const { return WrapMode.Get(); }
65
68
70 const TOptional<float>& GetVerticalExpansionThreshold() const { return VerticalExpansionThreshold; }
71
76 const bool GetForceNewLine() const { return bForceNewLine; }
77
79 bool GetExcludeIfFirstOrLast() const { return bExcludeIfFirstOrLast; }
80
81 private:
82 template <typename InObjectType>
84
86 TSlateSlotAttribute<bool> bAllowWrapping;
87
89 TSlateSlotAttribute<int32> WrapPriority;
90
92
94 TOptional<float> VerticalExpansionThreshold;
95 bool bForceNewLine = false;;
96
97 bool bExcludeIfFirstOrLast = false;
98 };
99
106 SLATE_SLOT_ARGUMENT(FSlot, Slots)
107
108
109 SLATE_ATTRIBUTE(float, PreferredSize)
110
111
112 SLATE_ATTRIBUTE(TOptional<float>, MinLineHeight)
113
114
115 SLATE_ARGUMENT(float, LinePadding)
116
117
120
123
124 static FSlot::FSlotArguments Slot()
125 {
127 }
128
132
133 void Construct(const FArguments& InArgs);
134
135 //~ Begin SWidget
136 virtual FVector2D ComputeDesiredSize(float LayoutScaleMultiplier) const override;
137 //~ End SWidget
138
139 //~ Begin SPanel
140 virtual void OnArrangeChildren( const FGeometry& AllottedGeometry, FArrangedChildren& ArrangedChildren ) const override;
141 virtual FChildren* GetChildren() override { return &Slots; }
142 //~ End SPanel
143
144 float GetPreferredSize() const { return PreferredSize.Get(); }
145 TOptional<float> GetMinLineHeight() const { return MinLineHeight.Get(); }
146 float GetLinePadding() const { return LinePadding; }
147 bool GetUseGroupedWrapping() const { return bGroupedWrapping; }
148
149private:
151 TSlateAttribute<float> PreferredSize;
152
155
157 float LinePadding;
158
160 bool bGroupedWrapping;
161
163
165};
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_ARGUMENT_DEFAULT(ArgType, ArgName)
Definition DeclarativeSyntaxSupport.h:225
#define SLATE_ATTRIBUTE(AttrType, AttrName)
Definition DeclarativeSyntaxSupport.h:192
#define SLATE_SLOT_BEGIN_ARGS_OneMixin(SlotType, SlotParentType, Mixin1)
Definition DeclarativeSyntaxSupport.h:366
#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 DECLARE_DELEGATE_RetVal_OneParam(ReturnValueType, DelegateName, Param1Type)
Definition DelegateCombinations.h:54
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
#define SLATE_DECLARE_WIDGET(WidgetType, ParentType)
Definition SlateControlledConstruction.h:19
Definition ArrangedChildren.h:15
Definition ChildrenBase.h:27
Definition PaintArgs.h:23
Definition DrawElements.h:220
Definition SComboButton.h:25
Definition SPanel.h:30
void Construct()
Definition SPanel.h:65
Definition SPrioritizedWrapBox.h:35
UE::Slate::PrioritizedWrapBox::EVerticalOverflowBehavior GetVerticalOverflowBehavior() const
Definition SPrioritizedWrapBox.h:67
bool GetAllowWrapping() const
Definition SPrioritizedWrapBox.h:55
const bool GetForceNewLine() const
Definition SPrioritizedWrapBox.h:76
void SetWrapPriority(int32 InPriority)
Definition SPrioritizedWrapBox.h:61
const TOptional< float > & GetVerticalExpansionThreshold() const
Definition SPrioritizedWrapBox.h:70
bool GetExcludeIfFirstOrLast() const
Definition SPrioritizedWrapBox.h:79
UE::Slate::PrioritizedWrapBox::EWrapMode GetWrapMode() const
Definition SPrioritizedWrapBox.h:64
int32 GetWrapPriority() const
Definition SPrioritizedWrapBox.h:58
static void RegisterAttributes(FSlateWidgetSlotAttributeInitializer &AttributeInitializer)
Definition SPrioritizedWrapBox.cpp:917
Definition SPrioritizedWrapBox.h:30
virtual FVector2D ComputeDesiredSize(float LayoutScaleMultiplier) const override
Definition SPrioritizedWrapBox.cpp:964
FScopedWidgetSlotArguments AddSlot()
Definition SPrioritizedWrapBox.cpp:941
SLATE_BEGIN_ARGS(SPrioritizedWrapBox)
Definition SPrioritizedWrapBox.h:100
TOptional< float > GetMinLineHeight() const
Definition SPrioritizedWrapBox.h:145
int32 RemoveSlot(const TSharedRef< SWidget > &InSlot)
Definition SPrioritizedWrapBox.cpp:946
static FSlot::FSlotArguments Slot()
Definition SPrioritizedWrapBox.h:124
float GetLinePadding() const
Definition SPrioritizedWrapBox.h:146
float GetPreferredSize() const
Definition SPrioritizedWrapBox.h:144
virtual FChildren * GetChildren() override
Definition SPrioritizedWrapBox.h:141
virtual void OnArrangeChildren(const FGeometry &AllottedGeometry, FArrangedChildren &ArrangedChildren) const override
Definition SPrioritizedWrapBox.cpp:973
bool GetUseGroupedWrapping() const
Definition SPrioritizedWrapBox.h:147
Definition BasicLayoutWidgetSlot.h:599
FSlotArguments && InArgs
Definition BasicLayoutWidgetSlot.h:630
Definition Children.h:461
Definition BasicLayoutWidgetSlot.h:398
Definition SharedPointer.h:153
Definition UniquePtr.h:107
Definition SPrioritizedWrapBox.cpp:10
EVerticalOverflowBehavior
Definition MultiBoxDefs.h:29
EWrapMode
Definition MultiBoxDefs.h:19
@ false
Definition radaudio_common.h:23
Definition Geometry.h:40
Definition MultiBoxDefs.h:267
Definition SlateAttributeDescriptor.h:205
Definition SlotBase.h:25
Definition SlateAttributeContained.inl:19
Definition Optional.h:131