UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SWizard.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "SlateFwd.h"
8#include "Misc/Attribute.h"
9#include "Layout/Visibility.h"
10#include "Styling/SlateColor.h"
12#include "Input/Reply.h"
13#include "Widgets/SWidget.h"
17#include "Styling/SlateTypes.h"
18#include "Styling/CoreStyle.h"
20#include "Styling/AppStyle.h"
21
29
30
33class SWizard
34 : public SCompoundWidget
35{
36public:
37
41 class FWizardPage
42 {
43 public:
44
47 , _CanShow(true)
48 , _PageContent()
49 { }
50
53
54
56
57
59
60
62
63
65
66
68
70
71 public:
72
78 FWizardPage( const FArguments& InArgs )
80 , Showable(InArgs._CanShow)
84 , Name(InArgs._Name)
85 { }
86
87 public:
88
94 bool CanShow() const
95 {
96 return Showable.Get();
97 }
98
100 FText GetName() const
101 {
102 return Name.Get();
103 }
104
111 {
112 return ButtonContent.Widget;
113 }
114
121 {
122 return PageContent.Widget;
123 }
124
131 {
132 return OnEnterDelegate;
133 }
134
141 {
142 return OnLeaveDelegate;
143 }
144
145 private:
146
147 // Holds the button content.
149
150 // Holds a flag indicating whether this page can be activated.
152
153 // Holds a delegate to be invoked when the page is activated.
155
156 // Holds a delegate to be invoked when the page is deactivated.
158
159 // Holds the page content.
161
162 // Holds the name of the page.
164 };
165
166public:
167
169 : _ButtonStyle(&FAppStyle::Get().GetWidgetStyle<FButtonStyle>("Button"))
170 , _CancelButtonStyle(&FAppStyle::Get().GetWidgetStyle<FButtonStyle>("Button"))
171 , _FinishButtonStyle(&FAppStyle::Get().GetWidgetStyle<FButtonStyle>("PrimaryButton"))
172 , _ButtonTextStyle(&FAppStyle::Get().GetWidgetStyle<FTextBlockStyle>("DialogButtonText"))
174 , _FinishButtonText(NSLOCTEXT("SWizard", "DefaultFinishButtonText", "Finish"))
175 , _FinishButtonToolTip(NSLOCTEXT("SWizard", "DefaultFinishButtonTooltip", "Finish the wizard"))
177 , _DesiredSize(FVector2D(0, 0))
181 , _BreadcrumbButtonStyle(&FCoreStyle::Get().GetWidgetStyle< FButtonStyle >("BreadcrumbButton"))
182 , _BreadcrumbTextStyle(&FCoreStyle::Get().GetWidgetStyle< FTextBlockStyle >("NormalText"))
185 , _PageTitleTextStyle(&FCoreStyle::Get().GetWidgetStyle< FTextBlockStyle >("Wizard.PageTitle"))
186 , _PageFooter()
187 { }
188
190
191
193
194
195 SLATE_STYLE_ARGUMENT(FButtonStyle, CancelButtonStyle)
196
197
199
200
202
203
205
206
208
209
211
212
214
215
216 SLATE_ATTRIBUTE(FVector2D, DesiredSize)
217
218
219 SLATE_EVENT(FSimpleDelegate, OnCanceled)
220
221
222 SLATE_EVENT(FSimpleDelegate, OnFinished)
223
224
226
227
233
234
241
242
244
245
247
248
250
251
253
256
259
260
262
263
265
267 SLATE_NAMED_SLOT(FArguments, PageFooter)
268
270
271public:
272
279 APPFRAMEWORK_API bool CanShowPage( int32 PageIndex ) const;
280
286 APPFRAMEWORK_API void Construct( const FArguments& InArgs );
287
293 APPFRAMEWORK_API int32 GetNumPages() const;
294
300
307 APPFRAMEWORK_API int32 GetPageIndex( const TSharedPtr<SWidget>& PageWidget ) const;
308
314 APPFRAMEWORK_API void ShowPage( int32 PageIndex );
315
317 APPFRAMEWORK_API void AdvanceToPage( int32 PageIndex );
318
321
322public:
323
324 // SCompoundWidget interface
325
326 APPFRAMEWORK_API virtual FVector2D ComputeDesiredSize(float) const override;
327
328public:
329
336 static FWizardPage::FArguments Page()
337 {
338 FWizardPage::FArguments Args;
339 return Args;
340 }
341
342private:
343
344 // Callback for clicking the 'Cancel' button.
345 APPFRAMEWORK_API FReply HandleCancelButtonClicked();
346
347 // Callback for clicking the 'Launch' button.
349
350 // Callback for clicking the 'Next' button.
351 APPFRAMEWORK_API FReply HandleNextButtonClicked();
352
353 // Callback for getting the enabled state of the 'Next' button.
355
356 // Callback for getting the visibility of the 'Next' button.
358
359 // Callback for getting the checked state of a page button.
361
362 // Callback for clicking a page button.
364
365 // Callback for getting the enabled state of a page button.
366 APPFRAMEWORK_API bool HandlePageButtonIsEnabled( int32 PageIndex ) const;
367
368 // Callback for clicking the 'Previous' button.
370
371 // Callback for getting the enabled state of the 'Previous' button.
373
374 // Callback for getting the visibility of the 'Previous' button.
376
377 // Callback for when a breadcrumb is clicked.
378 APPFRAMEWORK_API void HandleBreadcrumbClicked(const int32& PageIndex);
379
380 // Get the next page index to display.
382
383 // Get the previous page index to display.
385
386 // Get the page title to display for the current page.
388
389private:
390
391 // Holds the wizard's desired size.
392 FVector2D DesiredSize;
393
394 // Holds the collection of wizard pages.
396
397 // Holds the widget switcher.
399
400 // Holds the breadcrumb trail.
401 TSharedPtr<SBreadcrumbTrail<int32>> BreadcrumbTrail;
402
403 // Whether to show the "Previous" and "Next" buttons
405
407
408private:
409
410 // Holds a delegate to be invoked when the 'Cancel' button has been clicked.
411 FSimpleDelegate OnCanceled;
412
413 // Holds a delegate to be invoked when the 'Finish' button has been clicked.
414 FSimpleDelegate OnFinished;
415
416 // Holds a delegate to be invoked when the 'Next' button has been clicked.
418
419 // Holds a delegate to be invoked when the 'Previous' button has been clicked.
421
422 // Holds a delegate to be invoked when the 'Previous' button has been clicked on the first page.
424
425 // Exposes a delegate to be invoked to control whether the 'Next' button is enabled, and where to attempt to move to if it is clicked.
427
428 // Exposes a delegate to be invoked when the wizard's 'Next' button is clicked to allow redirection to another page if processing fails
430};
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define SLATE_NAMED_SLOT(DeclarationType, SlotName)
Definition DeclarativeSyntaxSupport.h:437
#define SLATE_STYLE_ARGUMENT(ArgType, ArgName)
Definition DeclarativeSyntaxSupport.h:280
#define SLATE_ATTRIBUTE(AttrType, AttrName)
Definition DeclarativeSyntaxSupport.h:192
#define SLATE_BEGIN_ARGS(InWidgetType)
Definition DeclarativeSyntaxSupport.h:63
#define SLATE_SUPPORTS_SLOT_WITH_ARGS(SlotType)
Definition DeclarativeSyntaxSupport.h:330
#define SLATE_EVENT(DelegateName, EventName)
Definition DeclarativeSyntaxSupport.h:458
#define SLATE_END_ARGS()
Definition DeclarativeSyntaxSupport.h:116
#define SLATE_DEFAULT_SLOT(DeclarationType, SlotName)
Definition DeclarativeSyntaxSupport.h:444
#define SLATE_ARGUMENT(ArgType, ArgName)
Definition DeclarativeSyntaxSupport.h:208
#define DECLARE_DELEGATE_RetVal_OneParam(ReturnValueType, DelegateName, Param1Type)
Definition DelegateCombinations.h:54
return true
Definition ExternalRpcRegistry.cpp:601
#define NSLOCTEXT(InNamespace, InKey, InTextLiteral)
Definition Internationalization.h:300
void Construct(const FArguments &InArgs)
ECheckBoxState
Definition SlateTypes.h:65
Definition AppStyle.h:24
Definition CoreStyle.h:15
Definition Reply.h:24
Definition Text.h:385
Definition SCompoundWidget.h:22
Definition SWidget.h:165
Definition Attribute.h:17
Definition IndirectArray.h:20
Definition SharedPointer.h:692
Definition SharedPointer.h:153
IMAGECORE_API const TCHAR * GetName(Type Format)
Definition ImageCore.cpp:1378
@ OnEnter
Definition SlateEnums.h:295
FORCEINLINE T * Get(const FObjectPtr &ObjectPtr)
Definition ObjectPtr.h:426
@ false
Definition radaudio_common.h:23
Definition Visibility.h:12
Definition SlateTypes.h:509
Definition SlateTypes.h:326
Definition DeclarativeSyntaxSupport.h:392