Widget Studio
WSBase.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 "Blueprint/UserWidget.h"
14
15/* Hierarchical Includes - Do Not Remove */
16#include "Types/WSEnums.h"
17#include "WSFunctionLibrary.h"
18#include "WSSubsystem.h"
19
20#include "WSBase.generated.h"
21
23
24DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FWSBaseHoverStateDelegate, UWidgetStudioBase*, CallingWidget, bool, bIsHovering);
25
30UCLASS(Blueprintable, HideCategories="Developer")
31class WIDGETSTUDIORUNTIME_API UWidgetStudioBase : public UUserWidget
32{
33 GENERATED_BODY()
34
35protected:
36
37 /*
38 * Initializes and sets up the initial Widget Styling.
39 * - This function should be overriden in a child widget.
40 * - This function should be placed at the end of the RebuildWidget() function
41 */
42 virtual void InitializeStyling();
43
44 /*
45 * Updates the Widget styling. This is primarily to make sure that any styling updates are kept dynamic.
46 * - This function should be overriden in a child widget.
47 * - This function should be placed and used when deemed necessary, for example, within the SynchronizeProperties() function.
48 * - Make sure that static (non-updating) styling is not placed here and is instead placed in the InitializeStyling() function
49 * - Do NOT call on tick or OnPaint.
50 */
51 virtual void UpdateStyling();
52
53 /* Used for event passthroughs */
54 virtual void NativeOnMouseEnter(const FGeometry& InGeometry, const FPointerEvent& InMouseEvent) override;
55 virtual void NativeOnMouseLeave(const FPointerEvent& InMouseEvent) override;
56 virtual void NativeOnMouseCaptureLost(const FCaptureLostEvent& CaptureLostEvent) override;
57
58public:
59
60 // Bindings
61
63 UPROPERTY(BlueprintAssignable, Category = "Widget Studio|Event")
64 FWSBaseHoverStateDelegate OnHoverStateChanged;
65
66 // Properties
67
71 UPROPERTY(EditDefaultsOnly, Category = "Developer")
73
77 UPROPERTY(EditDefaultsOnly, Category = "Developer")
79
83 UPROPERTY(EditAnywhere, Category = "Developer", Meta = (ClampMin = "0", UIMin = "0"))
84 FVector2D MinimumDimensions = FVector2D(50, 7);
85
90 UPROPERTY(EditAnywhere, Category = "Developer")
91 bool bDisablePainting = false;
92
98 UPROPERTY(EditAnywhere, Category = "Widget Studio", AdvancedDisplay)
99 float AnimationTime = 7;
100
112 UPROPERTY(EditAnywhere, Category = "Widget Studio", AdvancedDisplay)
113 ESizeModifier SizeModifier = ESizeModifier::Regular;
114
120 UPROPERTY(EditAnywhere, Category = "Widget Studio", AdvancedDisplay, Meta = (ClampMin = "0", UIMin = "0", AxisName="Width", YAxisName="Height", EditCondition="bCanOverrideDimensions", EditConditionHides))
121 FVector2D OverrideDimensions = FVector2D(0, 0);
122
128 UPROPERTY(EditAnywhere, Category = "Widget Studio", AdvancedDisplay, Meta = (ClampMin = "-1", UIMin = "-1", EditCondition="bCanOverrideBorderRadius", EditConditionHides))
130
131
132 // Helper Functions
133
138 UFUNCTION(BlueprintPure, Category = "Widget Studio")
139 FVector2D GetDimensions() const;
140
145 UFUNCTION(BlueprintPure, Category = "Widget Studio")
146 int32 GetBorderRadius() const;
147
148
149 // Modifier Functions
150
152 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Advanced")
153 void ForceStyleUpdate();
154
156 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Advanced")
157 void SetSizeModifier(ESizeModifier InSizeModifier);
158};
The base User Widget class for Widget Studio.
Definition: WSBase.h:32
bool bDisablePainting
Used for debugging.
Definition: WSBase.h:91
int32 OverrideBorderRadius
Manually adjust the border radius of the widget.
Definition: WSBase.h:129
FWSBaseHoverStateDelegate OnHoverStateChanged
Called when the hover state has been changed.
Definition: WSBase.h:64
void SetSizeModifier(ESizeModifier InSizeModifier)
Set the size modifier of the Widget Studio widget.
Definition: WSBase.cpp:64
ESizeModifier SizeModifier
Quickly modify the overall size of the widget.
Definition: WSBase.h:113
bool bCanOverrideBorderRadius
Used to enable or disable dimension override's.
Definition: WSBase.h:78
FVector2D GetDimensions() const
Returns the current X and Y dimensions of the Widget.
Definition: WSBase.cpp:41
void ForceStyleUpdate()
Refresh the dynamic styling of the Widget Studio widget.
Definition: WSBase.cpp:59
float AnimationTime
The animation interpolation speed.
Definition: WSBase.h:99
FVector2D OverrideDimensions
Manually adjust the X and Y dimensions of the widget.
Definition: WSBase.h:121
FVector2D MinimumDimensions
The minimum dimensions of the widget.
Definition: WSBase.h:84
int32 GetBorderRadius() const
Returns the current border radius of the Widget.
Definition: WSBase.cpp:54
bool bCanOverrideDimensions
Used to enable or disable dimension override's.
Definition: WSBase.h:72