5#include "CoreMinimal.h"
6#include "UObject/Object.h"
7#include "Widgets/Layout/SConstraintCanvas.h"
8#include "LayoutComponent.generated.h"
15class URadialProgressBarLayer;
23class UTextureRenderTarget2D;
27DECLARE_MULTICAST_DELEGATE(FOnObjectChanged)
65 ,
Size(ForceInitToZero)
103 virtual TSharedRef<SLayoutComponent>
TakeWidget(SConstraintCanvas::FSlot* WidgetSlot, TSharedPtr<STouchInterface> LayoutWidget, ULocalPlayer* LocalPlayer, TSharedPtr<SLayoutComponent> InParent =
nullptr);
113 virtual void UpdateScaleFactor(
const FGeometry& LayoutGeometry,
const float& ScaleFactor);
115 void SetPortraitMode(
const bool bEnable);
127 void SetAnchor(
const FAnchors NewAnchor);
129 void SetTopLeftLocation(
const FVector2D Value);
131 void SetSize(
const FVector2D Value);
133 FVector2D GetParentSize()
const;
136 virtual void OnBeginEditByEditor();
138 virtual void OnDesignerSizeChanged(
const FIntPoint NewSize);
140 virtual void OnCleanedByEditor();
142 virtual void OnEndEditByEditor();
145 virtual TSharedRef<SLayoutComponent> TakeEditorWidget(SConstraintCanvas::FSlot* WidgetSlot, TSharedPtr<STouchInterface> LayoutWidget, TSharedPtr<SLayoutComponent> InParent =
nullptr);
147 virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
override;
149 virtual void NotifyOnPropertyChanged();
151 FBox2D GetBox2D(FVector2D GeometrySize)
const;
153 void RebuildDecorator();
160 UFUNCTION(Category=
"Layout Component", BlueprintCallable)
169 UFUNCTION(Category=
"Layout Component|Position", BlueprintCallable, BlueprintPure)
170 virtual FVector2D GetComponentLocation()
const;
174 UFUNCTION(Category=
"Layout Component|Position", BlueprintCallable, BlueprintPure)
175 virtual FVector2D GetComponentTopLeftLocation();
183 UFUNCTION(Category=
"Layout Component|Position", BlueprintCallable, BlueprintPure)
184 virtual FVector2D GetComponentLocalLocation()
const;
188 UFUNCTION(Category=
"Layout Component|Position", BlueprintCallable, BlueprintPure)
189 virtual FVector2D GetLayoutTopLeftLocation()
const;
193 UFUNCTION(Category=
"Layout Component|Position", BlueprintCallable, BlueprintPure)
194 virtual FVector2D GetLayoutTopLeftCenterLocation()
const;
198 UFUNCTION(Category=
"Layout Component|Position", BlueprintCallable, BlueprintPure)
199 virtual FVector2D GetLayoutTopLeftLocationAtAlignment(FVector2D AtAlignment);
202 UFUNCTION(Category=
"Layout Component|Position", BlueprintCallable, BlueprintPure)
206 UFUNCTION(Category=
"Layout Component|Size", BlueprintCallable, BlueprintPure)
207 FVector2D GetComponentSize()
const;
210 UFUNCTION(Category=
"Layout Component|Modifier", BlueprintCallable, BlueprintPure)
214 UFUNCTION(Category=
"Layout Component|Modifier", BlueprintCallable, BlueprintPure)
220 UFUNCTION(Category=
"Layout Component", BlueprintCallable)
226 UFUNCTION(Category=
"Layout Component", BlueprintCallable)
227 virtual void SetComponentAlignment(
const FVector2D NewAlignment);
229 UFUNCTION(Category=
"Layout Component", BlueprintCallable)
230 virtual void SetAnchorOffset(
const FVector4f NewAnchorOffset);
234 UFUNCTION(Category=
"Layout Component|Position", BlueprintCallable)
235 virtual void SetComponentLocation(
const FVector2D NewLocation);
238 UFUNCTION(Category=
"Layout Component|Position", BlueprintCallable)
239 virtual void SetComponentLocalLocation(
const FVector2D NewLocation);
242 UFUNCTION(Category=
"Layout Component|Position", BlueprintCallable)
243 virtual void SetComponentPortraitOffset(
const FVector2D NewOffset);
248 UFUNCTION(Category=
"Layout Component|Position", BlueprintCallable)
249 virtual void SetComponentAngle(
const float Value);
252 UFUNCTION(Category=
"Layout Component|Size", BlueprintCallable)
253 virtual void SetComponentSize(
const FVector2D NewSize);
258 UFUNCTION(Category=
"Layout Component|Modifier", BlueprintCallable)
259 virtual void SetComponentSizeScale(
const FVector2D NewSizeScale);
264 UFUNCTION(Category=
"Layout Component", BlueprintCallable, BlueprintPure)
265 virtual bool IsUnderLocation(
const FVector2D AbsoluteLocation);
267 UFUNCTION(Category=
"Layout Component", BlueprintCallable, BlueprintPure)
268 virtual bool CanInteract()
const;
270 UFUNCTION(Category=
"Layout Component", BlueprintCallable)
271 virtual bool IsPressed()
const;
273 UFUNCTION(Category=
"Layout Component|Visibility", BlueprintCallable)
274 virtual void SetComponentVisibility(
const bool bVisible);
276 UFUNCTION(Category=
"Layout Component|Visibility", BlueprintCallable)
277 virtual bool IsVisible();
279 UFUNCTION(Category=
"Layout Component", BlueprintCallable)
280 virtual void Recenter(
const FVector2D LayoutPosition = FVector2D::ZeroVector);
282 UFUNCTION(Category=
"Layout Component", BlueprintCallable)
283 virtual void ResetPosition();
285 UFUNCTION(Category=
"Layout Component", BlueprintCallable)
286 virtual const FGeometry& GetComponentGeometry();
289 UFUNCTION(Category=
"Layout Component", BlueprintCallable, BlueprintPure)
290 virtual bool IsChild()
const;
295 UFUNCTION(Category=
"Layout Component", BlueprintCallable, BlueprintPure)
298 UFUNCTION(Category=
"Layout Component", BlueprintCallable, BlueprintPure)
304 UFUNCTION(Category=
"Layout Component", BlueprintCallable)
305 virtual void RebuildDecorators()
const;
311 UFUNCTION(Category=
"Layout Component|Appearance", BlueprintCallable)
312 UComponentDecorator* AddDecoratorByClass(TSubclassOf<UComponentDecorator> DecoratorClass,
const FName Name);
315 UFUNCTION(Category=
"Layout Component|Appearance", BlueprintCallable)
322 UFUNCTION(Category=
"Layout Component|Appearance", BlueprintCallable)
323 UComponentDecorator* InsertDecoratorByClassAt(TSubclassOf<UComponentDecorator> DecoratorClass, FName Name, int32 Index);
328 UFUNCTION(Category=
"Layout Component|Appearance", BlueprintCallable)
332 UFUNCTION(Category=
"Layout Component|Appearance", BlueprintCallable)
333 void RemoveDecoratorByName(
const FName Name);
336 UFUNCTION(Category=
"Layout Component|Appearance", BlueprintCallable)
337 void RemoveDecoratorAt(
const int32 Index);
340 UFUNCTION(Category=
"Layout Component|Appearance", BlueprintCallable, BlueprintPure)
341 int32 GetDecoratorIndex(
const FName Name);
415 UFUNCTION(Category=
"Layout Component|Appearance", BlueprintCallable)
419 bool HitPixel(
const FVector2D NormalizedPosition,
const float AlphaTolerance = 0);
427 UFUNCTION(Category=
"Layout Component|Appearance", BlueprintCallable)
428 void BeginEditDecorator(
const FName LayerName);
431 UFUNCTION(Category=
"Layout Component|Appearance", BlueprintCallable)
432 void EndEditDecorator();
444 UFUNCTION(Category=
"Layout Component|Input", BlueprintCallable, BlueprintPure)
448 UFUNCTION(Category=
"Layout Component|Input", BlueprintCallable)
452 UFUNCTION(Category=
"Layout Component|Input", BlueprintCallable)
458 UFUNCTION(Category=
"Layout Component|Input", BlueprintCallable, BlueprintPure)
463 UFUNCTION(Category=
"Layout Component|Input", BlueprintCallable)
464 void SetInteractionSize(
const float Value);
467 UFUNCTION(Category=
"Layout Component|Input", BlueprintCallable)
468 void SetInputPriority(
const int32 NewPriority);
472 UFUNCTION(Category=
"Layout Component|Input", BlueprintCallable)
476 UFUNCTION(Category=
"Layout Component|Input", BlueprintCallable)
480 UFUNCTION(Category=
"Layout Component|Input", BlueprintCallable)
484 UFUNCTION(Category=
"Layout Component|Input", BlueprintCallable, BlueprintPure)
485 bool IsInputEnabled();
488 UFUNCTION(Category=
"Layout Component|Input", BlueprintCallable)
489 UComponentLogic* SetLogic(
const TSubclassOf<UComponentLogic> NewLogicClass);
496 FOnObjectChanged OnObjectChanged;
498 friend class STouchInterfaceLayoutEditor;
499 friend class FTouchInterfaceLayoutEditor;
500 friend class SWidgetHandle;
501 friend class SAnchorHandle;
502 friend class FTouchInterfaceDesignerEditorMenuExtender;
516 UPROPERTY(
Category=
"Layout",
EditAnywhere,
BlueprintReadOnly,
meta=(EditCondition=
"AnchorPreset!=EAnchorPosition::HalfLeft && AnchorPreset!=EAnchorPosition::HalfRight && AnchorPreset!=EAnchorPosition::Fill", EditConditionHides))
519 UPROPERTY(
Category=
"Layout",
EditAnywhere,
BlueprintReadOnly,
meta=(EditCondition=
"AnchorPreset==EAnchorPosition::HalfLeft || AnchorPreset==EAnchorPosition::HalfRight || AnchorPreset==EAnchorPosition::Fill", EditConditionHides))
520 FVector4f AnchorOffset;
524 UPROPERTY(
Category=
"Layout",
EditAnywhere,
BlueprintReadOnly,
meta=(EditCondition=
"AnchorPreset!=EAnchorPosition::HalfLeft && AnchorPreset!=EAnchorPosition::HalfRight && AnchorPreset!=EAnchorPosition::Fill", EditConditionHides))
528 UPROPERTY(
Category=
"Layout",
EditAnywhere,
BlueprintReadOnly,
meta=(AllowPrivateAccess=
"true"),
meta=(EditCondition=
"AnchorPreset!=EAnchorPosition::HalfLeft && AnchorPreset!=EAnchorPosition::HalfRight && AnchorPreset!=EAnchorPosition::Fill", EditConditionHides))
611 float InteractionSize;
617 bool bRecenterHitBox;
680 FVector2D ComponentSize;
685 float CachedScaleFactor;
687 uint8 bPortraitMode:1;
692 FVector2D DesignerSize;
BlueprintType
Definition ComponentDecorator_Animation.h:40
EInteractionType
Definition LayoutComponent.h:32
@ Circle
Definition LayoutComponent.h:39
@ Alpha
Definition LayoutComponent.h:45
@ Square
Definition LayoutComponent.h:35
EAnchorPosition
Definition LayoutComponent.h:73
@ HalfRight
Definition LayoutComponent.h:84
@ TopRight
Definition LayoutComponent.h:76
@ Center
Definition LayoutComponent.h:78
@ HalfLeft
Definition LayoutComponent.h:83
@ TopMiddle
Definition LayoutComponent.h:75
@ BottomRight
Definition LayoutComponent.h:82
@ BottomLeft
Definition LayoutComponent.h:80
@ CenterLeft
Definition LayoutComponent.h:77
@ CenterRight
Definition LayoutComponent.h:79
@ TopLeft
Definition LayoutComponent.h:74
@ BottomMiddle
Definition LayoutComponent.h:81
@ Fill
Definition LayoutComponent.h:85
Definition SLayoutComponent.h:55
Definition STouchInterface.h:43
Definition BlurLayer.h:12
Definition ComponentDecoratorGroup.h:14
Definition ComponentDecorator.h:36
Definition FlipbookLayer.h:15
Definition LayoutComponent.h:94
BlueprintReadOnly
Definition LayoutComponent.h:506
BlueprintPure UTextLayer * GetDecoratorAsText(const FName LayerName)
Definition LayoutComponent.cpp:1439
BlueprintReadOnly FVector2D PortraitOffset
Definition LayoutComponent.h:540
meta
Definition LayoutComponent.h:344
FVector2D OffsetFromCenter
Definition LayoutComponent.h:669
FVector2D GetComponentOffset() const
Definition LayoutComponent.h:109
bool IsInPortraitMode() const
Definition LayoutComponent.h:117
float CurrentSizeScale
Definition LayoutComponent.h:650
BlueprintCallable
Definition LayoutComponent.h:163
virtual TSharedRef< SLayoutComponent > TakeWidget(SConstraintCanvas::FSlot *WidgetSlot, TSharedPtr< STouchInterface > LayoutWidget, ULocalPlayer *LocalPlayer, TSharedPtr< SLayoutComponent > InParent=nullptr)
Definition LayoutComponent.cpp:98
bool AllowSizeModification() const
Definition LayoutComponent.h:121
EditAnywhere
Definition LayoutComponent.h:506
bool CanRecenter() const
Definition LayoutComponent.h:437
TSharedPtr< STouchInterface > TouchInterfaceWidget
Definition LayoutComponent.h:655
BlueprintPure bool ContainDecorator(UObject *LayerObject)
Definition LayoutComponent.cpp:1489
BlueprintCallable void SetOpacity(const float Value)
Definition LayoutComponent.h:416
EInteractionType GetInteractionShape() const
Definition LayoutComponent.h:441
FVector2D GetOffsetFromCenter() const
Definition LayoutComponent.h:439
BlueprintReadOnly uint8 bOptimizeRendering
Definition LayoutComponent.h:573
BlueprintPure UBlurLayer * GetDecoratorAsBlur(const FName LayerName)
Definition LayoutComponent.cpp:1444
BlueprintCallable FVector2D GetAlignment() const
Definition LayoutComponent.h:161
TSharedPtr< STouchInterface > GetTouchInterfaceWidget() const
Definition LayoutComponent.h:125
BlueprintCallable int32 GetInputPriority() const
Definition LayoutComponent.h:449
BlueprintReadOnly FVector2D MaxSizeScale
Definition LayoutComponent.h:591
BlueprintReadOnly uint8 bRecenterOnTouch
Definition LayoutComponent.h:597
bool AllowPositionModification() const
Definition LayoutComponent.h:119
TArray< TObjectPtr< UComponentDecorator > > Decorators
Definition LayoutComponent.h:557
BlueprintPure TArray< FName > GetAllDecoratorNames(bool bRecursive)
Definition LayoutComponent.cpp:1411
BlueprintPure float GetComponentAngle() const
Definition LayoutComponent.h:203
void SetComponentOffset(const FVector2D InCenterOffset)
Definition LayoutComponent.h:111
BlueprintCallable void SetConsumeInput(const bool Value)
Definition LayoutComponent.h:473
BlueprintPure float GetInteractionSize() const
Definition LayoutComponent.h:445
BlueprintPure UProgressBarLayer * GetDecoratorAsProgressBar(const FName LayerName)
Definition LayoutComponent.cpp:1434
BlueprintReadOnly FVector4f MaxCenterOffset
Definition LayoutComponent.h:583
BlueprintPure bool ContainDecoratorName(const FName Name, bool bRecursive=false)
Definition LayoutComponent.cpp:1464
FVector2D TopLeftLocation
Definition LayoutComponent.h:673
BlueprintPure UComponentDecorator * GetDecoratorByName(const FName Name, bool bRecursive)
Definition LayoutComponent.cpp:1333
TSharedPtr< SLayoutComponent > ComponentWidget
Definition LayoutComponent.h:653
BlueprintPure UComponentDecoratorGroup * GetDecoratorAsGroup(const FName LayerName)
Definition LayoutComponent.cpp:1454
BlueprintCallable FAnchors GetAnchor() const
Definition LayoutComponent.h:158
BlueprintReadOnly uint8 bConsumeInput
Definition LayoutComponent.h:626
BlueprintPure bool ContainDecoratorClass(TSubclassOf< UComponentDecorator > Class)
Definition LayoutComponent.cpp:1502
BlueprintPure FVector4f GetAnchorOffset() const
Definition LayoutComponent.h:164
UTextureRenderTarget2D * GetCollapsedLayer()
Definition LayoutComponent.cpp:1637
BlueprintPure FVector2D GetComponentSizeScale() const
Definition LayoutComponent.h:215
BlueprintPure UFlipbookLayer * GetDecoratorAsFlipbook(const FName LayerName)
Definition LayoutComponent.cpp:1449
BlueprintReadOnly bool bAllowLocationModification
Definition LayoutComponent.h:578
BlueprintReadWrite EInteractionType InteractionShape
Definition LayoutComponent.h:601
virtual BlueprintPure FVector4f GetComponentMaxOffset() const
Definition LayoutComponent.h:211
virtual TSharedPtr< SLayoutComponent > GetWidgetInstance() const
Definition LayoutComponent.h:123
BlueprintReadOnly uint8 bIsVisible
Definition LayoutComponent.h:566
BlueprintPure UComponentDecorator * GetDecoratorByIndex(const int32 Index)
Definition LayoutComponent.cpp:1362
bool ConsumeInput() const
Definition LayoutComponent.h:436
BlueprintPure UWidgetLayer * GetDecoratorAsWidget(const FName LayerName)
Definition LayoutComponent.cpp:1459
FVector2D LayoutModifierOffset
Definition LayoutComponent.h:647
Category
Definition LayoutComponent.h:157
BlueprintReadOnly uint8 bAllowSizeModification
Definition LayoutComponent.h:586
BlueprintCallable bool IsConsumeInput() const
Definition LayoutComponent.h:453
Instanced TObjectPtr< UComponentLogic > Logic
Definition LayoutComponent.h:638
FVector2D DesignSize
Definition LayoutComponent.h:550
TObjectPtr< UComponentLogic > LogicCompInstance
Definition LayoutComponent.h:659
BlueprintCallable float GetOpacity() const
Definition LayoutComponent.h:412
ULayoutComponent()
Definition LayoutComponent.cpp:24
BlueprintPure TArray< UComponentDecorator * > GetAllDecorators(bool bRecursive)
Definition LayoutComponent.cpp:1388
FVector2D DesignLocation
Definition LayoutComponent.h:534
virtual void BeginDestroy() override
Definition LayoutComponent.cpp:78
Definition LayoutGroupComponent.h:14
Definition ProgressBarLayer.h:48
Definition TextLayer.h:14
Definition TouchInterfaceLayout.h:20
EditAnywhere
Definition LayoutComponent.h:53
BlueprintReadWrite FVector2D Position
Definition LayoutComponent.h:57
BlueprintReadWrite EInteractionType Shape
Definition LayoutComponent.h:54
FHitBox()
Definition LayoutComponent.h:62
BlueprintReadWrite FVector2D Size
Definition LayoutComponent.h:60
Category
Definition LayoutComponent.h:53