Widget Studio
WSModernComboBox.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/Modern/WSModernButton.h"
14
15#include "Widgets/WSContainer.h"
16#include "Widgets/Modern/WSModernTabBar.h"
17#include "Components/InvalidationBox.h"
18#include "Components/MenuAnchor.h"
19
20#include "WSModernComboBox.generated.h"
21
25UCLASS()
26class WIDGETSTUDIORUNTIME_API UWidgetStudioModernComboBox : public UWidgetStudioContainer
27{
28 GENERATED_BODY()
29
30protected:
31
32 virtual TSharedRef<SWidget> RebuildWidget() override;
33 virtual int32 NativePaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
34 virtual void SynchronizeProperties() override;
35 virtual void InitializeStyling() override;
36 virtual void UpdateStyling() override;
37
38 virtual FReply NativeOnMouseButtonDown(const FGeometry& InGeometry, const FPointerEvent& InMouseEvent) override;
39
40 UFUNCTION()
41 void OnMenuButtonSelected(int32 Index, FButtonOptions Option);
42
43 UFUNCTION()
44 UUserWidget* ConstructMenu() const;
45
46 /* * Widget Components */
47
48 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
49 UInvalidationBox* Retainer = nullptr;
50
51 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
52 UVerticalBox* VBox = nullptr;
53
54 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
55 UWidgetStudioText* LabelItem = nullptr;
56
57 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
58 USizeBox* ContentSizeBox = nullptr;
59
60 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
61 UScaleBox* ContentScaleBox = nullptr;
62
63 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
64 UOverlay* ContentOverlay = nullptr;
65
66 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
67 UImage* DropShadow = nullptr;
68
69 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
70 UImage* Background = nullptr;
71
72 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
73 UHorizontalBox* HBox = nullptr;
74
75 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
76 UWidgetStudioIcon* IconItem = nullptr;
77
78 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
79 UWidgetStudioText* TextItem = nullptr;
80
81 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
82 UScaleBox* ArrowScaleBox = nullptr;
83
84 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
85 UWidgetStudioIcon* ArrowItem = nullptr;
86
87 UPROPERTY(BlueprintReadOnly, Category = "Widgets")
88 UMenuAnchor* MenuAnchor = nullptr;
89
90private:
91
92 // General Properties
93
95 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."))
96 FText Label;
97
99 UPROPERTY(EditAnywhere, Category = "Widget Studio")
100 FText PlaceholderText = FText().FromString("Select option");
101
103 UPROPERTY(EditAnywhere, Category = "Widget Studio")
104 TEnumAsByte<EHorizontalAlignment> ContentAlignment = HAlign_Left;
105
107 UPROPERTY(EditAnywhere, Category = "Widget Studio|Text", meta = (DisplayName = "Text Style"))
108 FWSTextStyle TextStyle = FWSTextStyle(
109 EWSFontType::Button,
110 FFontStyle(),
111 EFontCase::Sentence,
112 ETextJustify::Center,
113 false,
114 0,
115 ETextWrappingPolicy::DefaultWrapping);
116
121 UPROPERTY(EditAnywhere, Category = "Widget Studio|Icon")
122 EWSPlacement IconPlacement;
123
125 UPROPERTY(EditAnywhere, Category = "Widget Studio|Icon", meta = (DisplayName = "Icon Style"))
126 FWSIconStyle IconStyle;
127
128 // Colors Properties
129
131 UPROPERTY(EditAnywhere, Category = "Widget Studio|Color")
132 EPalette BackgroundColor = EPalette::TertiaryBackground;
133
135 UPROPERTY(EditAnywhere, Category = "Widget Studio|Color")
136 EPalette ContentColor = EPalette::PrimaryContent;
137
139 UPROPERTY(EditAnywhere, Category = "Widget Studio|Color")
140 EPalette SelectionColor = EPalette::PrimaryAccent;
141
143 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."))
144 EPalette LabelColor = EPalette::PrimaryContent;
145
146
147 // Style Properties
148
150 UPROPERTY(EditAnywhere, Category = "Widget Studio|Style")
151 ECornerStyle CornerStyle = ECornerStyle::Rounded;
152
153 // Scroll Properties
154
156 UPROPERTY(EditAnywhere, Category = "Widget Studio|Style")
157 float MenuHeight = 225;
158
159 // State Properties
160
162 UPROPERTY(EditAnywhere, Category = "Widget Studio|State")
163 bool bIsSelectable = true;
164
165
166
167public:
168 // Overrides
169 virtual void SetCurrentIndex(int32 Index, bool bBroadcast) override;
170
171 // Helpers
172
174 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."))
175 FText GetLabel() const;
176
178 UFUNCTION(BlueprintPure, Category = "Widget Studio|Helper")
179 FText GetPlaceholderText() const;
180
182 UFUNCTION(BlueprintPure, Category = "Widget Studio|Helper")
183 ECornerStyle GetCornerStyle() const;
184
186 UFUNCTION(BlueprintPure, Category = "Widget Studio|Helper|Color")
187 EPalette GetBackgroundColor() const;
188
190 UFUNCTION(BlueprintPure, Category = "Widget Studio|Helper|Color")
191 EPalette GetContentColor() const;
192
194 UFUNCTION(BlueprintPure, Category = "Widget Studio|Helper|Color")
195 EPalette GetSelectionColor() const;
196
198 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."))
199 EPalette GetLabelColor() const;
200
202 UFUNCTION(BlueprintPure, Category = "Widget Studio|Helper|Color")
203 bool IsSelectable() const;
204
205
206 // Modifiers
207
212 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."))
213 void SetLabel(FText NewLabel);
214
219 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Modifier")
220 void SetPlaceholderText(FText NewText);
221
226 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Modifier")
227 void SetCornerStyle(ECornerStyle NewStyle);
228
233 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Modifier")
234 void SetBackgroundColor(EPalette NewColor);
235
240 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Modifier")
241 void SetContentColor(EPalette NewColor);
242
247 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Modifier")
248 void SetSelectionColor(EPalette NewColor);
249
254 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."))
255 void SetLabelColor(EPalette NewColor);
256
261 UFUNCTION(BlueprintCallable, Category = "Widget Studio|Modifier")
262 void SetSelectable(bool NewState);
263
264};
265
A base class for building a option container such as a tab bar or combo box.
Definition: WSContainer.h:26
A pre-setup widget that works with power of two icons.
Definition: WSIcon.h:53
A modern styled combo box.
Definition: WSModernComboBox.h:27
A custom text widget setup to work with the Typography Styling.
Definition: WSText.h:92
Contains the data for a Widget Studio Modern Button.
Definition: WSModernButton.h:73
Struct with font weight, size, and letter spacing.
Definition: WSTypography.h:23
The settings for the Widget Studio Icon Widget.
Definition: WSIcon.h:27
The settings for the Widget Studio Text.
Definition: WSText.h:23