UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
CanvasPanelSlot.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 "Layout/Margin.h"
9#include "Layout/Geometry.h"
13
14#include "CanvasPanelSlot.generated.h"
15
16USTRUCT(BlueprintType)
18{
19public:
21
22public:
23
25 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=AnchorData)
26 FMargin Offsets;
27
29 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=AnchorData)
30 FAnchors Anchors;
31
37 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=AnchorData)
38 FVector2D Alignment = FVector2D::ZeroVector;
39
46 bool operator==(const FAnchorData& Other) const
47 {
48 return Offsets == Other.Offsets &&
49 Anchors == Other.Anchors &&
50 Alignment == Other.Alignment;
51 }
52
59 bool operator!=(const FAnchorData& Other) const
60 {
61 return !(*this == Other);
62 }
63};
64
65UCLASS(MinimalAPI)
67{
69
70public:
71
72 UE_DEPRECATED(5.1, "Direct access to LayoutData is deprecated. Please use the getter or setter.")
74 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter="GetLayout", Setter="SetLayout", BlueprintGetter ="GetLayout", BlueprintSetter="SetLayout", Category = "Layout|Canvas Slot")
75 FAnchorData LayoutData;
76
77 UE_DEPRECATED(5.1, "Direct access to bAutoSize is deprecated. Please use the getter or setter.")
79 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter="GetAutoSize", Setter="SetAutoSize", BlueprintGetter="GetAutoSize", BlueprintSetter="SetAutoSize", Category = "Layout|Canvas Slot", AdvancedDisplay, meta = (DisplayName = "Size To Content"))
80 bool bAutoSize;
81
82 UE_DEPRECATED(5.1, "Direct access to ZOrder is deprecated. Please use the getter or setter.")
84 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintGetter="GetZOrder", BlueprintSetter="SetZOrder", Category="Layout|Canvas Slot")
85 int32 ZOrder;
86
87public:
88#if WITH_EDITOR
91 UMG_API virtual void SynchronizeFromTemplate(const UPanelSlot* const TemplateSlot) override;
92#endif //WITH_EDITOR
93
95 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
96 UMG_API void SetLayout(const FAnchorData& InLayoutData);
97
99 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
100 UMG_API FAnchorData GetLayout() const;
101
103 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
104 UMG_API void SetPosition(FVector2D InPosition);
105
107 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
108 UMG_API FVector2D GetPosition() const;
109
111 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
112 UMG_API void SetSize(FVector2D InSize);
113
115 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
116 UMG_API FVector2D GetSize() const;
117
119 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
120 UMG_API void SetOffsets(FMargin InOffset);
121
123 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
124 UMG_API FMargin GetOffsets() const;
125
127 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
128 UMG_API void SetAnchors(FAnchors InAnchors);
129
131 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
132 UMG_API FAnchors GetAnchors() const;
133
135 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
136 UMG_API void SetAlignment(FVector2D InAlignment);
137
139 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
140 UMG_API FVector2D GetAlignment() const;
141
143 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
144 UMG_API void SetAutoSize(bool InbAutoSize);
145
147 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
148 UMG_API bool GetAutoSize() const;
149
151 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
152 UMG_API void SetZOrder(int32 InZOrder);
153
155 UFUNCTION(BlueprintCallable, Category="Layout|Canvas Slot")
156 UMG_API int32 GetZOrder() const;
157
158public:
159
161 UFUNCTION()
162 UMG_API void SetMinimum(FVector2D InMinimumAnchors);
163
165 UFUNCTION()
166 UMG_API void SetMaximum(FVector2D InMaximumAnchors);
167
168public:
169
170 UMG_API void BuildSlot(TSharedRef<SConstraintCanvas> Canvas);
171
172 // UPanelSlot interface
173 UMG_API virtual void SynchronizeProperties() override;
174 // End of UPanelSlot interface
175
176 UMG_API virtual void ReleaseSlateResources(bool bReleaseChildren) override;
177
178#if WITH_EDITOR
179 // UObject interface
180 using Super::PreEditChange;
182 UMG_API virtual void PostEditChangeChainProperty(struct FPropertyChangedChainEvent& PropertyChangedEvent) override;
183 // End of UObject interface
184
186 UMG_API void SaveBaseLayout();
187
189
191 UMG_API void RebaseLayout(bool PreserveSize = true);
192#endif
193
194private:
196
197#if WITH_EDITORONLY_DATA
200
202#endif
203};
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
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 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
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
uint32 Size
Definition VulkanMemory.cpp:4034
Definition UnrealType.h:174
Definition SConstraintCanvas.h:35
Definition SConstraintCanvas.h:28
Definition SharedPointer.h:153
Definition CanvasPanelSlot.h:67
Definition PanelSlot.h:13
Definition CanvasPanelSlot.h:18
bool operator!=(const FAnchorData &Other) const
Definition CanvasPanelSlot.h:59
Definition Anchors.h:14
Definition Geometry.h:40
Definition Margin.h:17
Definition UnrealType.h:7001
Definition Optional.h:131