Touch Interface Designer 2025.2
Create touch interface with a visual editor and manage all mobile inputs like gestures
Loading...
Searching...
No Matches
TextLayer.h
Go to the documentation of this file.
1// Copyright 2025 Lost in Game Studio. All Rights Reserved.
2
3#pragma once
4
6#include "Styling/SlateTypes.h"
7#include "Framework/Text/TextLayout.h"
8#include "TextLayer.generated.h"
9
10class STextBlock;
11
12UCLASS()
13class TOUCHINTERFACE_API UTextLayer : public UComponentDecorator
14{
15 GENERATED_BODY()
16
17public:
18 UTextLayer();
19
20 virtual void BeginDestroy() override;
21
22#if WITH_EDITOR
23 virtual void SynchronizeProperties() override;
24#endif
25
26 virtual TSharedRef<SWidget> CreateWidgetInstance() override;
27
28#if WITH_EDITOR
29 //virtual bool ShouldDrawPreview() const override { return bEnablePreview; }
30 //virtual void DrawPreview(const FGeometry& AllottedGeometry, const float SizeScale, const float Opacity, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, const FVector2D RecenterOffset) const override;
31#endif
32
33 // Returns the current text
34 UFUNCTION(Category="Text Layer", BlueprintCallable, BlueprintPure)
35 FText GetText() const;
36
37 // Set the new text
38 UFUNCTION(Category="Text Layer", BlueprintCallable)
39 void SetText(const FText NewText);
40
41 // Set the new text as int32
42 UFUNCTION(Category="Text Layer", BlueprintCallable)
43 void SetTextAsInt(const int32 Number);
44
45 // Set the new text as float
46 UFUNCTION(Category="Text Layer", BlueprintCallable)
47 void SetTextAsFloat(const float Value);
48
49 // Set the new text as FVector
50 UFUNCTION(Category="Text Layer", BlueprintCallable)
51 void SetTextAsVector(const FVector Vector);
52
53 // Set the new text as FVector2D
54 UFUNCTION(Category="Text Layer", BlueprintCallable)
55 void SetTextAsVector2D(const FVector2D Vector);
56
57 // Set the new font of text
58 UFUNCTION(Category="Text Layer", BlueprintCallable)
59 void SetFont(const FSlateFontInfo InFont);
60
61 // Set the new size of font
62 UFUNCTION(Category="Text Layer", BlueprintCallable)
63 void SetFontSize(const float NewSize);
64
65 // Set the new color of text
66 UFUNCTION(Category="Text Layer", BlueprintCallable)
67 void SetColor(const FSlateColor NewColor) const;
68
69public:
70 // Text displayed
71 UPROPERTY(Category="Text Layer", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
72 FText Text;
73
74 // Text margin
75 UPROPERTY(Category="Text Layer", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
76 FMargin Margin;
77
78 // Transform policy of text
79 UPROPERTY(Category="Text Layer", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
80 ETextTransformPolicy TransformPolicy;
81
82
83 // Justification of text
84 UPROPERTY(Category="Text Layer|Alignment", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
85 TEnumAsByte<ETextJustify::Type> Justification;
86
87
88 // Font of text
89 UPROPERTY(Category="Text Layer|Style", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
90 FSlateFontInfo Font;
91
92 // Color of text
93 UPROPERTY(Category="Text Layer|Style", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
94 FSlateColor Color;
95
96
97 // Shadow offset of text
98 UPROPERTY(Category="Text Layer|Shadow", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
99 FVector2D ShadowOffset;
100
101 // Shadow color of text
102 UPROPERTY(Category="Text Layer|Shadow", EditAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess="true"))
103 FLinearColor ShadowColor;
104
105private:
106 TSharedPtr<STextBlock> TextWidget;
107};
UComponentDecorator()
Definition ComponentDecorator.cpp:19
UTextLayer()
Definition TextLayer.cpp:9
BlueprintCallable void SetTextAsVector(const FVector Vector)
Definition TextLayer.cpp:93
EditAnywhere
Definition TextLayer.h:71
meta
Definition TextLayer.h:71
BlueprintCallable void SetText(const FText NewText)
Definition TextLayer.cpp:72
BlueprintCallable void SetFontSize(const float NewSize)
Definition TextLayer.cpp:112
Category
Definition TextLayer.h:34
BlueprintCallable
Definition TextLayer.h:34
virtual TSharedRef< SWidget > CreateWidgetInstance() override
Definition TextLayer.cpp:47
BlueprintCallable void SetTextAsFloat(const float Value)
Definition TextLayer.cpp:87
virtual void BeginDestroy() override
Definition TextLayer.cpp:24
BlueprintCallable void SetFont(const FSlateFontInfo InFont)
Definition TextLayer.cpp:103
BlueprintPure FText GetText() const
Definition TextLayer.cpp:62
BlueprintCallable void SetColor(const FSlateColor NewColor) const
Definition TextLayer.cpp:121
BlueprintCallable void SetTextAsInt(const int32 Number)
Definition TextLayer.cpp:81
BlueprintReadOnly
Definition TextLayer.h:71
BlueprintCallable void SetTextAsVector2D(const FVector2D Vector)
Definition TextLayer.cpp:98