UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SCheckBox.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 "Misc/Attribute.h"
7#include "Layout/Margin.h"
8#include "Sound/SlateSound.h"
10#include "Input/Reply.h"
13#include "Widgets/SWidget.h"
15#include "Styling/SlateTypes.h"
16#include "Styling/CoreStyle.h"
18
19class SBorder;
20
21
24
25
30{
31public:
32
34 : _Content()
35 , _Style( &FCoreStyle::Get().GetWidgetStyle< FCheckBoxStyle >("Checkbox") )
36 , _Type()
42 , _Padding()
43 , _ClickMethod( EButtonClickMethod::DownAndUp )
46 , _ForegroundColor(FSlateColor::UseStyle())
49 , _UncheckedImage( nullptr )
50 , _UncheckedHoveredImage( nullptr )
51 , _UncheckedPressedImage( nullptr )
52 , _CheckedImage( nullptr )
53 , _CheckedHoveredImage( nullptr )
54 , _CheckedPressedImage( nullptr )
55 , _UndeterminedImage( nullptr )
56 , _UndeterminedHoveredImage( nullptr )
57 , _UndeterminedPressedImage( nullptr )
58 , _BackgroundImage( nullptr )
59 , _BackgroundHoveredImage( nullptr )
60 , _BackgroundPressedImage( nullptr )
61 {
62 }
63
65 SLATE_DEFAULT_SLOT( FArguments, Content )
66
67
69
70
72
73
75
76
78
79
81
82
84
85
87
88
90
91
93
94
96
97
99
100
101 SLATE_ATTRIBUTE( FSlateColor, ForegroundColor )
102
103
104 SLATE_ATTRIBUTE( FSlateColor, BorderBackgroundColor )
105
106 SLATE_ARGUMENT( bool, IsFocusable )
107
109
110
112
113
115
116
118
119
121
122
124
125
127
128
130
131
133
134
136
137
139
140
142
143
145
146
148
149
151
152
154
155
156
157
159
162
168 SLATE_API void Construct( const FArguments& InArgs );
169
170 // SWidget interface
181#if WITH_ACCESSIBILITY
183#endif
184 // End of SWidget interface
185
191 bool IsChecked() const
192 {
194 }
195
198
204 bool IsPressed() const
205 {
206 return bIsPressed;
207 }
208
213
216
219
222
224 SLATE_API void SetUncheckedImage(const FSlateBrush* Brush);
229
231 SLATE_API void SetCheckedImage(const FSlateBrush* Brush);
236
238 SLATE_API void SetUndeterminedImage(const FSlateBrush* Brush);
243
247
248protected:
249
252
259
265
269
273
277
280
284
285
286protected:
287
289
292
295
298
323
332
335
338
341
344
347
350
353
356
358 SLATE_API void PlayCheckedSound() const;
359
361 SLATE_API void PlayUncheckedSound() const;
362
364 SLATE_API void PlayHoverSound() const;
365
368
371
374
377
380
381protected:
384};
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define SLATE_STYLE_ARGUMENT(ArgType, ArgName)
Definition DeclarativeSyntaxSupport.h:280
#define SLATE_ATTRIBUTE(AttrType, AttrName)
Definition DeclarativeSyntaxSupport.h:192
#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_OneParam(DelegateName, Param1Type)
Definition DelegateCombinations.h:48
return true
Definition ExternalRpcRegistry.cpp:601
EHorizontalAlignment
Definition SlateEnums.h:174
EVerticalAlignment
Definition SlateEnums.h:194
ECheckBoxState
Definition SlateTypes.h:65
Definition CoreStyle.h:15
Definition Reply.h:24
Definition SBorder.h:31
Definition SCheckBox.h:30
SLATE_API void SetCheckedPressedImage(const FSlateBrush *Brush)
Definition SCheckBox.cpp:483
FSlateSound CheckedSound
Definition SCheckBox.h:376
SLATE_API bool IsPreciseTapOrClick(const FPointerEvent &MouseEvent) const
Definition SCheckBox.cpp:418
const FSlateBrush * UncheckedImage
Definition SCheckBox.h:300
const FSlateBrush * UndeterminedPressedImage
Definition SCheckBox.h:316
SLATE_API const FSlateBrush * GetCheckedImage() const
Definition SCheckBox.cpp:604
EButtonClickMethod::Type ClickMethod
Definition SCheckBox.h:343
SLATE_API void SetUndeterminedHoveredImage(const FSlateBrush *Brush)
Definition SCheckBox.cpp:493
FOnCheckStateChanged OnCheckStateChanged
Definition SCheckBox.h:297
FOnGetContent OnGetMenuContent
Definition SCheckBox.h:355
SLATE_API FMargin OnGetPadding() const
Definition SCheckBox.cpp:574
SLATE_API TEnumAsByte< EButtonClickMethod::Type > GetClickMethodFromInputType(const FPointerEvent &MouseEvent) const
Definition SCheckBox.cpp:400
SLATE_API const FSlateBrush * OnGetCheckImage() const
Definition SCheckBox.cpp:323
virtual SLATE_API void OnMouseLeave(const FPointerEvent &MouseEvent) override
Definition SCheckBox.cpp:277
TAttribute< FSlateColor > ForegroundColorOverride
Definition SCheckBox.h:327
SLATE_API const FSlateBrush * GetUncheckedImage() const
Definition SCheckBox.cpp:589
SLATE_API const FSlateBrush * GetUndeterminedPressedImage() const
Definition SCheckBox.cpp:629
const FSlateBrush * BackgroundImage
Definition SCheckBox.h:318
const FSlateBrush * UndeterminedImage
Definition SCheckBox.h:312
SLATE_API void SetUndeterminedPressedImage(const FSlateBrush *Brush)
Definition SCheckBox.cpp:498
bool IsPressed() const
Definition SCheckBox.h:204
SLATE_API void SetClickMethod(EButtonClickMethod::Type InClickMethod)
Definition SCheckBox.cpp:649
SLATE_BEGIN_ARGS(SCheckBox)
Definition SCheckBox.h:33
SLATE_API void SetContent(const TSharedRef< SWidget > &InContent)
Definition SCheckBox.cpp:438
SLATE_API void PlayHoverSound() const
Definition SCheckBox.cpp:433
SLATE_API void SetPressMethod(EButtonPressMethod::Type InPressMethod)
Definition SCheckBox.cpp:659
SLATE_API ESlateCheckBoxType::Type OnGetCheckBoxType() const
Definition SCheckBox.cpp:584
const FSlateBrush * UncheckedHoveredImage
Definition SCheckBox.h:302
TSharedPtr< SBorder > ContentContainer
Definition SCheckBox.h:383
SLATE_API FSlateColor OnGetBorderBackgroundColor() const
Definition SCheckBox.cpp:579
SLATE_API ECheckBoxState GetCheckedState() const
Definition SCheckBox.cpp:353
const FSlateBrush * UncheckedPressedImage
Definition SCheckBox.h:304
SLATE_API const FSlateBrush * GetUndeterminedHoveredImage() const
Definition SCheckBox.cpp:624
bool bIsPressed
Definition SCheckBox.h:291
TAttribute< ECheckBoxState > IsCheckboxChecked
Definition SCheckBox.h:294
SLATE_API const FSlateBrush * GetCheckedHoveredImage() const
Definition SCheckBox.cpp:609
virtual SLATE_API FReply OnMouseButtonDown(const FGeometry &MyGeometry, const FPointerEvent &MouseEvent) override
Definition SCheckBox.cpp:154
const FSlateBrush * CheckedImage
Definition SCheckBox.h:306
SLATE_API void SetStyle(const FCheckBoxStyle *InStyle)
Definition SCheckBox.cpp:443
virtual SLATE_API FReply OnMouseButtonUp(const FGeometry &MyGeometry, const FPointerEvent &MouseEvent) override
Definition SCheckBox.cpp:225
SLATE_API void Construct(const FArguments &InArgs)
Definition SCheckBox.cpp:30
SLATE_API const FSlateBrush * GetBackgroundHoveredImage() const
Definition SCheckBox.cpp:639
virtual SLATE_API FSlateColor GetForegroundColor() const
Definition SCheckBox.cpp:296
SLATE_API const FSlateBrush * GetUndeterminedImage() const
Definition SCheckBox.cpp:619
virtual SLATE_API FReply OnMouseButtonDoubleClick(const FGeometry &InMyGeometry, const FPointerEvent &InMouseEvent) override
Definition SCheckBox.cpp:212
SLATE_API void SetIsChecked(TAttribute< ECheckBoxState > InIsChecked)
Definition SCheckBox.cpp:395
const FCheckBoxStyle * Style
Definition SCheckBox.h:288
const FSlateBrush * BackgroundPressedImage
Definition SCheckBox.h:322
TEnumAsByte< EButtonTouchMethod::Type > TouchMethod
Definition SCheckBox.h:346
FSlateSound HoveredSound
Definition SCheckBox.h:373
SLATE_API const FSlateBrush * GetCheckedPressedImage() const
Definition SCheckBox.cpp:614
SLATE_API const FSlateBrush * OnGetBackgroundImage() const
Definition SCheckBox.cpp:347
SLATE_API void SetUncheckedPressedImage(const FSlateBrush *Brush)
Definition SCheckBox.cpp:468
TAttribute< FMargin > PaddingOverride
Definition SCheckBox.h:325
EVerticalAlignment CheckBoxImageVAlign
Definition SCheckBox.h:337
SLATE_API void BuildCheckBox(TSharedRef< SWidget > InContent)
Definition SCheckBox.cpp:503
TEnumAsByte< EButtonPressMethod::Type > PressMethod
Definition SCheckBox.h:349
TAttribute< FSlateColor > BorderBackgroundColorOverride
Definition SCheckBox.h:329
SLATE_API void SetUndeterminedImage(const FSlateBrush *Brush)
Definition SCheckBox.cpp:488
const FSlateBrush * UndeterminedHoveredImage
Definition SCheckBox.h:314
SLATE_API void PlayCheckedSound() const
Definition SCheckBox.cpp:423
virtual SLATE_API FReply OnKeyDown(const FGeometry &MyGeometry, const FKeyEvent &InKeyEvent) override
Definition SCheckBox.cpp:90
SLATE_API void ToggleCheckedState()
Definition SCheckBox.cpp:361
virtual SLATE_API bool IsInteractable() const override
Definition SCheckBox.cpp:291
const FSlateBrush * CheckedHoveredImage
Definition SCheckBox.h:308
FSlateSound UncheckedSound
Definition SCheckBox.h:379
SLATE_API const FSlateBrush * GetBackgroundImage() const
Definition SCheckBox.cpp:634
SLATE_API void SetCheckedImage(const FSlateBrush *Brush)
Definition SCheckBox.cpp:473
bool IsChecked() const
Definition SCheckBox.h:191
SLATE_API void SetCheckedHoveredImage(const FSlateBrush *Brush)
Definition SCheckBox.cpp:478
SLATE_API void SetTouchMethod(EButtonTouchMethod::Type InTouchMethod)
Definition SCheckBox.cpp:654
const FSlateBrush * CheckedPressedImage
Definition SCheckBox.h:310
SLATE_API void SetUncheckedHoveredImage(const FSlateBrush *Brush)
Definition SCheckBox.cpp:463
EHorizontalAlignment HorizontalAlignment
Definition SCheckBox.h:334
virtual SLATE_API bool SupportsKeyboardFocus() const override
Definition SCheckBox.cpp:84
TOptional< ESlateCheckBoxType::Type > CheckBoxTypeOverride
Definition SCheckBox.h:331
virtual SLATE_API FReply OnKeyUp(const FGeometry &MyGeometry, const FKeyEvent &InKeyEvent) override
Definition SCheckBox.cpp:118
SLATE_API void PlayUncheckedSound() const
Definition SCheckBox.cpp:428
bool bCheckBoxContentUsesAutoWidth
Definition SCheckBox.h:340
SLATE_API const FSlateBrush * GetBackgroundPressedImage() const
Definition SCheckBox.cpp:644
SLATE_API const FSlateBrush * GetUncheckedHoveredImage() const
Definition SCheckBox.cpp:594
bool bIsFocusable
Definition SCheckBox.h:352
const FSlateBrush * BackgroundHoveredImage
Definition SCheckBox.h:320
SLATE_API const FSlateBrush * GetUncheckedPressedImage() const
Definition SCheckBox.cpp:599
SLATE_API void SetUncheckedImage(const FSlateBrush *Brush)
Definition SCheckBox.cpp:458
virtual SLATE_API void OnMouseEnter(const FGeometry &MyGeometry, const FPointerEvent &MouseEvent) override
Definition SCheckBox.cpp:270
Definition SCompoundWidget.h:22
Definition Attribute.h:17
const ObjectType & Get() const
Definition Attribute.h:241
Definition EnumAsByte.h:22
Definition SharedPointer.h:692
Definition SharedPointer.h:153
Definition SlateEnums.h:13
Type
Definition SlateEnums.h:18
Definition SlateEnums.h:69
Type
Definition SlateEnums.h:74
Definition SlateEnums.h:47
Type
Definition SlateEnums.h:50
Type
Definition SlateTypes.h:53
Definition SlateTypes.h:105
Definition Geometry.h:40
Definition Events.h:431
Definition Margin.h:17
Definition Events.h:695
Definition SlateBrush.h:239
Definition SlateColor.h:42
Definition SlateSound.h:16
Definition Optional.h:131