Widget Studio
WSFunctionLibrary.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 "Components/EditableTextBox.h"
14#include "Components/Image.h"
15#include "Components/PanelWidget.h"
16#include "Components/SizeBox.h"
17#include "Components/TextBlock.h"
18#include "Kismet/BlueprintFunctionLibrary.h"
19#include "Theme/WSIconSet.h"
20#include "Theme/WSTheme.h"
21#include "Theme/WSTypography.h"
22#include "WSFunctionLibrary.generated.h"
23
27UCLASS(BlueprintType, Blueprintable)
28class WIDGETSTUDIORUNTIME_API UWidgetStudioFunctionLibrary : public UBlueprintFunctionLibrary
29{
30 GENERATED_BODY()
31
32public:
33
34 /* Color */
35
39 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Color")
40 static FLinearColor GetColorFromPalette(EPalette Color);
41
46 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Color", Meta = (MinClamp = "0.0", MaxClamp = "0.0"))
47 static FLinearColor GetColorBasedValue(float ValuePercent, bool bReverseOrder = false);
48
53 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Color", Meta = (MinClamp = "0.0", MaxClamp = "0.0"))
54 static EPalette GetPaletteBasedValue(float ValuePercent, bool bReverseOrder = false);
55
56
57 /* Style */
58
60 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Style")
61 static UTexture2D* GetTextureFromIconLibrary(EIconItem Icon);
62
64 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Style")
65 static FVector2D GetControlDimensions();
66
77 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Style")
78 static float GetSizeByModifier(const ESizeModifier Modifier, const float InSize);
79
81 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Style")
82 static float GetBorderRadius();
83
85 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Style")
86 static UWidgetStudioTheme* GetCurrentTheme();
87
89 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Style")
90 static UWidgetStudioTypography* GetCurrentTypography();
91
93 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Style")
94 static UWidgetStudioIconSet* GetCurrentIconSet();
95
103 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Style")
104 static bool SetTheme(const TSoftObjectPtr<UWidgetStudioTheme> NewTheme);
105
113 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Style")
114 static bool SetTypography(const TSoftObjectPtr<UWidgetStudioTypography> NewTypography);
115
123 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Style")
124 static bool SetIconSet(const TSoftObjectPtr<UWidgetStudioIconSet> NewIconSet);
125
130 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Style")
131 static FSlateBrush GetRoundedSlateBrush();
132
136 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Style")
137 static FScrollBarStyle GetScrollBarStyle();
138
139 /* Animation */
140
142 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Function Library|Animation")
143 static void InterpWidgetColor(UUserWidget* Widget, EPalette TargetColor, float Speed);
144
146 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Function Library|Animation")
147 static void InterpImageColor(UImage* Widget, EPalette TargetColor, float Speed);
148
150 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Function Library|Animation")
151 static void InterpTextColor(UTextBlock* Widget, EPalette TargetColor, float Speed);
152
154 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Function Library|Animation")
155 static void InterpEditableTextBoxColor(UEditableTextBox* Widget, EPalette TargetColor, float Speed);
156
158 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Function Library|Animation")
159 static void InterpSizeBoxOverrides(USizeBox* Widget, float TargetWidth, float TargetHeight, float Speed, bool bIgnoreZero = true);
160
162 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Function Library|Animation")
163 static void InterpSizeBoxMinOverrides(USizeBox* Widget, float TargetWidth, float TargetHeight, float Speed);
164
166 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Function Library|Animation")
167 static void InterpWidgetTranslation(UWidget* Widget, const FVector2D TargetTranslation, const float Speed);
168
170 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Function Library|Animation")
171 static void InterpWidgetScale(UWidget* Widget, const FVector2D TargetScale, const float Speed);
172
174 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Function Library|Animation")
175 static void InterpWidgetRotation(UWidget* Widget, const float TargetRotation, const float Speed);
176
178 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Function Library|Animation")
179 static void InterpWidgetOpacity(UWidget* Widget, float TargetOpacity, float Speed);
180
182 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Function Library|Animation")
183 static void InterpBrushImageSize(UImage* Image, float TargetWidth, float TargetHeight, float Speed);
184
185
186 /* Material */
187
189 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Material")
190 static UMaterialInterface* GetRoundedBackgroundMaterial();
191
193 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Material")
194 static UMaterialInterface* GetRoundedOutlineMaterial();
195
197 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Material")
198 static UMaterialInterface* GetRoundedShadowMaterial();
199
200
201 /* Typography */
202
204 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Typography")
205 static UFont* GetTypefaceFromTypography();
206
208 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Typography")
209 static bool ContainsNumbers(FText InText);
210
212 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Typography")
213 static FText FilterByCharacterLimit(const FText InText, const int32 CharacterLimit);
214
216 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Function Library|Typography")
217 static FSlateFontInfo ConstructFontInfoFromTypography(const EWSFontType FontType);
218
220 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Function Library|Typography")
221 static FSlateFontInfo ConstructFontInfoFromStyle(const FFontStyle FontStyle);
222
224 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Typography")
225 static FFontStyle GetTypeScaleFromTypography(const EWSFontType FontType);
226
228 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Typography")
229 static FName GetFontWeightName(EFontWeight FontWeight);
230
231
232 /* Utility / Helper functions */
233
242 UFUNCTION(BlueprintPure, Category = "Widget Studio|Function Library|Helper")
243 static float GetAdjustedPercent(float Value, float Min, float Max);
244};
A collection of useful Widget Studio functions.
Definition: WSFunctionLibrary.h:29
Data asset that contains the current theme icon set.
Definition: WSIconSet.h:25
Data asset that contains the current theme color palette.
Definition: WSTheme.h:21
Data asset that contains the current theme font and its styling.
Definition: WSTypography.h:41
Struct with font weight, size, and letter spacing.
Definition: WSTypography.h:23