Widget Studio
WSLabel.h
1/*
2* Copyright (c) 2021 THEIA INTERACTIVE. All rights reserved.
3*
4* Website: https://widgetstudio.design
5* Documentation: https://docs.widgetstudio.design
6* Support: marketplace@theia.io
7* Marketplace FAQ: https://marketplacehelp.epicgames.com
8*/
9
10#pragma once
11
12#include "CoreMinimal.h"
13#include "WSText.h"
14#include "Components/HorizontalBox.h"
15#include "Components/Overlay.h"
16#include "Components/VerticalBox.h"
17#include "Widgets/WSBase.h"
18#include "Components/NamedSlot.h"
19#include "WSLabel.generated.h"
20
24UCLASS()
25class WIDGETSTUDIORUNTIME_API UWidgetStudioLabel : public UWidgetStudioBase
26{
27 GENERATED_BODY()
28
29protected:
30
31 virtual TSharedRef<SWidget> RebuildWidget() override;
32 virtual int32 NativePaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
33 virtual void SynchronizeProperties() override;
34 virtual void InitializeStyling() override;
35 virtual void UpdateStyling() override;
36
37 // Widget Components
38
39 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
40 UOverlay* Retainer = nullptr;
41
42 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
43 UHorizontalBox* HBox = nullptr;
44
45 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
46 UVerticalBox* VBox = nullptr;
47
48 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
49 UWidgetStudioText* TextItem = nullptr;
50
51 UPROPERTY(BlueprintReadOnly, Category = "Widgets", meta=(BindWidget))
52 UNamedSlot* WidgetSlot = nullptr;
53
54 // Properties
55
57 UPROPERTY(EditAnywhere, Category = "Widget Studio", Meta = (DisplayName = "Text"))
58 FText LabelText = FText().FromString("Label");
59
61 UPROPERTY(EditAnywhere, Category = "Widget Studio")
63
65 UPROPERTY(EditAnywhere, Category = "Widget Studio", Meta = (DisplayName = "Placement"))
66 EWSPlacement LabelPlacement = EWSPlacement::Left;
67
69 UPROPERTY(EditAnywhere, Category = "Widget Studio", meta=(UIMin="5", ClampMin="5", DisplayName = "Spacing"))
70 float LabelPadding = 30.0f;
71
72public:
73
74 // Helper Functions
75
77 UFUNCTION(BlueprintPure, Category = "Widget Studio|Helper")
78 FText GetLabelText() const;
79
81 UFUNCTION(BlueprintPure, Category = "Widget Studio|Helper")
82 FWSTextStyle GetLabelOptions() const;
83
85 UFUNCTION(BlueprintPure, Category = "Widget Studio|Helper")
86 EWSPlacement GetLabelPlacement() const;
87
89 UFUNCTION(BlueprintPure, Category = "Widget Studio|Helper")
90 float GetLabelPadding() const;
91
93 UFUNCTION(BlueprintPure, Category = "Widget Studio|Helper")
94 UWidget* GetSlottedWidget() const;
95
96 // Modifier Functions
97
99 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Modifier")
100 void SetLabelText(FText NewText);
101
106 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Modifier")
107 void SetLabelOptions(FWSTextStyle NewLabelOptions);
108
113 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Modifier")
114 void SetLabelPlacement(EWSPlacement NewPlacement);
115
120 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Modifier")
121 void SetLabelPadding(float NewPadding);
122};
The base User Widget class for Widget Studio.
Definition: WSBase.h:32
A widget that displays a text label and accepts a single widget as a child.
Definition: WSLabel.h:26
A custom text widget setup to work with the Typography Styling.
Definition: WSText.h:92
The settings for the Widget Studio Text.
Definition: WSText.h:23