Navigation
API > API/Runtime > API/Runtime/Slate
Slate's Buttons are clickable Widgets that can contain arbitrary widgets as its Content().
| Name | SButton |
| Type | class |
| Header File | /Engine/Source/Runtime/Slate/Public/Widgets/Input/SButton.h |
| Include Path | #include "Widgets/Input/SButton.h" |
Syntax
class SButton : public SBorder
Inheritance Hierarchy
- FSharedFromThisBase → TSharedFromThis → SWidget → SCompoundWidget → SBorder → SButton
- FSlateControlledConstruction → SWidget → SCompoundWidget → SBorder → SButton
Derived Classes
SButton derived class hierarchy
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
SButton() |
Widgets/Input/SButton.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~SButton() |
Widgets/Input/SButton.h |
Structs
| Name | Remarks |
|---|---|
| FArguments |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| PrivateParentType | SBorder | Widgets/Input/SButton.h | |
| PrivateThisType | SButton | Widgets/Input/SButton.h | |
| Super | SBorder | Widgets/Input/SButton.h | |
| ThisClass | SButton | Widgets/Input/SButton.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| AppearPressedAttribute | TSlateAttribute< bool > | Optional foreground color that will be inherited by all of this widget's contents | Widgets/Input/SButton.h | |
| bAllowDragDrop | bool | True if this button can be dragged | Widgets/Input/SButton.h | |
| bIsFocusable | uint8 | Can this button be focused? | Widgets/Input/SButton.h | |
| bIsPressed | uint8 | True if this button is currently in a pressed state | Widgets/Input/SButton.h | |
| bIsStyleNormalPaddingOverridden | uint8 | True if NormalPaddingAttribute is overriding the button style's normal padding | Widgets/Input/SButton.h | |
| bIsStylePressedPaddingOverridden | uint8 | True if PressedPaddingAttribute is overriding the button style's pressed padding | Widgets/Input/SButton.h | |
| BorderForegroundColorAttribute | TSlateAttribute< FSlateColor > | Optional foreground color that will be inherited by all of this widget's contents | Widgets/Input/SButton.h | |
| ClickedSound | FSlateSound | The Sound to play when the button is clicked | Widgets/Input/SButton.h | |
| ClickMethod | TEnumAsByte< EButtonClickMethod::Type > | Sets whether a click should be triggered on mouse down, mouse up, or that both a mouse down and up are required. | Widgets/Input/SButton.h | |
| ContentPaddingAttribute | TSlateAttribute< FMargin > | Padding specified by the user; it will be combind with the button's internal padding. | Widgets/Input/SButton.h | |
| HoveredSound | FSlateSound | The Sound to play when the button is hovered | Widgets/Input/SButton.h | |
| NormalPaddingAttribute | TSlateAttribute< FMargin > | Normal padding override specified by the user, or the button style's normal padding if not being overridden. | Widgets/Input/SButton.h | |
| OnClicked | FOnClicked | The delegate to execute when the button is clicked | Widgets/Input/SButton.h | |
| OnHovered | FSimpleDelegate | The delegate to execute when the button is hovered | Widgets/Input/SButton.h | |
| OnLostFocus | FSimpleDelegate | Delegate fired whenever focus is lost | Widgets/Input/SButton.h | |
| OnPressed | FSimpleDelegate | The delegate to execute when the button is pressed | Widgets/Input/SButton.h | |
| OnReceivedFocus | FSimpleDelegate | Delegate fired whenever focus is received | Widgets/Input/SButton.h | |
| OnReleased | FSimpleDelegate | The delegate to execute when the button is released | Widgets/Input/SButton.h | |
| OnSlateButtonDragDetected | FOnDragDetected | Delegate triggered when a user starts to drag a button | Widgets/Input/SButton.h | |
| OnSlateButtonDragEnter | FOnDragEnter | Delegate triggered when a user's drag enters the bounds of this button | Widgets/Input/SButton.h | |
| OnSlateButtonDragLeave | FOnDragLeave | Delegate triggered when a user's drag leaves the bounds of this button | Widgets/Input/SButton.h | |
| OnSlateButtonDragOver | FOnDragOver | Delegate triggered when a user's drag leaves the bounds of this button | Widgets/Input/SButton.h | |
| OnSlateButtonDrop | FOnDrop | Delegate triggered when a user's drag is dropped in the bounds of this button | Widgets/Input/SButton.h | |
| OnUnhovered | FSimpleDelegate | The delegate to execute when the button exit the hovered state | Widgets/Input/SButton.h | |
| PressedPaddingAttribute | TSlateAttribute< FMargin > | Pressed padding override specified by the user, or the button style's pressed padding if not being overridden. | Widgets/Input/SButton.h | |
| PressedScreenSpacePosition | FVector2D | The location in screenspace the button was pressed | Widgets/Input/SButton.h | |
| PressedSound | FSlateSound | The Sound to play when the button is pressed | Widgets/Input/SButton.h | |
| PressMethod | TEnumAsByte< EButtonPressMethod::Type > | How should the button be clicked with keyboard/controller button events? | Widgets/Input/SButton.h | |
| Style | const FButtonStyle * | Style resource for the button | Widgets/Input/SButton.h | |
| TouchMethod | TEnumAsByte< EButtonTouchMethod::Type > | How should the button be clicked with touch events? | Widgets/Input/SButton.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void Construct
(
const FArguments& InArgs |
Construct this widget | Widgets/Input/SButton.h | |
bool IsPressed () |
Returns true if this button is currently pressed | Widgets/Input/SButton.h | |
void SetAllowDragDrop
(
bool bAllowDragDrop |
Set if this button can be dragged | Widgets/Input/SButton.h | |
void SetButtonStyle
(
const FButtonStyle* ButtonStyle |
See ButtonStyle attribute | Widgets/Input/SButton.h | |
void SetClickedSound
(
TOptional< FSlateSound > InClickedSound |
See ClickedSound attribute | Widgets/Input/SButton.h | |
void SetClickMethod
(
EButtonClickMethod::Type InClickMethod |
Widgets/Input/SButton.h | ||
void SetContentPadding
(
TAttribute< FMargin > InContentPadding |
See ContentPadding attribute | Widgets/Input/SButton.h | |
void SetHoveredSound
(
TOptional< FSlateSound > InHoveredSound |
See HoveredSound attribute | Widgets/Input/SButton.h | |
void SetOnClicked
(
FOnClicked InOnClicked |
See OnClicked event | Widgets/Input/SButton.h | |
void SetOnFocusLost
(
FSimpleDelegate InOnFocusLost |
Set OnFocusLost event | Widgets/Input/SButton.h | |
void SetOnFocusReceived
(
FSimpleDelegate InOnFocusReceived |
Set OnFocusReceived event | Widgets/Input/SButton.h | |
void SetOnHovered
(
FSimpleDelegate InOnHovered |
Set OnHovered event | Widgets/Input/SButton.h | |
void SetOnUnhovered
(
FSimpleDelegate InOnUnhovered |
Set OnUnhovered event | Widgets/Input/SButton.h | |
void SetPressedSound
(
TOptional< FSlateSound > InPressedSound |
See PressedSound attribute | Widgets/Input/SButton.h | |
void SetPressMethod
(
EButtonPressMethod::Type InPressMethod |
Widgets/Input/SButton.h | ||
void SetTouchMethod
(
EButtonTouchMethod::Type InTouchMethod |
Widgets/Input/SButton.h | ||
void SimulateClick() |
Widgets/Input/SButton.h |
Overridden from SWidget
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual TSharedRef< FSlateAccessibleWidget > CreateAccessibleWidget() |
Widgets/Input/SButton.h | ||
virtual FSlateColor GetDisabledForegroundColor() |
Widgets/Input/SButton.h | ||
virtual FSlateColor GetForegroundColor() |
Widgets/Input/SButton.h | ||
virtual bool IsInteractable() |
Widgets/Input/SButton.h | ||
virtual FReply OnDragDetected
(
const FGeometry& MyGeometry, |
Widgets/Input/SButton.h | ||
virtual void OnDragEnter
(
FGeometry const& MyGeometry, |
Widgets/Input/SButton.h | ||
virtual void OnDragLeave
(
FDragDropEvent const& DragDropEvent |
Widgets/Input/SButton.h | ||
virtual FReply OnDragOver
(
const FGeometry& MyGeometry, |
Widgets/Input/SButton.h | ||
virtual FReply OnDrop
(
const FGeometry& MyGeometry, |
Widgets/Input/SButton.h | ||
virtual void OnFocusLost
(
const FFocusEvent& InFocusEvent |
Widgets/Input/SButton.h | ||
virtual FReply OnFocusReceived
(
const FGeometry& MyGeometry, |
Widgets/Input/SButton.h | ||
| Widgets/Input/SButton.h | |||
| Widgets/Input/SButton.h | |||
virtual FReply OnMouseButtonDoubleClick
(
const FGeometry& InMyGeometry, |
Widgets/Input/SButton.h | ||
virtual FReply OnMouseButtonDown
(
const FGeometry& MyGeometry, |
Widgets/Input/SButton.h | ||
virtual FReply OnMouseButtonUp
(
const FGeometry& MyGeometry, |
Widgets/Input/SButton.h | ||
virtual void OnMouseCaptureLost
(
const FCaptureLostEvent& CaptureLostEvent |
Widgets/Input/SButton.h | ||
virtual void OnMouseEnter
(
const FGeometry& MyGeometry, |
Widgets/Input/SButton.h | ||
virtual void OnMouseLeave
(
const FPointerEvent& MouseEvent |
Widgets/Input/SButton.h | ||
virtual FReply OnMouseMove
(
const FGeometry& MyGeometry, |
Widgets/Input/SButton.h | ||
virtual int32 OnPaint
(
const FPaintArgs& Args, |
Widgets/Input/SButton.h | ||
virtual bool SupportsKeyboardFocus() |
Widgets/Input/SButton.h |
Overridden from FSlateControlledConstruction
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual const FSlateWidgetClassData & GetWidgetClass() |
Widgets/Input/SButton.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void ExecuteHoverStateChanged
(
bool bPlaySound |
Widgets/Input/SButton.h | ||
FReply ExecuteOnClick() |
Execute the "OnClicked" delegate, and get the reply | Widgets/Input/SButton.h | |
TSlateAttributeRef< bool > GetAppearPressedAttribute() |
Widgets/Input/SButton.h | ||
TSlateAttributeRef< FSlateColor > GetBorderForegroundColorAttribute() |
Widgets/Input/SButton.h | ||
TEnumAsByte< EButtonClickMethod::Type > GetClickMethodFromInputType
(
const FPointerEvent& MouseEvent |
Utility function to translate other input click methods to regular ones. | Widgets/Input/SButton.h | |
FMargin GetCombinedPadding() |
Widgets/Input/SButton.h | ||
TSlateAttributeRef< FMargin > GetContentPaddingAttribute() |
Widgets/Input/SButton.h | ||
bool GetShowDisabledEffect() |
Widgets/Input/SButton.h | ||
bool IsPreciseTapOrClick
(
const FPointerEvent& MouseEvent |
Utility function to determine if the incoming mouse event is for a precise tap or click | Widgets/Input/SButton.h | |
void PlayClickedSound() |
Play the clicked sound | Widgets/Input/SButton.h | |
void PlayHoverSound() |
Play the hovered sound | Widgets/Input/SButton.h | |
void PlayPressedSound() |
Play the pressed sound | Widgets/Input/SButton.h | |
virtual void Press() |
Press the button | Widgets/Input/SButton.h | |
virtual void Release() |
Release the button | Widgets/Input/SButton.h | |
void SetAppearPressed
(
TAttribute< bool > InValue |
Set the AppearPressed look. | Widgets/Input/SButton.h | |
void SetIsFocusable
(
bool bInIsFocusable |
Set if this button can be focused | Widgets/Input/SButton.h |
Overridden from SWidget
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FVector2D ComputeDesiredSize
(
float |
Widgets/Input/SButton.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static const FSlateWidgetClassData & GetPrivateWidgetClass() |
Widgets/Input/SButton.h | ||
static SLATE_API void PrivateRegisterAttributes
(
FSlateAttributeInitializer& |
Widgets/Input/SButton.h | ||
static const FSlateWidgetClassData & StaticWidgetClass() |
Widgets/Input/SButton.h |