UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SButton Class Reference

#include <SButton.h>

+ Inheritance diagram for SButton:

Public Member Functions

 SLATE_BEGIN_ARGS (SButton)
 
virtual SLATE_API ~SButton ()
 
virtual FSlateColor GetForegroundColor () const final
 
virtual SLATE_API FSlateColor GetDisabledForegroundColor () const final
 
bool IsPressed () const
 
SLATE_API void Construct (const FArguments &InArgs)
 
SLATE_API void SetContentPadding (TAttribute< FMargin > InContentPadding)
 
SLATE_API void SetHoveredSound (TOptional< FSlateSound > InHoveredSound)
 
SLATE_API void SetPressedSound (TOptional< FSlateSound > InPressedSound)
 
SLATE_API void SetClickedSound (TOptional< FSlateSound > InClickedSound)
 
SLATE_API void SetOnClicked (FOnClicked InOnClicked)
 
SLATE_API void SetOnHovered (FSimpleDelegate InOnHovered)
 
SLATE_API void SetOnUnhovered (FSimpleDelegate InOnUnhovered)
 
SLATE_API void SetOnFocusReceived (FSimpleDelegate InOnFocusReceived)
 
SLATE_API void SetOnFocusLost (FSimpleDelegate InOnFocusLost)
 
SLATE_API void SetButtonStyle (const FButtonStyle *ButtonStyle)
 
SLATE_API void SetClickMethod (EButtonClickMethod::Type InClickMethod)
 
SLATE_API void SetTouchMethod (EButtonTouchMethod::Type InTouchMethod)
 
SLATE_API void SetPressMethod (EButtonPressMethod::Type InPressMethod)
 
SLATE_API void SetAllowDragDrop (bool bAllowDragDrop)
 
SLATE_API void SimulateClick ()
 
virtual SLATE_API int32 OnPaint (const FPaintArgs &Args, const FGeometry &AllottedGeometry, const FSlateRect &MyCullingRect, FSlateWindowElementList &OutDrawElements, int32 LayerId, const FWidgetStyle &InWidgetStyle, bool bParentEnabled) const override
 
virtual SLATE_API bool SupportsKeyboardFocus () const override
 
virtual SLATE_API void OnFocusLost (const FFocusEvent &InFocusEvent) override
 
virtual SLATE_API FReply OnFocusReceived (const FGeometry &MyGeometry, const FFocusEvent &InFocusEvent) override
 
virtual SLATE_API FReply OnKeyDown (const FGeometry &MyGeometry, const FKeyEvent &InKeyEvent) override
 
virtual SLATE_API FReply OnKeyUp (const FGeometry &MyGeometry, const FKeyEvent &InKeyEvent) override
 
virtual SLATE_API FReply OnMouseButtonDown (const FGeometry &MyGeometry, const FPointerEvent &MouseEvent) override
 
virtual SLATE_API FReply OnMouseButtonDoubleClick (const FGeometry &InMyGeometry, const FPointerEvent &InMouseEvent) override
 
virtual SLATE_API FReply OnMouseButtonUp (const FGeometry &MyGeometry, const FPointerEvent &MouseEvent) override
 
virtual SLATE_API FReply OnMouseMove (const FGeometry &MyGeometry, const FPointerEvent &MouseEvent) override
 
virtual SLATE_API void OnMouseEnter (const FGeometry &MyGeometry, const FPointerEvent &MouseEvent) override
 
virtual SLATE_API FReply OnDragDetected (const FGeometry &MyGeometry, const FPointerEvent &MouseEvent) override
 
virtual SLATE_API void OnDragEnter (FGeometry const &MyGeometry, FDragDropEvent const &DragDropEvent) override
 
virtual SLATE_API void OnDragLeave (FDragDropEvent const &DragDropEvent) override
 
virtual SLATE_API FReply OnDragOver (const FGeometry &MyGeometry, const FDragDropEvent &DragDropEvent) override
 
virtual SLATE_API FReply OnDrop (const FGeometry &MyGeometry, const FDragDropEvent &DragDropEvent) override
 
virtual SLATE_API void OnMouseLeave (const FPointerEvent &MouseEvent) override
 
virtual SLATE_API void OnMouseCaptureLost (const FCaptureLostEvent &CaptureLostEvent) override
 
virtual SLATE_API bool IsInteractable () const override
 
- Public Member Functions inherited from SBorder
 SLATE_BEGIN_ARGS (SBorder)
 
FArguments & Padding (float Uniform)
 
FArguments & Padding (float Horizontal, float Vertical)
 
FArguments & Padding (float Left, float Top, float Right, float Bottom)
 
SLATE_API SBorder ()
 
virtual SLATE_API ~SBorder ()
 
SLATE_API void Construct (const FArguments &InArgs)
 
virtual SLATE_API void SetContent (TSharedRef< SWidget > InContent)
 
SLATE_API const TSharedRef< SWidget > & GetContent () const
 
SLATE_API void ClearContent ()
 
SLATE_API void SetBorderBackgroundColor (TAttribute< FSlateColor > InColorAndOpacity)
 
FSlateColor GetBorderBackgroundColor () const
 
SLATE_API void SetDesiredSizeScale (TAttribute< FVector2D > InDesiredSizeScale)
 
SLATE_API void SetHAlign (EHorizontalAlignment HAlign)
 
SLATE_API void SetVAlign (EVerticalAlignment VAlign)
 
SLATE_API void SetPadding (TAttribute< FMargin > InPadding)
 
SLATE_API void SetShowEffectWhenDisabled (TAttribute< bool > InShowEffectWhenDisabled)
 
SLATE_API void SetBorderImage (TAttribute< const FSlateBrush * > InBorderImage)
 
const FSlateBrushGetBorderImage () const
 
- Public Member Functions inherited from SCompoundWidget
const FVector2D GetContentScale () const
 
void SetContentScale (TAttribute< FVector2D > InContentScale)
 
FLinearColor GetColorAndOpacity () const
 
void SetColorAndOpacity (TAttribute< FLinearColor > InColorAndOpacity)
 
void SetForegroundColor (TAttribute< FSlateColor > InForegroundColor)
 
virtual SLATECORE_API FChildrenGetChildren () override
 
virtual SLATECORE_API void OnArrangeChildren (const FGeometry &AllottedGeometry, FArrangedChildren &ArrangedChildren) const override
 
virtual SLATECORE_API void SetVisibility (TAttribute< EVisibility > InVisibility) override final
 
- Public Member Functions inherited from SWidget
SLATECORE_API int32 Paint (const FPaintArgs &Args, const FGeometry &AllottedGeometry, const FSlateRect &MyCullingRect, FSlateWindowElementList &OutDrawElements, int32 LayerId, const FWidgetStyle &InWidgetStyle, bool bParentEnabled) const
 
virtual SLATECORE_API void Tick (const FGeometry &AllottedGeometry, const double InCurrentTime, const float InDeltaTime)
 
virtual SLATECORE_API void OnFocusChanging (const FWeakWidgetPath &PreviousFocusPath, const FWidgetPath &NewWidgetPath, const FFocusEvent &InFocusEvent)
 
virtual SLATECORE_API FReply OnKeyChar (const FGeometry &MyGeometry, const FCharacterEvent &InCharacterEvent)
 
virtual SLATECORE_API FReply OnPreviewKeyDown (const FGeometry &MyGeometry, const FKeyEvent &InKeyEvent)
 
virtual SLATECORE_API FReply OnAnalogValueChanged (const FGeometry &MyGeometry, const FAnalogInputEvent &InAnalogInputEvent)
 
virtual SLATECORE_API FReply OnPreviewMouseButtonDown (const FGeometry &MyGeometry, const FPointerEvent &MouseEvent)
 
virtual SLATECORE_API FReply OnMouseWheel (const FGeometry &MyGeometry, const FPointerEvent &MouseEvent)
 
virtual SLATECORE_API FCursorReply OnCursorQuery (const FGeometry &MyGeometry, const FPointerEvent &CursorEvent) const
 
virtual SLATECORE_API TOptional< TSharedRef< SWidget > > OnMapCursor (const FCursorReply &CursorReply) const
 
virtual SLATECORE_API bool OnVisualizeTooltip (const TSharedPtr< SWidget > &TooltipContent)
 
virtual SLATECORE_API TSharedPtr< FPopupLayerOnVisualizePopup (const TSharedRef< SWidget > &PopupContent)
 
virtual SLATECORE_API FReply OnTouchGesture (const FGeometry &MyGeometry, const FPointerEvent &GestureEvent)
 
virtual SLATECORE_API FReply OnTouchStarted (const FGeometry &MyGeometry, const FPointerEvent &InTouchEvent)
 
virtual SLATECORE_API FReply OnTouchMoved (const FGeometry &MyGeometry, const FPointerEvent &InTouchEvent)
 
virtual SLATECORE_API FReply OnTouchEnded (const FGeometry &MyGeometry, const FPointerEvent &InTouchEvent)
 
virtual SLATECORE_API FReply OnTouchForceChanged (const FGeometry &MyGeometry, const FPointerEvent &TouchEvent)
 
virtual SLATECORE_API FReply OnTouchFirstMove (const FGeometry &MyGeometry, const FPointerEvent &TouchEvent)
 
virtual SLATECORE_API FReply OnMotionDetected (const FGeometry &MyGeometry, const FMotionEvent &InMotionEvent)
 
virtual SLATECORE_API TOptional< boolOnQueryShowFocus (const EFocusCause InFocusCause) const
 
virtual SLATECORE_API FPopupMethodReply OnQueryPopupMethod () const
 
virtual SLATECORE_API TOptional< FVirtualPointerPositionTranslateMouseCoordinateForCustomHitTestChild (const SWidget &ChildWidget, const FGeometry &MyGeometry, const FVector2D ScreenSpaceMouseCoordinate, const FVector2D LastScreenSpaceMouseCoordinate) const
 
virtual SLATECORE_API void OnFinishedPointerInput ()
 
virtual SLATECORE_API void OnFinishedKeyInput ()
 
virtual SLATECORE_API FNavigationReply OnNavigation (const FGeometry &MyGeometry, const FNavigationEvent &InNavigationEvent)
 
virtual SLATECORE_API EWindowZone::Type GetWindowZoneOverride () const
 
bool NeedsPrepass () const
 
SLATECORE_API void SlatePrepass ()
 
SLATECORE_API void SlatePrepass (float InLayoutScaleMultiplier)
 
void SetCanTick (bool bInCanTick)
 
bool GetCanTick () const
 
bool HasRegisteredSlateAttribute () const
 
bool IsAttributesUpdatesEnabled () const
 
const FSlateWidgetPersistentStateGetPersistentState () const
 
const FWidgetProxyHandle GetProxyHandle () const
 
SLATECORE_API UE::Slate::FDeprecateVector2DResult GetDesiredSize () const
 
SLATECORE_API void AssignParentWidget (TSharedPtr< SWidget > InParent)
 
SLATECORE_API bool ConditionallyDetatchParentWidget (SWidget *InExpectedParent)
 
virtual bool ValidatePathToChild (SWidget *InChild)
 
bool IsParentValid () const
 
TSharedPtr< SWidgetGetParentWidget () const
 
TSharedPtr< SWidgetAdvanced_GetPaintParentWidget () const
 
SLATECORE_API FSlateRect CalculateCullingAndClippingRules (const FGeometry &AllottedGeometry, const FSlateRect &MyCullingRect, bool &bClipToBounds, bool &bAlwaysClip, bool &bIntersectClipBounds) const
 
bool HasAnyUpdateFlags (EWidgetUpdateFlags FlagsToCheck) const
 
TStatId GetStatID (bool bForDeferredUse=false) const
 
virtual SLATECORE_API float GetRelativeLayoutScale (const int32 ChildIndex, float LayoutScaleMultiplier) const
 
SLATECORE_API void ArrangeChildren (const FGeometry &AllottedGeometry, FArrangedChildren &ArrangedChildren, bool bUpdateAttributes=false) const
 
virtual FChildrenGetAllChildren ()
 
virtual SLATECORE_API bool HasKeyboardFocus () const
 
SLATECORE_API TOptional< EFocusCauseHasUserFocus (int32 UserIndex) const
 
SLATECORE_API TOptional< EFocusCauseHasAnyUserFocus () const
 
SLATECORE_API bool HasUserFocusedDescendants (int32 UserIndex) const
 
SLATECORE_API bool HasFocusedDescendants () const
 
SLATECORE_API bool HasAnyUserFocusOrFocusedDescendants () const
 
SLATECORE_API bool HasMouseCapture () const
 
SLATECORE_API bool HasMouseCaptureByUser (int32 UserIndex, TOptional< int32 > PointerIndex=TOptional< int32 >()) const
 
void SetEnabled (TAttribute< bool > InEnabledState)
 
bool IsEnabled () const
 
virtual SLATECORE_API TSharedPtr< IToolTipGetToolTip ()
 
virtual SLATECORE_API void OnToolTipClosing ()
 
SLATECORE_API void EnableToolTipForceField (const bool bEnableForceField)
 
bool HasToolTipForceField () const
 
bool IsHovered () const
 
SLATECORE_API bool IsDirectlyHovered () const
 
EVisibility GetVisibility () const
 
bool IsVolatile () const
 
bool IsVolatileIndirectly () const
 
void ForceVolatile (bool bForce)
 
bool ShouldInvalidatePrepassDueToVolatility ()
 
SLATECORE_API void Invalidate (EInvalidateWidgetReason InvalidateReason)
 
void CacheVolatility ()
 
void MarkPrepassAsDirty ()
 
float GetRenderOpacity () const
 
void SetRenderOpacity (float InRenderOpacity)
 
void SetTag (FName InTag)
 
const TOptional< FSlateRenderTransform > & GetRenderTransform () const
 
TOptional< FSlateRenderTransformGetRenderTransformWithRespectToFlowDirection () const
 
UE::Slate::FDeprecateVector2DResult GetRenderTransformPivotWithRespectToFlowDirection () const
 
void SetRenderTransform (TAttribute< TOptional< FSlateRenderTransform > > InTransform)
 
UE::Slate::FDeprecateVector2DResult GetRenderTransformPivot () const
 
void SetRenderTransformPivot (TAttribute< FVector2D > InTransformPivot)
 
SLATECORE_API void SetClipping (EWidgetClipping InClipping)
 
EWidgetClipping GetClipping () const
 
SLATECORE_API void SetPixelSnapping (EWidgetPixelSnapping InPixelSnappingMethod)
 
EWidgetPixelSnapping GetPixelSnapping () const
 
void SetCullingBoundsExtension (const FMargin &InCullingBoundsExtension)
 
FMargin GetCullingBoundsExtension () const
 
void SetFlowDirectionPreference (EFlowDirectionPreference InFlowDirectionPreference)
 
EFlowDirectionPreference GetFlowDirectionPreference () const
 
SLATECORE_API void SetToolTipText (const TAttribute< FText > &ToolTipText)
 
SLATECORE_API void SetToolTipText (const FText &InToolTipText)
 
SLATECORE_API void SetToolTip (const TAttribute< TSharedPtr< IToolTip > > &InToolTip)
 
SLATECORE_API void SetCursor (const TAttribute< TOptional< EMouseCursor::Type > > &InCursor)
 
template<typename MetaDataType >
TSharedPtr< MetaDataType > GetMetaData () const
 
template<typename MetaDataType >
TArray< TSharedRef< MetaDataType > > GetAllMetaData () const
 
template<typename MetaDataType >
void AddMetadata (const TSharedRef< MetaDataType > &AddMe)
 
template<typename MetaDataType >
int32 RemoveMetaData (const TSharedRef< MetaDataType > &RemoveMe)
 
SLATECORE_API void SetOnMouseButtonDown (FPointerEventHandler EventHandler)
 
SLATECORE_API void SetOnMouseButtonUp (FPointerEventHandler EventHandler)
 
SLATECORE_API void SetOnMouseMove (FPointerEventHandler EventHandler)
 
SLATECORE_API void SetOnMouseDoubleClick (FPointerEventHandler EventHandler)
 
SLATECORE_API void SetOnMouseEnter (FNoReplyPointerEventHandler EventHandler)
 
SLATECORE_API void SetOnMouseLeave (FSimpleNoReplyPointerEventHandler EventHandler)
 
virtual SLATECORE_API FString ToString () const
 
SLATECORE_API FString GetTypeAsString () const
 
SLATECORE_API FName GetType () const
 
virtual SLATECORE_API FString GetReadableLocation () const
 
SLATECORE_API FName GetCreatedInLocation () const
 
virtual SLATECORE_API FName GetTag () const
 
SLATECORE_API const FGeometryGetCachedGeometry () const
 
SLATECORE_API const FGeometryGetTickSpaceGeometry () const
 
SLATECORE_API const FGeometryGetPaintSpaceGeometry () const
 
const TOptional< FSlateClippingState > & GetCurrentClippingState () const
 
virtual bool Advanced_IsWindow () const
 
virtual bool Advanced_IsInvalidationRoot () const
 
virtual const FSlateInvalidationRootAdvanced_AsInvalidationRoot () const
 
SLATECORE_API TSharedRef< FActiveTimerHandleRegisterActiveTimer (float TickPeriod, FWidgetActiveTimerDelegate TickFunction)
 
SLATECORE_API void UnRegisterActiveTimer (const TSharedRef< FActiveTimerHandle > &ActiveTimerHandle)
 
bool HasActiveTimers () const
 
- Public Member Functions inherited from FSlateControlledConstruction
 FSlateControlledConstruction ()=default
 
virtual ~FSlateControlledConstruction ()=default
 
virtual const FSlateWidgetClassDataGetWidgetClass () const =0
 
void operator delete (void *mem)
 
- Public Member Functions inherited from TSharedFromThis< SWidget >
TSharedRef< SWidget, Mode > AsShared ()
 
TSharedRef< SWidget const, Mode > AsShared () const
 
TSharedRef< SubobjectType, Mode > AsSharedSubobject (SubobjectType *SubobjectPtr) const
 
TWeakPtr< SWidget, Mode > AsWeak ()
 
TWeakPtr< SWidget const, Mode > AsWeak () const
 
TWeakPtr< SubobjectType, Mode > AsWeakSubobject (SubobjectType *SubobjectPtr) const
 
void UpdateWeakReferenceInternal (TSharedPtr< SharedPtrType, SharedPtrMode > const *InSharedPtr, OtherType *InObject) const
 
void UpdateWeakReferenceInternal (TSharedRef< SharedRefType, SharedPtrMode > const *InSharedRef, OtherType *InObject) const
 
UE_FORCEINLINE_HINT bool DoesSharedInstanceExist () const
 

Protected Member Functions

SLATE_API SButton ()
 
virtual SLATE_API FVector2D ComputeDesiredSize (float) const override
 
virtual SLATE_API void Press ()
 
virtual SLATE_API void Release ()
 
SLATE_API FReply ExecuteOnClick ()
 
SLATE_API FMargin GetCombinedPadding () const
 
SLATE_API bool GetShowDisabledEffect () const
 
SLATE_API TEnumAsByte< EButtonClickMethod::TypeGetClickMethodFromInputType (const FPointerEvent &MouseEvent) const
 
SLATE_API bool IsPreciseTapOrClick (const FPointerEvent &MouseEvent) const
 
SLATE_API void PlayPressedSound () const
 
SLATE_API void PlayClickedSound () const
 
SLATE_API void PlayHoverSound () const
 
void SetIsFocusable (bool bInIsFocusable)
 
SLATE_API void ExecuteHoverStateChanged (bool bPlaySound)
 
TSlateAttributeRef< FSlateColorGetBorderForegroundColorAttribute () const
 
TSlateAttributeRef< FMarginGetContentPaddingAttribute () const
 
void SetAppearPressed (TAttribute< bool > InValue)
 
TSlateAttributeRef< boolGetAppearPressedAttribute () const
 
- Protected Member Functions inherited from SBorder
bool GetShowDisabledEffect () const
 
FVector2D GetDesiredSizeScale () const
 
TSlateAttributeRef< const FSlateBrush * > GetBorderImageAttribute () const
 
TSlateAttributeRef< FSlateColorGetBorderBackgroundColorAttribute () const
 
TSlateAttributeRef< FVector2DGetDesiredSizeScaleAttribute () const
 
TSlateAttributeRef< boolGetShowDisabledEffectAttribute () const
 
- Protected Member Functions inherited from SCompoundWidget
TSlateAttributeRef< FVector2DGetContentScaleAttribute () const
 
TSlateAttributeRef< FLinearColorGetColorAndOpacityAttribute () const
 
TSlateAttributeRef< FSlateColorGetForegroundColorAttribute () const
 
SLATECORE_API SCompoundWidget ()
 
virtual SLATECORE_API ~SCompoundWidget ()
 
- Protected Member Functions inherited from SWidget
void SetVolatilePrepass (bool bVolatile)
 
virtual bool CustomPrepass (float LayoutScaleMultiplier)
 
virtual SLATECORE_API void CacheDesiredSize (float InLayoutScaleMultiplier)
 
void SetHover (TAttribute< bool > InHovered)
 
bool IsChildWidgetCulled (const FSlateRect &, const FArrangedWidget &) const
 
SLATECORE_API void InvalidateChildRemovedFromTree (SWidget &Child)
 
bool Advanced_InvalidateVolatility ()
 
EFlowDirection ComputeFlowDirection () const
 
SLATECORE_API void SetDebugInfo (const ANSICHAR *InType, const ANSICHAR *InFile, int32 OnLine, size_t InAllocSize)
 
virtual SLATECORE_API TOptional< EMouseCursor::TypeGetCursor () const
 
SLATECORE_API SWidget ()
 
SLATECORE_API void SWidgetConstruct (const FSlateBaseNamedArgs &Args)
 
bool IsConstructed () const
 
SLATECORE_API bool FindChildGeometries (const FGeometry &MyGeometry, const TSet< TSharedRef< SWidget > > &WidgetsToFind, TMap< TSharedRef< SWidget >, FArrangedWidget > &OutResult) const
 
SLATECORE_API void FindChildGeometries_Helper (const FGeometry &MyGeometry, const TSet< TSharedRef< SWidget > > &WidgetsToFind, TMap< TSharedRef< SWidget >, FArrangedWidget > &OutResult) const
 
SLATECORE_API FGeometry FindChildGeometry (const FGeometry &MyGeometry, TSharedRef< SWidget > WidgetToFind) const
 
bool ShouldBeEnabled (bool InParentEnabled) const
 
virtual SLATECORE_API const FSlateBrushGetFocusBrush () const
 
virtual bool ComputeVolatility () const
 
virtual SLATECORE_API void OnClippingChanged ()
 
float GetPrepassLayoutScaleMultiplier () const
 
SLATECORE_API void Prepass_ChildLoop (float InLayoutScaleMultiplier, FChildren *MyChildren)
 
template<typename TargetValueType , typename SourceValueType >
bool SetAttribute (TAttribute< TargetValueType > &TargetValue, const TAttribute< SourceValueType > &SourceValue, EInvalidateWidgetReason BaseInvalidationReason)
 
TSlateAttributeRef< boolGetEnabledStateAttribute () const
 
TSlateAttributeRef< boolGetHoveredAttribute () const
 
TSlateAttributeRef< EVisibilityGetVisibilityAttribute () const
 
TSlateAttributeRef< TOptional< FSlateRenderTransform > > GetRenderTransformAttribute () const
 
TSlateAttributeRef< FVector2DGetRenderTransformPivotAttribute () const
 
virtual SLATECORE_API ~SWidget ()
 
- Protected Member Functions inherited from TSharedFromThis< SWidget >
 TSharedFromThis ()
 
 TSharedFromThis (TSharedFromThis const &)
 
UE_FORCEINLINE_HINT TSharedFromThisoperator= (TSharedFromThis const &)
 
 ~TSharedFromThis ()
 

Additional Inherited Members

- Static Public Member Functions inherited from FSlateControlledConstruction
static const FSlateWidgetClassDataStaticWidgetClass ()
 
- Static Protected Member Functions inherited from SWidget
static SLATECORE_API int32 FindChildUnderMouse (const FArrangedChildren &Children, const FPointerEvent &MouseEvent)
 
static SLATECORE_API int32 FindChildUnderPosition (const FArrangedChildren &Children, const UE::Slate::FDeprecateVector2DParameter &ArrangedSpacePosition)
 
static TAttribute< EVisibilityAccessWidgetVisibilityAttribute (const TSharedRef< SWidget > &Widget)
 
- Static Protected Member Functions inherited from TSharedFromThis< SWidget >
static UE_FORCEINLINE_HINT TSharedRef< OtherType, Mode > SharedThis (OtherType *ThisPtr)
 
static UE_FORCEINLINE_HINT TSharedRef< OtherType const, Mode > SharedThis (const OtherType *ThisPtr)
 
- Protected Attributes inherited from SCompoundWidget
FCompoundWidgetOneChildSlot ChildSlot
 
- Protected Attributes inherited from SWidget
uint8 bCanSupportFocus: 1
 
uint8 bCanHaveChildren: 1
 
uint8 bClippingProxy: 1
 
uint8 bHasCustomPrepass: 1
 
uint8 bHasRelativeLayoutScale: 1
 
uint8 bVolatilityAlwaysInvalidatesPrepass: 1
 
EWidgetClipping Clipping
 
EWidgetPixelSnapping PixelSnappingMethod
 
FMargin CullingBoundsExtension
 
float RenderOpacity
 

Detailed Description

Slate's Buttons are clickable Widgets that can contain arbitrary widgets as its Content().

Constructor & Destructor Documentation

◆ ~SButton()

SButton::~SButton ( )
virtualdefault

Slot for this button's content (optional) The visual style of the button The text style of the button Horizontal alignment Vertical alignment Spacing between button's border and the content. If set, overrides the button style's additional spacing between the button's border and the content when not pressed. If set, overrides the button style's additional spacing between the button's border and the content when pressed. The text to display in this button, if no custom content is specified Called when the button is clicked Called when the button is pressed Called when the button is released Sets the rules to use for determining whether the button was clicked. This is an advanced setting and generally should be left as the default. How should the button be clicked with touch events? How should the button be clicked with keyboard/controller button events? Sometimes a button should only be mouse-clickable and never keyboard focusable. True if the button should detect drag on mouse down. The sound to play when the button is pressed The sound to play when the button is clicked The sound to play when the button is hovered Which text shaping method should we use? (unset to use the default returned by GetDefaultTextShapingMethod) Which text flow direction should we use? (unset to use the default returned by GetDefaultTextFlowDirection)

◆ SButton()

SButton::SButton ( )
protected

Member Function Documentation

◆ ComputeDesiredSize()

FVector2D SButton::ComputeDesiredSize ( float  LayoutScaleMultiplier) const
overrideprotectedvirtual

Compute the ideal size necessary to display this widget. For aggregate widgets (e.g. panels) this size should include the size necessary to show all of its children. CacheDesiredSize() guarantees that the size of descendants is computed and cached before that of the parents, so it is safe to call GetDesiredSize() for any children while implementing this method.

Note that ComputeDesiredSize() is meant as an aide to the developer. It is NOT meant to be very robust in many cases. If your widget is simulating a bouncing ball, you should just return a reasonable size; e.g. 160x160. Let the programmer set up a reasonable rule of resizing the bouncy ball simulation.

Parameters
LayoutScaleMultiplierThis parameter is safe to ignore for almost all widgets; only really affects text measuring.
Returns
The desired size.

Reimplemented from SBorder.

◆ Construct()

void SButton::Construct ( const FArguments &  InArgs)

Construct this widget

Parameters
InArgsThe declaration data for this widget

◆ ExecuteHoverStateChanged()

void SButton::ExecuteHoverStateChanged ( bool  bPlaySound)
protected

◆ ExecuteOnClick()

FReply SButton::ExecuteOnClick ( )
protected

Execute the "OnClicked" delegate, and get the reply

◆ GetAppearPressedAttribute()

TSlateAttributeRef< bool > SButton::GetAppearPressedAttribute ( ) const
inlineprotected
Returns
the AppearPressed attribute.

◆ GetBorderForegroundColorAttribute()

TSlateAttributeRef< FSlateColor > SButton::GetBorderForegroundColorAttribute ( ) const
inlineprotected
Returns
the BorderForegroundColor attribute.

◆ GetClickMethodFromInputType()

TEnumAsByte< EButtonClickMethod::Type > SButton::GetClickMethodFromInputType ( const FPointerEvent MouseEvent) const
protected

Utility function to translate other input click methods to regular ones.

◆ GetCombinedPadding()

FMargin SButton::GetCombinedPadding ( ) const
protected
Returns
combines the user-specified margin and the button's internal margin.

◆ GetContentPaddingAttribute()

TSlateAttributeRef< FMargin > SButton::GetContentPaddingAttribute ( ) const
inlineprotected
Returns
the ContentPadding attribute.

◆ GetDisabledForegroundColor()

FSlateColor SButton::GetDisabledForegroundColor ( ) const
finalvirtual
Returns
the Foreground color that this widget sets when this widget or any of its ancestors are disabled; unset options if the widget does not set a foreground color

Reimplemented from SWidget.

◆ GetForegroundColor()

virtual FSlateColor SButton::GetForegroundColor ( ) const
inlinefinalvirtual
Returns
the Foreground color that this widget sets; unset options if the widget does not set a foreground color

Reimplemented from SCompoundWidget.

◆ GetShowDisabledEffect()

bool SButton::GetShowDisabledEffect ( ) const
protected
Returns
True if the disabled effect should be shown.

◆ IsInteractable()

bool SButton::IsInteractable ( ) const
overridevirtual
Returns
Is this widget interactive or not? Defaults to false

Reimplemented from SWidget.

◆ IsPreciseTapOrClick()

bool SButton::IsPreciseTapOrClick ( const FPointerEvent MouseEvent) const
protected

Utility function to determine if the incoming mouse event is for a precise tap or click

◆ IsPressed()

bool SButton::IsPressed ( ) const
inline

Returns true if this button is currently pressed

Returns
True if pressed, otherwise false
Note
IsPressed used to be virtual. Use SetAppearPressed to assign an attribute if you need to override the default behavior.

◆ OnDragDetected()

SLATE_API FReply SButton::OnDragDetected ( const FGeometry MyGeometry,
const FPointerEvent MouseEvent 
)
overridevirtual

Called when Slate detects that a widget started to be dragged. Usage: A widget can ask Slate to detect a drag. OnMouseDown() reply with FReply::Handled().DetectDrag( SharedThis(this) ). Slate will either send an OnDragDetected() event or do nothing. If the user releases a mouse button or leaves the widget before a drag is triggered (maybe user started at the very edge) then no event will be sent.

Parameters
InMyGeometryWidget geometry
InMouseEventMouseMove that triggered the drag

Reimplemented from SWidget.

◆ OnDragEnter()

SLATE_API void SButton::OnDragEnter ( FGeometry const &  MyGeometry,
FDragDropEvent const &  DragDropEvent 
)
overridevirtual

Called during drag and drop when the drag enters a widget.

Enter/Leave events in slate are meant as lightweight notifications. So we do not want to capture mouse or set focus in response to these. However, OnDragEnter must also support external APIs (e.g. OLE Drag/Drop) Those require that we let them know whether we can handle the content being dragged OnDragEnter.

The concession is to return a can_handled/cannot_handle boolean rather than a full FReply.

Parameters
MyGeometryThe geometry of the widget receiving the event.
DragDropEventThe drag and drop event.
Returns
A reply that indicated whether the contents of the DragDropEvent can potentially be processed by this widget.

Reimplemented from SWidget.

◆ OnDragLeave()

SLATE_API void SButton::OnDragLeave ( FDragDropEvent const &  DragDropEvent)
overridevirtual

Called during drag and drop when the drag leaves a widget.

Parameters
DragDropEventThe drag and drop event.

Reimplemented from SWidget.

◆ OnDragOver()

SLATE_API FReply SButton::OnDragOver ( const FGeometry MyGeometry,
const FDragDropEvent DragDropEvent 
)
overridevirtual

Called during drag and drop when the the mouse is being dragged over a widget.

Parameters
MyGeometryThe geometry of the widget receiving the event.
DragDropEventThe drag and drop event.
Returns
A reply that indicated whether this event was handled.

Reimplemented from SWidget.

◆ OnDrop()

SLATE_API FReply SButton::OnDrop ( const FGeometry MyGeometry,
const FDragDropEvent DragDropEvent 
)
overridevirtual

Called when the user is dropping something onto a widget; terminates drag and drop.

Parameters
MyGeometryThe geometry of the widget receiving the event.
DragDropEventThe drag and drop event.
Returns
A reply that indicated whether this event was handled.

Reimplemented from SWidget.

◆ OnFocusLost()

void SButton::OnFocusLost ( const FFocusEvent InFocusEvent)
overridevirtual

Called when this widget loses focus. This event does not bubble.

Parameters
InFocusEventThe FocusEvent

Reimplemented from SWidget.

◆ OnFocusReceived()

FReply SButton::OnFocusReceived ( const FGeometry MyGeometry,
const FFocusEvent InFocusEvent 
)
overridevirtual

Called when focus is given to this widget. This event does not bubble.

Parameters
MyGeometryThe Geometry of the widget receiving the event
InFocusEventThe FocusEvent
Returns
Returns whether the event was handled, along with other possible actions

Reimplemented from SWidget.

◆ OnKeyDown()

FReply SButton::OnKeyDown ( const FGeometry MyGeometry,
const FKeyEvent InKeyEvent 
)
overridevirtual

Called after a key is pressed when this widget has focus (this event bubbles if not handled)

Parameters
MyGeometryThe Geometry of the widget receiving the event
InKeyEventKey event
Returns
Returns whether the event was handled, along with other possible actions

Reimplemented from SWidget.

Reimplemented in SEyeDropperButton.

◆ OnKeyUp()

FReply SButton::OnKeyUp ( const FGeometry MyGeometry,
const FKeyEvent InKeyEvent 
)
overridevirtual

Called after a key is released when this widget has focus

Parameters
MyGeometryThe Geometry of the widget receiving the event
InKeyEventKey event
Returns
Returns whether the event was handled, along with other possible actions

Reimplemented from SWidget.

◆ OnMouseButtonDoubleClick()

FReply SButton::OnMouseButtonDoubleClick ( const FGeometry InMyGeometry,
const FPointerEvent InMouseEvent 
)
overridevirtual

Called when a mouse button is double clicked. Override this in derived classes.

Parameters
InMyGeometryWidget geometry
InMouseEventMouse button event
Returns
Returns whether the event was handled, along with other possible actions

Reimplemented from SWidget.

◆ OnMouseButtonDown()

FReply SButton::OnMouseButtonDown ( const FGeometry MyGeometry,
const FPointerEvent MouseEvent 
)
overridevirtual

The system calls this method to notify the widget that a mouse button was pressed within it. This event is bubbled.

Parameters
MyGeometryThe Geometry of the widget receiving the event
MouseEventInformation about the input event
Returns
Whether the event was handled along with possible requests for the system to take action.

Reimplemented from SWidget.

Reimplemented in SEyeDropperButton.

◆ OnMouseButtonUp()

FReply SButton::OnMouseButtonUp ( const FGeometry MyGeometry,
const FPointerEvent MouseEvent 
)
overridevirtual

The system calls this method to notify the widget that a mouse button was release within it. This event is bubbled.

Parameters
MyGeometryThe Geometry of the widget receiving the event
MouseEventInformation about the input event
Returns
Whether the event was handled along with possible requests for the system to take action.

Reimplemented from SWidget.

Reimplemented in SEyeDropperButton, and SMenuEntryButton.

◆ OnMouseCaptureLost()

void SButton::OnMouseCaptureLost ( const FCaptureLostEvent CaptureLostEvent)
overridevirtual

Called when this widget had captured the mouse, but that capture has been revoked for some reason.

Reimplemented from SWidget.

Reimplemented in SEyeDropperButton.

◆ OnMouseEnter()

void SButton::OnMouseEnter ( const FGeometry MyGeometry,
const FPointerEvent MouseEvent 
)
overridevirtual

The system will use this event to notify a widget that the cursor has entered it. This event is uses a custom bubble strategy.

Parameters
MyGeometryThe Geometry of the widget receiving the event
MouseEventInformation about the input event

Reimplemented from SWidget.

Reimplemented in SSubMenuButton.

◆ OnMouseLeave()

void SButton::OnMouseLeave ( const FPointerEvent MouseEvent)
overridevirtual

The system will use this event to notify a widget that the cursor has left it. This event is uses a custom bubble strategy.

Parameters
MouseEventInformation about the input event

Reimplemented from SWidget.

Reimplemented in SMenuEntryButton, and SSubMenuButton.

◆ OnMouseMove()

FReply SButton::OnMouseMove ( const FGeometry MyGeometry,
const FPointerEvent MouseEvent 
)
overridevirtual

The system calls this method to notify the widget that a mouse moved within it. This event is bubbled.

Parameters
MyGeometryThe Geometry of the widget receiving the event
MouseEventInformation about the input event
Returns
Whether the event was handled along with possible requests for the system to take action.

Reimplemented from SWidget.

Reimplemented in SEyeDropperButton.

◆ OnPaint()

int32 SButton::OnPaint ( const FPaintArgs Args,
const FGeometry AllottedGeometry,
const FSlateRect MyCullingRect,
FSlateWindowElementList OutDrawElements,
int32  LayerId,
const FWidgetStyle InWidgetStyle,
bool  bParentEnabled 
) const
overridevirtual

The widget should respond by populating the OutDrawElements array with FDrawElements that represent it and any of its children. Called by the non-virtual OnPaint to enforce pre/post conditions during OnPaint.

Parameters
ArgsAll the arguments necessary to paint this widget (
AllottedGeometryThe FGeometry that describes an area in which the widget should appear.
MyCullingRectThe rectangle representing the bounds currently being used to completely cull widgets. Unless IsChildWidgetCulled(...) returns true, you should paint the widget.
OutDrawElementsA list of FDrawElements to populate with the output.
LayerIdThe Layer onto which this widget should be rendered.
InColorAndOpacityColor and Opacity to be applied to all the descendants of the widget being painted
bParentEnabledTrue if the parent of this widget is enabled.
Returns
The maximum layer ID attained by this widget or any of its children.

Reimplemented from SBorder.

◆ PlayClickedSound()

void SButton::PlayClickedSound ( ) const
protected

Play the clicked sound

◆ PlayHoverSound()

void SButton::PlayHoverSound ( ) const
protected

Play the hovered sound

◆ PlayPressedSound()

void SButton::PlayPressedSound ( ) const
protected

Play the pressed sound

◆ Press()

void SButton::Press ( )
protectedvirtual

Press the button

◆ Release()

void SButton::Release ( )
protectedvirtual

Release the button

◆ SetAllowDragDrop()

SLATE_API void SButton::SetAllowDragDrop ( bool  bAllowDragDrop)

Set if this button can be dragged

◆ SetAppearPressed()

void SButton::SetAppearPressed ( TAttribute< bool InValue)
inlineprotected

Set the AppearPressed look.

◆ SetButtonStyle()

void SButton::SetButtonStyle ( const FButtonStyle ButtonStyle)

See ButtonStyle attribute

◆ SetClickedSound()

void SButton::SetClickedSound ( TOptional< FSlateSound InClickedSound)

See ClickedSound attribute

◆ SetClickMethod()

void SButton::SetClickMethod ( EButtonClickMethod::Type  InClickMethod)

◆ SetContentPadding()

void SButton::SetContentPadding ( TAttribute< FMargin InContentPadding)

See ContentPadding attribute

◆ SetHoveredSound()

void SButton::SetHoveredSound ( TOptional< FSlateSound InHoveredSound)

See HoveredSound attribute

◆ SetIsFocusable()

void SButton::SetIsFocusable ( bool  bInIsFocusable)
inlineprotected

Set if this button can be focused

◆ SetOnClicked()

void SButton::SetOnClicked ( FOnClicked  InOnClicked)

See OnClicked event

◆ SetOnFocusLost()

void SButton::SetOnFocusLost ( FSimpleDelegate  InOnFocusLost)

Set OnFocusLost event

◆ SetOnFocusReceived()

void SButton::SetOnFocusReceived ( FSimpleDelegate  InOnFocusReceived)

Set OnFocusReceived event

◆ SetOnHovered()

void SButton::SetOnHovered ( FSimpleDelegate  InOnHovered)

Set OnHovered event

◆ SetOnUnhovered()

void SButton::SetOnUnhovered ( FSimpleDelegate  InOnUnhovered)

Set OnUnhovered event

◆ SetPressedSound()

void SButton::SetPressedSound ( TOptional< FSlateSound InPressedSound)

See PressedSound attribute

◆ SetPressMethod()

void SButton::SetPressMethod ( EButtonPressMethod::Type  InPressMethod)

◆ SetTouchMethod()

void SButton::SetTouchMethod ( EButtonTouchMethod::Type  InTouchMethod)

◆ SimulateClick()

void SButton::SimulateClick ( )

◆ SLATE_BEGIN_ARGS()

SButton::SLATE_BEGIN_ARGS ( SButton  )
inline

◆ SupportsKeyboardFocus()

bool SButton::SupportsKeyboardFocus ( ) const
overridevirtual

Checks to see if this widget supports keyboard focus. Override this in derived classes.

Returns
True if this widget can take keyboard focus

Reimplemented from SWidget.


The documentation for this class was generated from the following files: