Widget Studio
WSModernSlider.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 "Widgets/Basic/WSText.h"
14
15#include "Components/EditableTextBox.h"
16#include "Components/EditableText.h"
17#include "Components/HorizontalBox.h"
18#include "Components/Image.h"
19#include "Components/Overlay.h"
20#include "Components/ScaleBox.h"
21#include "Components/SizeBox.h"
22#include "Components/Slider.h"
23#include "Components/VerticalBox.h"
24#include "Types/SlateEnums.h"
25#include "Types/WSEnums.h"
26#include "Widgets/WSSliderBase.h"
27#include "WSModernSlider.generated.h"
28
32UCLASS()
33class WIDGETSTUDIORUNTIME_API UWidgetStudioModernSlider : public UWidgetStudioSliderBase
34{
35 GENERATED_BODY()
36
37protected:
38
39 virtual TSharedRef<SWidget> RebuildWidget() override;
40 virtual int32 NativePaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
41 virtual void SynchronizeProperties() override;
42 virtual void InitializeStyling() override;
43 virtual void UpdateStyling() override;
44
45 /* Delegates */
46
47 UFUNCTION()
48 void OnTextCommitted(const FText& InText, ETextCommit::Type InCommitMethod);
49
50 /* Widget Components */
51
52 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
53 UVerticalBox* VBox = nullptr;
54
55 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
56 USizeBox* SizeBox = nullptr;
57
58 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
59 UHorizontalBox* HBox = nullptr;
60
61 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
62 UOverlay* Overlay = nullptr;
63
64 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
65 UScaleBox* TrackScaleBox = nullptr;
66
67 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
68 UOverlay* TrackOverlay = nullptr;
69
70 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
71 UImage* Track = nullptr;
72
73 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
74 UImage* TrackDropShadow = nullptr;
75
76 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
77 USizeBox* FillTrackSizeBox = nullptr;
78
79 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
80 UImage* FillTrack = nullptr;
81
82 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
83 UScaleBox* HandleScaleBox = nullptr;
84
85 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
86 USizeBox* HandleSizeBox = nullptr;
87
88 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
89 UOverlay* HandleOverlay = nullptr;
90
91 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
92 UImage* HandleDropShadow = nullptr;
93
94 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
95 UImage* Handle = nullptr;
96
97 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
98 USlider* SliderItem = nullptr;
99
100 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
101 USizeBox* TextInputSizeBox = nullptr;
102
103 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
104 UEditableTextBox* TextInput = nullptr;
105
106 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
107 UWidgetStudioText* LabelItem = nullptr;
108
109private:
110 /* Internal Functions */
111
113 UFUNCTION()
114 void SyncSliderValue(float NewValue);
115
116 /* Properties */
117
119 UPROPERTY(EditAnywhere, Category = "Widget Studio|Advanced|Deprecated",Meta=(DeprecatedProperty, DeprecationMessage="Per-widget labeling is no longer supported. Place this widget in the Label Widget instead."))
120 FText Label;
121
123 UPROPERTY(EditAnywhere, Category="Widget Studio")
124 bool bEnableInput = true;
125
127 UPROPERTY(EditAnywhere, Category="Widget Studio")
128 bool bDisplayHandle = true;
129
131 UPROPERTY(EditAnywhere, Category="Widget Studio")
132 bool bDisplayValue = true;
133
134
135 /* Color */
136
138 UPROPERTY(EditAnywhere, Category="Widget Studio|Color")
139 bool bColorBasedOnValue = false;
140
142 UPROPERTY(EditAnywhere, Category="Widget Studio|Color", Meta = (EditCondition="bColorBasedOnValue == true", EditConditionHides))
143 bool bReverseColorOrder = false;
144
146 UPROPERTY(EditAnywhere, Category="Widget Studio|Color")
147 EPalette TrackColor = EPalette::TertiaryBackground;
148
150 UPROPERTY(EditAnywhere, Category="Widget Studio|Color", Meta = (EditCondition="bColorBasedOnValue == false", EditConditionHides))
151 EPalette HandleColor = EPalette::PrimaryAccent;
152
154 UPROPERTY(EditAnywhere, Category="Widget Studio|Color", Meta = (EditCondition="bDisplayValue == true", EditConditionHides))
155 EPalette TextColor = EPalette::PrimaryContent;
156
157public:
158
159
160 /* Helpers */
161
163 UFUNCTION(BlueprintPure, Category = "Widget Studio|Advanced|Deprecated",Meta=(DeprecatedProperty, DeprecationMessage="Per-widget labeling is no longer supported. Place this widget in the Label Widget instead."))
164 FText GetLabelText() const;
165
167 UFUNCTION(BlueprintPure, Category="Widget Studio|Helper")
168 bool IsValueVisible() const;
169
171 UFUNCTION(BlueprintPure, Category="Widget Studio|Helper")
172 bool IsHandleVisible() const;
173
175 UFUNCTION(BlueprintPure, Category="Widget Studio|Helper")
176 bool IsColorBasedOnValue() const;
177
179 UFUNCTION(BlueprintPure, Category="Widget Studio|Helper")
180 bool IsColorBasedOnValueReversed() const;
181
183 UFUNCTION(BlueprintPure, Category="Widget Studio|Helper")
184 bool IsInputEnabled() const;
185
186
187 /* Modifier Functions */
188
190 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Advanced|Deprecated",Meta=(DeprecatedProperty, DeprecationMessage="Per-widget labeling is no longer supported. Place this widget in the Label Widget instead."))
191 void SetLabelText(FText NewText);
192
197 UFUNCTION(BlueprintCallable, Category="Widget Studio|Modifier")
198 void SetValueVisibility(bool bNewState);
199
204 UFUNCTION(BlueprintCallable, Category="Widget Studio|Modifier")
205 void SetHandleVisibility(bool bNewState);
206
211 UFUNCTION(BlueprintCallable, Category="Widget Studio|Modifier")
212 void SetColorBasedOnValue(bool bNewState);
213
218 UFUNCTION(BlueprintCallable, Category="Widget Studio|Modifier")
219 void SetReverseColorOrder(bool bNewState);
220
225 UFUNCTION(BlueprintCallable, Category="Widget Studio|Modifier")
226 void SetInputState(bool NewState);
227};
A modern styled slider.
Definition: WSModernSlider.h:34
Base class for building sliders.
Definition: WSSliderBase.h:23
A custom text widget setup to work with the Typography Styling.
Definition: WSText.h:92