UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SObjectWidget.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 "Input/CursorReply.h"
7#include "Input/Reply.h"
8#include "Layout/Visibility.h"
10#include "Layout/Margin.h"
12#include "UObject/GCObject.h"
15
16class FPaintArgs;
18class FWeakWidgetPath;
19class FWidgetPath;
21
22template< typename ObjectType > class TAttribute;
23
31{
34 {
36 }
37
38 SLATE_DEFAULT_SLOT(FArguments, Content)
40
42 UMG_API virtual ~SObjectWidget();
43
44 UMG_API void Construct(const FArguments& InArgs, UUserWidget* InWidgetObject);
45
46 UMG_API void ResetWidget();
47
48 // FGCObject interface
49 UMG_API virtual FString GetReferencerName() const override;
50 UMG_API virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
51 // End of FGCObject interface
52
53 UUserWidget* GetWidgetObject() const { return WidgetObject; }
54
55 UMG_API void SetPadding(const TAttribute<FMargin>& InMargin);
56
58 UMG_API virtual void Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime ) override;
59 UMG_API virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
60
61 UMG_API virtual FVector2D ComputeDesiredSize(float LayoutScaleMultiplier) const override;
62
63 UMG_API virtual bool IsInteractable() const override;
64 UMG_API virtual bool SupportsKeyboardFocus() const override;
65
66 UMG_API virtual FReply OnFocusReceived(const FGeometry& MyGeometry, const FFocusEvent& InFocusEvent) override;
67 UMG_API virtual void OnFocusLost(const FFocusEvent& InFocusEvent) override;
68 UMG_API virtual void OnFocusChanging(const FWeakWidgetPath& PreviousFocusPath, const FWidgetPath& NewWidgetPath, const FFocusEvent& InFocusEvent) override;
69
70 UMG_API virtual FReply OnKeyChar(const FGeometry& MyGeometry, const FCharacterEvent& InCharacterEvent) override;
71 UMG_API virtual FReply OnPreviewKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) override;
72 UMG_API virtual FReply OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) override;
73 UMG_API virtual FReply OnKeyUp(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) override;
74 UMG_API virtual FReply OnAnalogValueChanged(const FGeometry& MyGeometry, const FAnalogInputEvent& InAnalogInputEvent) override;
75
76 UMG_API virtual FReply OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
77 UMG_API virtual FReply OnPreviewMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
78 UMG_API virtual FReply OnMouseButtonUp(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
79 UMG_API virtual FReply OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
80 UMG_API virtual void OnMouseEnter(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
81 UMG_API virtual void OnMouseLeave(const FPointerEvent& MouseEvent) override;
82 UMG_API virtual FReply OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
83 UMG_API virtual FCursorReply OnCursorQuery(const FGeometry& MyGeometry, const FPointerEvent& CursorEvent) const override;
84 UMG_API virtual FReply OnMouseButtonDoubleClick(const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent) override;
85
86 UMG_API virtual FReply OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
87 UMG_API virtual void OnDragEnter(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override;
88 UMG_API virtual void OnDragLeave(const FDragDropEvent& DragDropEvent) override;
89 UMG_API virtual FReply OnDragOver(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override;
90 UMG_API virtual FReply OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override;
91
92 UMG_API virtual void OnDragCancelled(const FDragDropEvent& DragDropEvent, UDragDropOperation* Operation);
93
94 UMG_API virtual FReply OnTouchGesture(const FGeometry& MyGeometry, const FPointerEvent& GestureEvent) override;
95 UMG_API virtual FReply OnTouchStarted(const FGeometry& MyGeometry, const FPointerEvent& InTouchEvent) override;
96 UMG_API virtual FReply OnTouchMoved(const FGeometry& MyGeometry, const FPointerEvent& InTouchEvent) override;
97 UMG_API virtual FReply OnTouchEnded(const FGeometry& MyGeometry, const FPointerEvent& InTouchEvent) override;
98 UMG_API virtual FReply OnMotionDetected(const FGeometry& MyGeometry, const FMotionEvent& InMotionEvent) override;
99 UMG_API virtual FReply OnTouchForceChanged(const FGeometry& MyGeometry, const FPointerEvent& InTouchEvent) override;
100 UMG_API virtual FReply OnTouchFirstMove(const FGeometry& MyGeometry, const FPointerEvent& InTouchEvent) override;
101 UMG_API virtual void OnFinishedPointerInput() override;
102
103 UMG_API virtual FNavigationReply OnNavigation(const FGeometry& MyGeometry, const FNavigationEvent& InNavigationEvent) override;
104
105 UMG_API virtual void OnMouseCaptureLost(const FCaptureLostEvent& CaptureLostEvent) override;
106protected:
107
110
111private:
112 inline bool CanRouteEvent() const
113 {
115 }
116
117 inline bool CanRoutePaint() const
118 {
120 }
121
122#if SLATE_VERBOSE_NAMED_EVENTS
123 FString DebugName;
124 FString DebugTickEventName;
125 FString DebugPaintEventName;
126#endif
127};
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_BEGIN_ARGS(InWidgetType)
Definition DeclarativeSyntaxSupport.h:63
#define SLATE_END_ARGS()
Definition DeclarativeSyntaxSupport.h:116
#define SLATE_DEFAULT_SLOT(DeclarationType, SlotName)
Definition DeclarativeSyntaxSupport.h:444
#define SLATE_DECLARE_WIDGET_API(WidgetType, ParentType, ModuleApiDefine)
Definition SlateControlledConstruction.h:22
Definition CursorReply.h:16
Definition DragAndDrop.h:141
Definition GCObject.h:128
Definition NavigationReply.h:43
Definition PaintArgs.h:23
Definition UObjectGlobals.h:2492
Definition Reply.h:24
Definition SlateRect.h:26
Definition DrawElements.h:220
Definition WidgetPath.h:213
Definition WidgetPath.h:51
Definition WidgetStyle.h:15
Definition SCompoundWidget.h:22
Definition SObjectWidget.h:31
TObjectPtr< UUserWidget > WidgetObject
Definition SObjectWidget.h:109
Definition Attribute.h:17
Definition DragDropOperation.h:55
Definition UserWidget.h:284
bool CanSafelyRouteEvent()
Definition Widget.h:1030
bool CanSafelyRoutePaint()
Definition Widget.h:1035
static SLATECORE_API const EVisibility SelfHitTestInvisible
Definition Visibility.h:26
Definition Events.h:528
Definition Events.h:106
Definition Events.h:606
Definition Events.h:51
Definition Geometry.h:40
Definition Events.h:431
Definition Events.h:1060
Definition Events.h:1148
Definition Events.h:695
Definition ObjectPtr.h:488