Touch Interface Designer 2025.2
Create touch interface with a visual editor and manage all mobile inputs like gestures
Loading...
Searching...
No Matches
SComponentPreviewer.h
Go to the documentation of this file.
1// Copyright 2025 Lost in Game Studio. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Widgets/SCompoundWidget.h"
7#include "Widgets/Layout/SConstraintCanvas.h"
8#include "Widgets/SOverlay.h"
9
11class SConstraintCanvas;
12
16class TOUCHINTERFACE_API SComponentPreviewer : public SCompoundWidget
17{
18public:
20 : _Component(nullptr)
21 , _bPaintHitBox(false)
22 , _Opacity(1.0f)
23 {
24 }
25 SLATE_ARGUMENT(ULayoutComponent*, Component)
26 SLATE_ARGUMENT(bool, bPaintHitBox)
27 SLATE_ARGUMENT(float, Opacity)
28 SLATE_ARGUMENT(bool, bShowPressedState)
29
30 SLATE_END_ARGS()
31
33
35 void Construct(const FArguments& InArgs);
36
37 void ConstructDecorator() const;
38
39 virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
40
41 void SetOpacity(const float InOpacity) { Opacity = InOpacity; }
42
43 void SetPaintHitBox(const bool bPaint) { bPaintHitBox = bPaint; }
44
45 void SetPressedStateVisibility(const bool bVisible) { bShowPressedState = bVisible; }
46
47 FName GetComponentName() const;
48
49 bool IsInside(FVector2D AbsoluteLocation) const;
50
51 SConstraintCanvas::FSlot* CreateChildSlot(FAnchors ChildAnchors, const FVector2D ChildAlignment, FVector4f ChildAnchorOffset);
52
53private:
54 TSharedPtr<SOverlay> OverlayWidget;
55
56 TSharedPtr<SConstraintCanvas> CanvasWidget;
57
58 TObjectPtr<ULayoutComponent> Component;
59
60 TArray<TSharedPtr<SComponentPreviewer>> Children;
61
62 uint8 bPaintHitBox:1;
63 uint8 bShowPressedState:1;
64
65 float Opacity;
66};
Definition SComponentPreviewer.h:17
void SetPaintHitBox(const bool bPaint)
Definition SComponentPreviewer.h:43
void SetOpacity(const float InOpacity)
Definition SComponentPreviewer.h:41
void SetPressedStateVisibility(const bool bVisible)
Definition SComponentPreviewer.h:45
SLATE_BEGIN_ARGS(SComponentPreviewer)
Definition SComponentPreviewer.h:19
SComponentPreviewer()
Definition SComponentPreviewer.cpp:14
Definition LayoutComponent.h:94