Widget Studio
WSModernCard.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
19#include "WSModernCard.generated.h"
20
21UENUM(Blueprintable, BlueprintType, META=(Tooltip = "Depicts the background style target of the widget."))
22enum class EBackgroundStyle : uint8
23{
24 Solid UMETA(DisplayName="Solid"),
25 OutLine UMETA(DisplayName="Outline"),
26
27 BackgroundStyle_Max UMETA(Hidden),
28};
29
30
31UENUM(Blueprintable, BlueprintType, META=(Tooltip = "The roundness style of the widget corners."))
32enum class ECornerStyle : uint8
33{
34 Rounded UMETA(DisplayName = "Rounded"),
35 Pill UMETA(DisplayName = "Pill"),
36
37 CornerStyle_Max UMETA(Hidden),
38};
39
40UENUM(Blueprintable, BlueprintType, META=(Tooltip = "The style of the widget drop shadows."))
41enum class EShadowStyle : uint8
42{
43 None UMETA(DisplayName="None"),
44 Small UMETA(DisplayName="Short"),
45 Long UMETA(DisplayName="Long"),
46
47 ButtonShadowStyle_Max UMETA(Hidden),
48};
49
53UCLASS()
54class WIDGETSTUDIORUNTIME_API UWidgetStudioModernCard : public UWidgetStudioBase
55{
56 GENERATED_BODY()
57
58protected:
59
60 virtual TSharedRef<SWidget> RebuildWidget() override;
61 virtual int32 NativePaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
62 virtual void SynchronizeProperties() override;;
63 virtual void InitializeStyling() override;
64 virtual void UpdateStyling() override;
65
66 // Internal Properties
67 const float BaseDropShadowOpacity = .5;
68
69 UPROPERTY()
70 mutable float ShadowLength;
71
72 // Widget Components
73
74 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
75 USizeBox* SizeBox = nullptr;
76
77 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
78 UScaleBox* ScaleBox = nullptr;
79
80 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
81 UOverlay* Overlay = nullptr;
82
83 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
84 UImage* DropShadow = nullptr;
85
86 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
87 UImage* Background = nullptr;
88
89private:
90 // Properties
91
93 UPROPERTY(EditAnywhere, Category="Widget Studio")
94 EPalette Color = EPalette::PrimaryBackground;
95
97 UPROPERTY(EditAnywhere, Category = "Widget Studio|Style")
98 EShadowStyle ShadowStyle = EShadowStyle::Small;
99
101 UPROPERTY(EditAnywhere, Category = "Widget Studio|Style")
102 bool bEnableShadowHoverAnimation = false;
103
104public:
105 // Helpers
106
108 UFUNCTION(BlueprintPure, Category="Widget Studio|Helper")
109 EPalette GetColor() const;
110
112 UFUNCTION(BlueprintPure, Category="Widget Studio|Helper")
113 bool IsShadowHoverAnimationEnabled() const;
114
116 UFUNCTION(BlueprintPure, Category="Widget Studio|Helper")
117 EShadowStyle GetDropShadowStyle() const;
118
119 // Modifiers
120
125 UFUNCTION(BlueprintCallable, Category="Widget Studio|Modifier")
126 void SetColor(EPalette NewColor);
127
132 UFUNCTION(BlueprintCallable, Category="Widget Studio|Modifier")
133 void SetShadowHoverAnimationEnabled(bool NewState);
134
139 UFUNCTION(BlueprintCallable, Category="Widget Studio|Modifier")
140 void SetShadowStyle(EShadowStyle NewStyle);
141};
The base User Widget class for Widget Studio.
Definition: WSBase.h:32
A rounded card for background usage.
Definition: WSModernCard.h:55