SObjectWidget

The [SObjectWidget](API\Runtime\UMG\Slate\SObjectWidget) allows UMG to insert an [SWidget](API\Runtime\SlateCore\Widgets\SWidget) into the hierarchy that manages the lifetime of the UMG [UWidget](API\Runtime\UMG\Components\UWidget) that created it.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

UMG

Header

/Engine/Source/Runtime/UMG/Public/Slate/SObjectWidget.h

Include

#include "Slate/SObjectWidget.h"

Syntax

class SObjectWidget :
    public SCompoundWidget,
    public FGCObject

Remarks

The SObjectWidget allows UMG to insert an SWidget into the hierarchy that manages the lifetime of the UMG UWidget that created it. Once the SObjectWidget is destroyed it frees the reference it holds to The UWidget allowing it to be garbage collected. It also forwards the slate events to the UUserWidget so that it can forward them to listeners.

Variables

Name Description

Protected variable

UUserWidget ...

 

WidgetObject

The UWidget that created this SObjectWidget who needs to be kept alive.

Destructors

Name Description

Public function Virtual

~SObjectWidget()

Functions

Name Description

Public function

void

 

Construct

(
    const FArguments& InArgs,
    UUserWidget* InWidgetObject
)

Public function Const

UUserWidget ...

 

GetWidgetObject()

Public function

void

 

OnDragCancelled

(
    const FDragDropEvent& DragDropEven...,
    UDragDropOperation* Operation
)

Public function

void

 

ResetWidget()

Public function

void

 

SetPadding

(
    const TAttribute< FMargin >& InMar...
)

Overridden from SWidget

Name Description

Public function Virtual Const

FVector2D

 

ComputeDesiredSize

(
    float LayoutScaleMultiplier
)

Compute the ideal size necessary to display this widget.

Public function Virtual Const

bool

 

IsInteractable()

Public function Virtual

FReply

 

OnAnalogValueChanged

(
    const FGeometry& MyGeometry,
    const FAnalogInputEvent& InAnalogI...
)

Called when an analog value changes on a button that supports analog

Public function Virtual Const

FCursorReply

 

OnCursorQuery

(
    const FGeometry& MyGeometry,
    const FPointerEvent& CursorEvent
)

The system asks each widget under the mouse to provide a cursor. This event is bubbled.

Public function Virtual

FReply

 

OnDragDetected

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

Called when Slate detects that a widget started to be dragged.

Public function Virtual

void

 

OnDragEnter

(
    const FGeometry& MyGeometry,
    const FDragDropEvent& DragDropEven...
)

DRAG AND DROP (DragDrop) Called during drag and drop when the drag enters a widget.

Public function Virtual

void

 

OnDragLeave

(
    const FDragDropEvent& DragDropEven...
)

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

Public function Virtual

FReply

 

OnDragOver

(
    const FGeometry& MyGeometry,
    const FDragDropEvent& DragDropEven...
)

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

Public function Virtual

FReply

 

OnDrop

(
    const FGeometry& MyGeometry,
    const FDragDropEvent& DragDropEven...
)

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

Public function Virtual

void

 

OnFocusChanging

(
    const FWeakWidgetPath& PreviousFoc...,
    const FWidgetPath& NewWidgetPath,
    const FFocusEvent& InFocusEvent
)

Called whenever a focus path is changing on all the widgets within the old and new focus paths

Public function Virtual

void

 

OnFocusLost

(
    const FFocusEvent& InFocusEvent
)

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

Public function Virtual

FReply

 

OnFocusReceived

(
    const FGeometry& MyGeometry,
    const FFocusEvent& InFocusEvent
)

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

Public function Virtual

FReply

 

OnKeyChar

(
    const FGeometry& MyGeometry,
    const FCharacterEvent& InCharacter...
)

Called after a character is entered while this widget has keyboard focus

Public function Virtual

FReply

 

OnKeyDown

(
    const FGeometry& MyGeometry,
    const FKeyEvent& InKeyEvent
)

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

Public function Virtual

FReply

 

OnKeyUp

(
    const FGeometry& MyGeometry,
    const FKeyEvent& InKeyEvent
)

Called after a key is released when this widget has focus

Public function Virtual

FReply

 

OnMotionDetected

(
    const FGeometry& MyGeometry,
    const FMotionEvent& InMotionEvent
)

Called when motion is detected (controller or device) e.g. Someone tilts or shakes their controller.

Public function Virtual

FReply

 

OnMouseButtonDoubleClick

(
    const FGeometry& InMyGeometry,
    const FPointerEvent& InMouseEvent
)

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

Public function Virtual

FReply

 

OnMouseButtonDown

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

MOUSE INPUT The system calls this method to notify the widget that a mouse button was pressed within it.

Public function Virtual

FReply

 

OnMouseButtonUp

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

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

Public function Virtual

void

 

OnMouseCaptureLost

(
    const FCaptureLostEvent& CaptureLo...
)

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

Public function Virtual

void

 

OnMouseEnter

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

The system will use this event to notify a widget that the cursor has entered it.

Public function Virtual

void

 

OnMouseLeave

(
    const FPointerEvent& MouseEvent
)

The system will use this event to notify a widget that the cursor has left it.

Public function Virtual

FReply

 

OnMouseMove

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

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

Public function Virtual

FReply

 

OnMouseWheel

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

Called when the mouse wheel is spun. This event is bubbled.

Public function Virtual

FNavigationR...

 

OnNavigation

(
    const FGeometry& MyGeometry,
    const FNavigationEvent& InNavigati...
)

Called when navigation is requested e.g. Left Joystick, Direction Pad, Arrow Keys can generate navigation events.

Public function Virtual Const

int32

 

OnPaint

(
    const FPaintArgs& Args,
    const FGeometry& AllottedGeometry,
    const FSlateRect& MyCullingRect,
    FSlateWindowElementList& OutDrawEl...,
    int32 LayerId,
    const FWidgetStyle& InWidgetStyle,
    bool bParentEnabled
)

The widget should respond by populating the OutDrawElements array with FDrawElements that represent it and any of its children.

Public function Virtual

FReply

 

OnPreviewKeyDown

(
    const FGeometry& MyGeometry,
    const FKeyEvent& InKeyEvent
)

Called after a key is pressed when this widget or a child of this widget has focus If a widget handles this event, OnKeyDown will not be passed to the focused widget.

Public function Virtual

FReply

 

OnPreviewMouseButtonDown

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

Just like OnMouseButtonDown, but tunnels instead of bubbling.

Public function Virtual

FReply

 

OnTouchEnded

(
    const FGeometry& MyGeometry,
    const FPointerEvent& InTouchEvent
)

Called when a touchpad touch is ended (finger lifted)

Public function Virtual

FReply

 

OnTouchForceChanged

(
    const FGeometry& MyGeometry,
    const FPointerEvent& TouchEvent
)

Called when a touchpad touch force changes

Public function Virtual

FReply

 

OnTouchGesture

(
    const FGeometry& MyGeometry,
    const FPointerEvent& GestureEvent
)

TOUCH and GESTURES Called when the user performs a gesture on trackpad. This event is bubbled.

Public function Virtual

FReply

 

OnTouchMoved

(
    const FGeometry& MyGeometry,
    const FPointerEvent& InTouchEvent
)

Called when a touchpad touch is moved (finger moved)

Public function Virtual

FReply

 

OnTouchStarted

(
    const FGeometry& MyGeometry,
    const FPointerEvent& InTouchEvent
)

Called when a touchpad touch is started (finger down)

Public function Virtual Const

bool

 

SupportsKeyboardFocus()

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

Public function Virtual

void

 

Tick

(
    const FGeometry& AllottedGeometry,
    const double InCurrentTime,
    const float InDeltaTime
)

SWidget Tick override.

Overridden from FGCObject

Name Description

Public function Virtual

void

 

AddReferencedObjects

(
    FReferenceCollector& Collector
)

Pure virtual that must be overloaded by the inheriting class.

Public function Virtual Const

FString

 

GetReferencerName()

Use this method to report a name for your referencer.

Classes

Name

Description

Public struct

FArguments

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss