Widget Studio
WSModernProgressBar.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/WSBase.h"
14#include "Components/Image.h"
15#include "Components/InvalidationBox.h"
16#include "Components/Overlay.h"
17#include "Components/ScaleBox.h"
18#include "Components/SizeBox.h"
19
20#include "WSModernProgressBar.generated.h"
21
22DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FWSProgressBarDelegate, float, NewValue);
23
27UCLASS()
28class WIDGETSTUDIORUNTIME_API UWidgetStudioModernProgressBar : public UWidgetStudioBase
29{
30 GENERATED_BODY()
31
32protected:
33
34 virtual TSharedRef<SWidget> RebuildWidget() override;
35 virtual int32 NativePaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
36 virtual void SynchronizeProperties() override;
37 virtual void InitializeStyling() override;
38 virtual void UpdateStyling() override;
39
40 /* Internal Properties */
41
42 UPROPERTY()
43 bool bForwardProgress = true;
44
45 /* Widget Components */
46
47 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
48 UInvalidationBox* Retainer = nullptr;
49
50 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
51 USizeBox* SizeBox = nullptr;
52
53 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
54 UOverlay* Overlay = nullptr;
55
56 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
57 UScaleBox* TrackScaleBox = nullptr;
58
59 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
60 UOverlay* TrackOverlay = nullptr;
61
62 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
63 UImage* Track = nullptr;
64
65 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
66 UImage* TrackDropShadow = nullptr;
67
68 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
69 USizeBox* FillTrackSizeBox = nullptr;
70
71 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
72 UImage* FillTrack = nullptr;
73
74 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
75 USizeBox* IndicatorSizeBox = nullptr;
76
77 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
78 UImage* Indicator = nullptr;
79
80
81private:
82 /* Bindings */
83
84 UPROPERTY(BlueprintAssignable, Category = "Widget Studio|Event")
85 FWSProgressBarDelegate OnProgressChanged;
86
87 /* Properties */
88
90 UPROPERTY(EditAnywhere, Category="Widget Studio", Meta = (ClampMin = "0", ClampMax = "100", Units="Percent"))
91 float Percent = 50;
92
94 UPROPERTY(EditAnywhere, Category="Widget Studio")
95 bool bDisplayIndicator = true;
96
98 UPROPERTY(EditAnywhere, Category="Widget Studio|Color")
99 EPalette TrackColor = EPalette::TertiaryBackground;
100
102 UPROPERTY(EditAnywhere, Category="Widget Studio|Color")
103 EPalette FillColor = EPalette::PrimaryAccent;
104
105public:
106
107 /* Helpers */
108
110 UFUNCTION(BlueprintPure, Category="Widget Studio|Helper")
111 float GetProgress() const;
112
114 UFUNCTION(BlueprintPure, Category="Widget Studio|Helper")
115 bool IsIndicatorVisible() const;
116
118 UFUNCTION(BlueprintPure, Category="Widget Studio|Helper")
119 EPalette GetTrackColor() const;
120
122 UFUNCTION(BlueprintPure, Category="Widget Studio|Helper")
123 EPalette GetFillColor() const;
124
125 /* Modifier Functions */
126
131 UFUNCTION(BlueprintCallable, Category="Widget Studio|Modifier")
132 void SetProgress(float NewValue);
133
138 UFUNCTION(BlueprintCallable, Category="Widget Studio|Modifier")
139 void SetIndicatorVisibility(bool bNewState);
140
145 UFUNCTION(BlueprintCallable, Category="Widget Studio|Modifier")
146 void SetTrackColor(EPalette NewColor);
147
152 UFUNCTION(BlueprintCallable, Category="Widget Studio|Modifier")
153 void SetFillColor(EPalette NewColor);
154};
155
The base User Widget class for Widget Studio.
Definition: WSBase.h:32
A modern styled progress bar.
Definition: WSModernProgressBar.h:29