UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Widget.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"
8#include "FieldNotificationDeclaration.h"
10#include "Misc/Attribute.h"
13#include "Styling/SlateColor.h"
14#include "Layout/Visibility.h"
15#include "Layout/Geometry.h"
16#include "Widgets/SWidget.h"
17#include "Types/SlateStructs.h"
18#include "Components/Visual.h"
19#include "Styling/SlateBrush.h"
27
28#include "Widget.generated.h"
29
30#ifndef UE_HAS_WIDGET_GENERATED_BY_CLASS
31 #define UE_HAS_WIDGET_GENERATED_BY_CLASS (!UE_BUILD_SHIPPING || WITH_EDITOR)
32#endif
33
34#ifndef WIDGET_INCLUDE_RELFECTION_METADATA
35#define WIDGET_INCLUDE_RELFECTION_METADATA (!UE_BUILD_SHIPPING || WITH_EDITOR)
36#endif
37
38class ULocalPlayer;
39class SObjectWidget;
41class UPanelSlot;
43class UUserWidget;
46enum class ECheckBoxState : uint8;
47
48namespace UMWidget
49{
50 // valid keywords for the UCLASS macro
51 enum
52 {
53 // [ClassMetadata] [PropertyMetadata] Specifies the base class by which to filter available entry classes within DynamicEntryBox and any ListViewBase.
55
56 // [ClassMetadata] [PropertyMetadata] Specifies the base class by which to filter available entry classes within DynamicEntryBox and any ListViewBase.
58 };
59
60 // valid metadata keywords for the UPROPERTY macro
61 enum
62 {
63 // [PropertyMetadata] This property if changed will rebuild the widget designer preview. Use sparingly, try to update most properties by
64 // setting them in the SynchronizeProperties function.
65 // UPROPERTY(meta=(DesignerRebuild))
67
68 // [PropertyMetadata] This property requires a widget be bound to it in the designer. Allows easy native access to designer defined controls.
69 // UPROPERTY(meta=(BindWidget))
71
72 // [PropertyMetadata] This property optionally allows a widget be bound to it in the designer. Allows easy native access to designer defined controls.
73 // UPROPERTY(meta=(BindWidgetOptional))
75
76 // [PropertyMetadata] This property optionally allows a widget be bound to it in the designer. Allows easy native access to designer defined controls.
77 // UPROPERTY(meta=(BindWidget, OptionalWidget=true))
79
80 // [PropertyMetadata] This property requires a widget animation be bound to it in the designer. Allows easy native access to designer defined animations.
81 // UPROPERTY(meta=(BindWidgetAnim))
83
84 // [PropertyMetadata] This property optionally allows a animation widget be bound to it in the designer. Allows easy native access to designer defined animation.
85 // UPROPERTY(meta=(BindWidgetAnimOptional))
87
88 // [PropertyMetadata] Exposes a dynamic delegate property in the details panel for the widget.
89 // UPROPERTY(meta=(IsBindableEvent))
91
92 // [ClassMetadata] [PropertyMetadata] Specifies the base class by which to filter available entry classes within DynamicEntryBox and any ListViewBase.
93 // EntryClass, (Commented out so as to avoid duplicate name with version in the Class section, but still show in the property section)
94
95 // [ClassMetadata] [PropertyMetadata] Specifies the base class by which to filter available entry classes within DynamicEntryBox and any ListViewBase.
96 //EntryInterface, (Commented out so as to avoid duplicate name with version in the Class section, but still show in the property section)
97 };
98}
99
100
101
102
103#if WITH_EDITOR
104
109#define PROPERTY_BINDING(ReturnType, MemberName) \
110 ( MemberName ## Delegate.IsBound() && !IsDesignTime() ) \
111 ? \
112 BIND_UOBJECT_ATTRIBUTE(ReturnType, K2_Gate_ ## MemberName) \
113 : \
114 TAttribute< ReturnType >(MemberName)
115
116#define BITFIELD_PROPERTY_BINDING(MemberName) \
117 ( MemberName ## Delegate.IsBound() && !IsDesignTime() ) \
118 ? \
119 BIND_UOBJECT_ATTRIBUTE(bool, K2_Gate_ ## MemberName) \
120 : \
121 TAttribute< bool >(MemberName != 0)
122
123#define PROPERTY_BINDING_IMPLEMENTATION(ReturnType, MemberName) \
124 ReturnType K2_Cache_ ## MemberName; \
125 ReturnType K2_Gate_ ## MemberName() \
126 { \
127 if (CanSafelyRouteEvent()) \
128 { \
129 K2_Cache_ ## MemberName = TAttribute< ReturnType >::Create(MemberName ## Delegate.GetUObject(), MemberName ## Delegate.GetFunctionName()).Get(); \
130 } \
131 \
132 return K2_Cache_ ## MemberName; \
133 }
134
135#else
136
137#define PROPERTY_BINDING(ReturnType, MemberName) \
138 ( MemberName ## Delegate.IsBound() && !IsDesignTime() ) \
139 ? \
140 TAttribute< ReturnType >::Create(MemberName ## Delegate.GetUObject(), MemberName ## Delegate.GetFunctionName()) \
141 : \
142 TAttribute< ReturnType >(MemberName)
143
144#define BITFIELD_PROPERTY_BINDING(MemberName) \
145 ( MemberName ## Delegate.IsBound() && !IsDesignTime() ) \
146 ? \
147 TAttribute< bool >::Create(MemberName ## Delegate.GetUObject(), MemberName ## Delegate.GetFunctionName()) \
148 : \
149 TAttribute< bool >(MemberName != 0)
150
151#define PROPERTY_BINDING_IMPLEMENTATION(Type, MemberName)
152
153#endif
154
155#define GAME_SAFE_OPTIONAL_BINDING(ReturnType, MemberName) PROPERTY_BINDING(ReturnType, MemberName)
156#define GAME_SAFE_BINDING_IMPLEMENTATION(ReturnType, MemberName) PROPERTY_BINDING_IMPLEMENTATION(ReturnType, MemberName)
157
162#define OPTIONAL_BINDING_CONVERT(ReturnType, MemberName, ConvertedType, ConversionFunction) \
163 ( MemberName ## Delegate.IsBound() && !IsDesignTime() ) \
164 ? \
165 TAttribute< ConvertedType >::Create(TAttribute< ConvertedType >::FGetter::CreateUObject(this, &ThisClass::ConversionFunction, TAttribute< ReturnType >::Create(MemberName ## Delegate.GetUObject(), MemberName ## Delegate.GetFunctionName()))) \
166 : \
167 ConversionFunction(TAttribute< ReturnType >(MemberName))
168
169
170
174UENUM()
176{
177 None = 0,
178 Designing = 1 << 0,
179 ShowOutline = 1 << 1,
180 ExecutePreConstruct = 1 << 2,
181 Previewing = 1 << 3
182};
183
185
186
187#if WITH_EDITOR
188
194{
195public:
198 , Size(0, 0)
199 , DpiScale(1.0f)
200 {
201 }
202
203public:
204 bool bScreenPreview;
206 float DpiScale;
207};
208
209#endif
210
211
215UCLASS(Abstract, BlueprintType, Blueprintable, CustomFieldNotify, MinimalAPI)
217{
219
221
222public:
232
233 // Common Bindings - If you add any new common binding, you must provide a UPropertyBinding for it.
234 // all primitive binding in UMG goes through native binding evaluators to prevent
235 // thunking through the VM.
247
248 // Events
251
252 // Events
255
257
259
263 UPROPERTY(Instanced, TextExportTransient, EditAnywhere, BlueprintReadOnly, Category=Layout, meta=(ShowOnlyInnerProperties))
265
267 UPROPERTY()
268 FGetBool bIsEnabledDelegate;
269
271 UPROPERTY()
272 FGetText ToolTipTextDelegate;
273
274 UE_DEPRECATED(5.1, "Direct access to ToolTipText is deprecated. Please use the getter or setter.")
276 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintSetter="SetToolTipText", Category="Behavior", meta=(MultiLine=true))
277 FText ToolTipText;
278
279 UE_DEPRECATED(5.1, "Direct access to ToolTipWidget is deprecated. Please use the getter or setter.")
281 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Getter="GetToolTip", Setter="SetToolTip", BlueprintSetter="SetToolTip", Category="Behavior", AdvancedDisplay)
282 TObjectPtr<UWidget> ToolTipWidget;
283
285 UPROPERTY()
286 FGetWidget ToolTipWidgetDelegate;
287
288
290 UPROPERTY()
291 FGetSlateVisibility VisibilityDelegate;;
292
293public:
294
295 UE_DEPRECATED(5.1, "Direct access to RenderTransform is deprecated. Please use the getter or setter.")
297 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintSetter="SetRenderTransform", Category="Render Transform", meta = (DisplayName = "Transform"))
299
300 UE_DEPRECATED(5.1, "Direct access to RenderTransformPivot is deprecated. Please use the getter or setter.")
305 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintSetter="SetRenderTransformPivot", Category="Render Transform", meta=( DisplayName="Pivot" ))
306 FVector2D RenderTransformPivot;
307
308 UE_DEPRECATED(5.1, "Direct access to FlowDirectionPreference is deprecated. Please use the getter or setter.")
310 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, Category="Localization")
311 EFlowDirectionPreference FlowDirectionPreference;
312
317 UPROPERTY()
318 uint8 bIsVariable:1;
319
322 uint8 bCreatedByConstructionScript:1;
323
324 UE_DEPRECATED(5.1, "Direct access to bIsEnabled is deprecated. Please use the getter or setter.")
326 UPROPERTY(EditAnywhere, BlueprintReadWrite, FieldNotify, Getter="GetIsEnabled", Setter="SetIsEnabled", BlueprintGetter="GetIsEnabled", BlueprintSetter="SetIsEnabled", Category="Behavior")
327 uint8 bIsEnabled:1;
328
330 UPROPERTY(EditAnywhere, Category="Behavior", meta=(InlineEditConditionToggle))
331 uint8 bOverride_Cursor : 1;
332
333#if WITH_EDITORONLY_DATA
334 // These editor-only properties exist for two reasons:
335 // 1. To make details customization easier to write, specifically in regards to the binding extension widget
336 // 2. To allow subclasses to set their default values without having to subclass USlateAccessibleWidgetData
337 // Every time one of these properties changes, it's data is propagated to AccessibleWidgetData if it exists.
338 // The creations of AccessibleWidgetData is controlled by the details customization through a CheckBox.
339 // The reason this is set up like this is to reduce the memory footprint of UWidget since overriding the default
340 // accessibility rules for a particular widget will be relatively rare. In a shipped game, if no custom rules
341 // are defined, there will only be the memory cost of the UObject pointer.
342 //
343 // IMPORTANT: Any user-editable variables added to USlateAccessibleWidgetData should be duplicated here as well.
344 // Additionally, its edit condition must be manually assigned in UMGDetailCustomizations.
345
347 UPROPERTY(EditAnywhere, Category="Accessibility")
349
351 UPROPERTY(EditAnywhere, Category="Accessibility", meta=(EditCondition="bOverrideAccessibleDefaults"))
352 uint8 bCanChildrenBeAccessible : 1;
353
355 UPROPERTY(EditAnywhere, Category="Accessibility", meta=(EditCondition="bOverrideAccessibleDefaults"))
356 ESlateAccessibleBehavior AccessibleBehavior;
357
359 UPROPERTY(EditAnywhere, Category="Accessibility", AdvancedDisplay, meta=(EditCondition="bOverrideAccessibleDefaults"))
360 ESlateAccessibleBehavior AccessibleSummaryBehavior;
361
363 UPROPERTY(EditAnywhere, Category="Accessibility", meta=(MultiLine=true))
364 FText AccessibleText;
365
367 UPROPERTY()
368 USlateAccessibleWidgetData::FGetText AccessibleTextDelegate;
369
371 UPROPERTY(EditAnywhere, Category="Accessibility", meta=(MultiLine=true), AdvancedDisplay)
372 FText AccessibleSummaryText;
373
375 UPROPERTY()
376 USlateAccessibleWidgetData::FGetText AccessibleSummaryTextDelegate;
377#endif
378
379protected:
380
387 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Performance")
388 uint8 bIsVolatile:1;
389
391 uint8 bIsManagedByGameViewportSubsystem:1;
392
394 bool bShouldBroadcastState : 1;
395
397 bool bWidgetStateInitialized : 1;
398
399public:
402 uint8 bWrappedByComponent : 1;
403
404public:
405#if WITH_EDITORONLY_DATA
407 UPROPERTY()
409
411 UPROPERTY()
413
415 UPROPERTY()
417#endif
418
419 UE_DEPRECATED(5.1, "Direct access to Cursor is deprecated. Please use the getter or setter.")
421 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintSetter="SetCursor", Category="Behavior", AdvancedDisplay, meta = (editcondition = "bOverride_Cursor"))
423
424 UE_DEPRECATED(5.1, "Direct access to Clipping is deprecated. Please use the getter or setter.")
434 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, Category="Rendering")
436
437 UE_DEPRECATED(5.1, "Direct access to Visibility is deprecated. Please use the getter or setter.")
439 UPROPERTY(EditAnywhere, BlueprintReadWrite, FieldNotify, Getter, Setter, BlueprintGetter="GetVisibility", BlueprintSetter="SetVisibility", Category="Behavior")
441
442private:
444 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, Category = "Rendering", meta=(AllowPrivateAccess = true))
445 EWidgetPixelSnapping PixelSnapping;
446
448
449 UE_DEPRECATED(5.1, "Direct access to RenderOpacity is deprecated. Please use the getter or setter.")
451 UPROPERTY(EditAnywhere, BlueprintReadWrite, Getter, Setter, BlueprintGetter="GetRenderOpacity", BlueprintSetter="SetRenderOpacity", Category="Rendering", meta = (UIMin = "0", UIMax = "1"))
452 float RenderOpacity;
453
454private:
456 UPROPERTY(Instanced)
457 TObjectPtr<USlateAccessibleWidgetData> AccessibleWidgetData;
458
459public:
465 UPROPERTY(Instanced, EditAnywhere, BlueprintReadOnly, Category="Navigation")
467
468#if WITH_EDITORONLY_DATA
469
472
473#endif
474
475public:
476
477#if WITH_EDITOR
478
480 bool IsLockedInDesigner() const
481 {
482 return bLockedInDesigner;
483 }
484
487 {
489 }
490
491#endif
492
493#if UE_HAS_WIDGET_GENERATED_BY_CLASS
496#endif
497
498public:
500 UMG_API const FWidgetTransform& GetRenderTransform() const;
501
503 UFUNCTION(BlueprintCallable, Category="Widget|Transform")
504 UMG_API void SetRenderTransform(FWidgetTransform InTransform);
505
507 UFUNCTION(BlueprintCallable, Category="Widget|Transform")
508 UMG_API void SetRenderScale(FVector2D Scale);
509
511 UFUNCTION(BlueprintCallable, Category="Widget|Transform")
512 UMG_API void SetRenderShear(FVector2D Shear);
513
515 UFUNCTION(BlueprintCallable, Category="Widget|Transform")
516 UMG_API void SetRenderTransformAngle(float Angle);
517
519 UFUNCTION(BlueprintCallable, Category = "Widget|Transform")
520 UMG_API float GetRenderTransformAngle() const;
521
523 UFUNCTION(BlueprintCallable, Category="Widget|Transform")
524 UMG_API void SetRenderTranslation(FVector2D Translation);
525
527 UMG_API FVector2D GetRenderTransformPivot() const;
528
530 UFUNCTION(BlueprintCallable, Category="Widget|Transform")
531 UMG_API void SetRenderTransformPivot(FVector2D Pivot);
532
534 UMG_API EFlowDirectionPreference GetFlowDirectionPreference() const;
535
537 UMG_API void SetFlowDirectionPreference(EFlowDirectionPreference FlowDirection);
538
540 UFUNCTION(BlueprintCallable, Category="Widget")
541 UMG_API bool GetIsEnabled() const;
542
544 UFUNCTION(BlueprintCallable, Category="Widget")
545 UMG_API virtual void SetIsEnabled(bool bInIsEnabled);
546
547 /* @return true if the widget was added to the viewport using AddToViewport or AddToPlayerScreen. */
548 UFUNCTION(BlueprintPure, BlueprintCosmetic, Category = "Appearance")
549 UMG_API bool IsInViewport() const;
550
552 UMG_API FText GetToolTipText() const;
553
555 UFUNCTION(BlueprintCallable, Category="Widget")
556 UMG_API void SetToolTipText(const FText& InToolTipText);
557
559 UMG_API UWidget* GetToolTip() const;
560
562 UFUNCTION(BlueprintCallable, Category="Widget")
563 UMG_API void SetToolTip(UWidget* Widget);
564
566 UMG_API EMouseCursor::Type GetCursor() const;
567
569 UFUNCTION(BlueprintCallable, Category="Widget")
570 UMG_API void SetCursor(EMouseCursor::Type InCursor);
571
573 UFUNCTION(BlueprintCallable, Category="Widget")
574 UMG_API void ResetCursor();
575
577 UFUNCTION(BlueprintCallable, Category="Widget")
578 UMG_API bool IsRendered() const;
579
581 UFUNCTION(BlueprintCallable, Category="Widget")
582 UMG_API bool IsVisible() const;
583
585 UFUNCTION(BlueprintCallable, Category="Widget")
586 UMG_API ESlateVisibility GetVisibility() const;
587
589 UFUNCTION(BlueprintCallable, Category="Widget")
590 UMG_API virtual void SetVisibility(ESlateVisibility InVisibility);
591
593 UMG_API void SetVisibilityInternal(ESlateVisibility InVisibility);
594
595public:
597 UFUNCTION(BlueprintCallable, Category="Widget")
598 UMG_API float GetRenderOpacity() const;
599
601 UFUNCTION(BlueprintCallable, Category="Widget")
602 UMG_API void SetRenderOpacity(float InOpacity);
603
605 UFUNCTION(BlueprintCallable, Category = "Widget")
606 UMG_API EWidgetClipping GetClipping() const;
607
609 UFUNCTION(BlueprintCallable, Category = "Widget")
610 UMG_API void SetClipping(EWidgetClipping InClipping);
611
613 UMG_API EWidgetPixelSnapping GetPixelSnapping() const;
614
616 UMG_API void SetPixelSnapping(EWidgetPixelSnapping InPixelSnapping);
617
619 UFUNCTION(BlueprintCallable, Category="Widget")
620 UMG_API void ForceVolatile(bool bForce);
621
623 UFUNCTION(BlueprintCallable, Category="Widget")
624 UMG_API virtual bool IsHovered() const;
625
631 UFUNCTION(BlueprintCallable, Category="Widget")
632 UMG_API bool HasKeyboardFocus() const;
633
638 UFUNCTION(BlueprintCallable, Category="Widget")
639 UMG_API bool HasMouseCapture() const;
640
647 UFUNCTION(BlueprintCallable, Category = "Widget")
648 UMG_API bool HasMouseCaptureByUser(int32 UserIndex, int32 PointerIndex = -1) const;
649
651 UFUNCTION(BlueprintCallable, Category="Widget")
652 UMG_API void SetKeyboardFocus();
653
655 UFUNCTION(BlueprintCallable, Category="Widget")
656 UMG_API bool HasUserFocus(APlayerController* PlayerController) const;
657
659 UFUNCTION(BlueprintCallable, Category="Widget")
660 UMG_API bool HasAnyUserFocus() const;
661
663 UFUNCTION(BlueprintCallable, Category="Widget", meta=(DisplayName="HasAnyUserFocusedDescendants"))
664 UMG_API bool HasFocusedDescendants() const;
665
667 UFUNCTION(BlueprintCallable, Category="Widget")
668 UMG_API bool HasUserFocusedDescendants(APlayerController* PlayerController) const;
669
671 UFUNCTION(BlueprintCallable, Category="Widget")
672 UMG_API void SetFocus();
673
675 UFUNCTION(BlueprintCallable, Category="Widget")
676 UMG_API void SetUserFocus(APlayerController* PlayerController);
677
683 UFUNCTION(BlueprintCallable, Category="Widget")
684 UMG_API void ForceLayoutPrepass();
685
690 UFUNCTION(BlueprintCallable, Category="Widget")
691 UMG_API void InvalidateLayoutAndVolatility();
692
700 UFUNCTION(BlueprintCallable, Category="Widget")
701 UMG_API FVector2D GetDesiredSize() const;
702
708 UFUNCTION(BlueprintCallable, Category = "Widget")
709 UMG_API void SetAllNavigationRules(EUINavigationRule Rule, FName WidgetToFocus);
710
717 UE_DEPRECATED(4.23, "SetNavigationRule is deprecated. Please use either SetNavigationRuleBase or SetNavigationRuleExplicit or SetNavigationRuleCustom or SetNavigationRuleCustomBoundary.")
718 UFUNCTION(BlueprintCallable, Category = "Widget", meta = (DeprecatedFunction, DeprecatedMessage = "Please use either SetNavigationRuleBase or SetNavigationRuleExplicit or SetNavigationRuleCustom or SetNavigationRuleCustomBoundary."))
719 UMG_API void SetNavigationRule(EUINavigation Direction, EUINavigationRule Rule, FName WidgetToFocus);
720
726 UFUNCTION(BlueprintCallable, Category = "Widget")
727 UMG_API void SetNavigationRuleBase(EUINavigation Direction, EUINavigationRule Rule);
728
734 UFUNCTION(BlueprintCallable, Category = "Widget")
735 UMG_API void SetNavigationRuleExplicit(EUINavigation Direction, UWidget* InWidget);
736
742 UFUNCTION(BlueprintCallable, Category = "Widget")
743 UMG_API void SetNavigationRuleCustom(EUINavigation Direction, FCustomWidgetNavigationDelegate InCustomDelegate);
744
750 UFUNCTION(BlueprintCallable, Category = "Widget")
751 UMG_API void SetNavigationRuleCustomBoundary(EUINavigation Direction, FCustomWidgetNavigationDelegate InCustomDelegate);
752
757 UMG_API void SetNavigationMethod(const TInstancedStruct<FNavigationMethod>& NavigationMethod);
758
760 UFUNCTION(BlueprintCallable, Category="Widget")
761 UMG_API class UPanelWidget* GetParent() const;
762
767 UFUNCTION(BlueprintCallable, Category="Widget")
768 UMG_API virtual void RemoveFromParent();
769
779 UFUNCTION(BlueprintCallable, Category="Widget")
780 UMG_API const FGeometry& GetCachedGeometry() const;
781
782 UFUNCTION(BlueprintCallable, Category="Widget")
783 UMG_API const FGeometry& GetTickSpaceGeometry() const;
784
785 UFUNCTION(BlueprintCallable, Category="Widget")
786 UMG_API const FGeometry& GetPaintSpaceGeometry() const;
787
788 //~ Begin INotifyFieldValueChanged Interface
789public:
791 UMG_API virtual bool RemoveFieldValueChangedDelegate(UE::FieldNotification::FFieldId InFieldId, FDelegateHandle InHandle) override final;
792 UMG_API virtual int32 RemoveAllFieldValueChangedDelegates(FDelegateUserObjectConst InUserObject) override final;
793 UMG_API virtual int32 RemoveAllFieldValueChangedDelegates(UE::FieldNotification::FFieldId InFieldId, FDelegateUserObjectConst InUserObject) override final;
794 UMG_API virtual void BroadcastFieldValueChanged(UE::FieldNotification::FFieldId InFieldId) override final;
795 //~ End INotifyFieldValueChanged Interface
796
797 UFUNCTION(BlueprintCallable, Category = "FieldNotify", meta = (DisplayName = "Add Field Value Changed Delegate", ScriptName = "AddFieldValueChangedDelegate"))
798 UMG_API void K2_AddFieldValueChangedDelegate(FFieldNotificationId FieldId, FFieldValueChangedDynamicDelegate Delegate);
799
800 UFUNCTION(BlueprintCallable, Category = "FieldNotify", meta = (DisplayName = "Remove Field Value Changed Delegate", ScriptName="RemoveFieldValueChangedDelegate"))
801 UMG_API void K2_RemoveFieldValueChangedDelegate(FFieldNotificationId FieldId, FFieldValueChangedDynamicDelegate Delegate);
802
804 UFUNCTION(BlueprintCallable, Category="FieldNotify", meta = (DisplayName="Broadcast Field Value Changed", ScriptName="BroadcastFieldValueChanged"))
805 UMG_API void K2_BroadcastFieldValueChanged(FFieldNotificationId FieldId);
806
807public:
815 UMG_API TSharedRef<SWidget> TakeWidget();
816
836 template <class WidgetType = SObjectWidget>
837 TSharedRef<WidgetType> TakeDerivedWidget(ConstructMethodType ConstructMethod)
838 {
839 static_assert(TIsDerivedFrom<WidgetType, SObjectWidget>::IsDerived, "TakeDerivedWidget can only be used to create SObjectWidget instances");
840 return StaticCastSharedRef<WidgetType>(TakeWidget_Private(ConstructMethod));
841 }
842
843private:
844 UMG_API TSharedRef<SWidget> TakeWidget_Private( ConstructMethodType ConstructMethod );
845
846public:
847
849 UMG_API TSharedPtr<SWidget> GetCachedWidget() const;
850
852 UMG_API TSharedPtr<SWidget> GetCachedWrappedWidget() const;
853
854
856 UMG_API bool IsConstructed() const;
857
862 UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Widget")
863 UMG_API UGameInstance* GetGameInstance() const;
864
870 TGameInstance* GetGameInstance() const
871 {
872 return Cast<TGameInstance>(GetGameInstance());
873 }
874
879 UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Widget")
880 UMG_API virtual APlayerController* GetOwningPlayer() const;
881
887 TPlayerController* GetOwningPlayer() const
888 {
889 return Cast<TPlayerController>(GetOwningPlayer());
890 }
891
896 UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Widget")
897 UMG_API virtual ULocalPlayer* GetOwningLocalPlayer() const;
898
903 template < class T >
904 T* GetOwningLocalPlayer() const
905 {
906 return Cast<T>(GetOwningLocalPlayer());
907 }
908
914 UFUNCTION(BlueprintCallable, Category = "Widget")
915 UMG_API FText GetAccessibleText() const;
916
922 UFUNCTION(BlueprintCallable, Category = "Widget")
923 UMG_API FText GetAccessibleSummaryText() const;
924
930 UMG_API virtual void SynchronizeProperties();
931
937 UMG_API void BuildNavigation();
938
939#if WITH_EDITOR
941 inline bool IsDesignTime() const
942 {
944 }
945
948
951 {
952 return static_cast<EWidgetDesignFlags>(DesignerFlags);
953 }
954
957 {
959 }
960
961 inline bool IsPreviewTime() const
962 {
964 }
965
967 const FString& GetDisplayLabel() const
968 {
969 return DisplayLabel;
970 }
971
973 UMG_API void SetDisplayLabel(const FString& DisplayLabel);
974
976 UMG_API const FString& GetCategoryName() const;
977
979 UMG_API void SetCategoryName(const FString& InValue);
980
986 virtual void ValidateCompiledDefaults(class IWidgetCompilerLog& CompileLog) const {}
987
989 UMG_API virtual bool Modify(bool bAlwaysMarkDirty = true) override;
990#else
991 inline bool IsDesignTime() const { return false; }
992 inline bool IsPreviewTime() const { return false; }
993#endif
994
1000
1002 UMG_API bool AddBinding(FDelegateProperty* DelegateProperty, UObject* SourceObject, const FDynamicPropertyPath& BindingPath);
1003
1012 UMG_API FDelegateHandle RegisterPostStateListener(const FOnWidgetStateBroadcast::FDelegate& ListenerDelegate, bool bBroadcastCurrentState = true);
1013
1019 UMG_API void UnregisterPostStateListener(const FDelegateHandle& ListenerDelegate);
1020
1021 static UMG_API TSubclassOf<UPropertyBinding> FindBinderClassForDestination(FProperty* Property);
1022
1023 //~ Begin UObject
1024 UMG_API virtual UWorld* GetWorld() const override;
1025 UMG_API virtual void BeginDestroy() override;
1026 UMG_API virtual void FinishDestroy() override;
1027 UMG_API virtual void PreSave(FObjectPreSaveContext ObjectSaveContext) override;
1028 //~ End UObject
1029
1031 {
1032 return !IsDesignTime() && CanSafelyRouteCall();
1033 }
1034
1036 {
1037 return CanSafelyRouteCall();
1038 }
1039
1040protected:
1042
1043public:
1044
1045#if WITH_EDITOR
1046
1048 UMG_API bool IsGeneratedName() const;
1049
1051 UMG_API virtual FString GetLabelMetadata() const;
1052
1054 UMG_API FText GetLabelText() const;
1055
1058
1060 UMG_API virtual const FText GetPaletteCategory();
1061
1064
1069 virtual void OnCreationFromPalette() { }
1070
1072 virtual void ConnectEditorData() { }
1073
1074 // UObject interface
1075 UMG_API virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
1076 // End of UObject interface
1077
1079 UMG_API bool IsVisibleInDesigner() const;
1080
1081 // Begin Designer contextual events
1084
1086
1087 virtual void OnSelectedByDesigner() { }
1088 virtual void OnDeselectedByDesigner() { }
1089
1092
1093 virtual void OnBeginEditByDesigner() { }
1094 virtual void OnEndEditByDesigner() { }
1095 // End Designer contextual events
1096#endif
1097
1098 // Utility methods
1099 //@TODO UMG: Should move elsewhere
1100 static UMG_API EVisibility ConvertSerializedVisibilityToRuntime(ESlateVisibility Input);
1101 static UMG_API ESlateVisibility ConvertRuntimeToSerializedVisibility(const EVisibility& Input);
1102
1103 static UMG_API FSizeParam ConvertSerializedSizeParamToRuntime(const FSlateChildSize& Input);
1104
1105 static UMG_API UWidget* FindChildContainingDescendant(UWidget* Root, UWidget* Descendant);
1106
1107 static UMG_API FString GetDefaultFontName();
1108
1109protected:
1110#if WITH_EDITOR
1111 // This is an implementation detail that allows us to show and hide the widget in the designer
1112 // regardless of the actual visibility state set by the user.
1114
1115 UMG_API bool IsEditorWidget() const;
1116#endif
1117
1118 UMG_API virtual void OnBindingChanged(const FName& Property);
1119
1126 UMG_API void BroadcastBinaryPostStateChange(const FWidgetStateBitfield& StateChange, bool bInValue);
1127
1133 UE_DEPRECATED(5.5, "FWidgetStateBitfield currently no longer supports enum states")
1134 UMG_API void BroadcastEnumPostStateChange(const FWidgetStateBitfield& StateChange);
1135
1136protected:
1137 UMG_API UObject* GetSourceAssetOrClass() const;
1138
1140 UMG_API virtual TSharedRef<SWidget> RebuildWidget();
1141
1143 UMG_API virtual void OnWidgetRebuilt();
1144
1145#if WITH_EDITOR
1147
1149
1152#endif
1153
1154 UMG_API void UpdateRenderTransform();
1155
1157 UMG_API void SynchronizeAccessibleData();
1158
1159protected:
1160 //TODO UMG Consider moving conversion functions into another class.
1161 // Conversion functions
1163 {
1165 return ConvertSerializedVisibilityToRuntime(SlateVisibility);
1166 }
1167
1172
1177
1178 UMG_API void SetNavigationRuleInternal(EUINavigation Direction, EUINavigationRule Rule, FName WidgetToFocus = NAME_None, UWidget* InWidget = nullptr, FCustomWidgetNavigationDelegate InCustomDelegate = FCustomWidgetNavigationDelegate());
1179
1180#if WITH_ACCESSIBILITY
1183#endif
1184
1185protected:
1188
1191
1194
1197
1200
1204
1206
1207private:
1208 TBitArray<> EnabledFieldNotifications;
1209
1210#if WITH_EDITORONLY_DATA
1214
1216 UPROPERTY()
1217 FString DisplayLabel;
1218
1221
1223 UPROPERTY()
1224 FString CategoryName;
1225#endif
1226
1227#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
1228
1229 UMG_API void VerifySynchronizeProperties();
1230
1232 bool bRoutedSynchronizeProperties;
1233
1234#else
1235 inline void VerifySynchronizeProperties() { }
1236#endif
1237
1238private:
1240 PROPERTY_BINDING_IMPLEMENTATION(bool, bIsEnabled);
1241#if WITH_EDITORONLY_DATA
1242 PROPERTY_BINDING_IMPLEMENTATION(FText, AccessibleText);
1243 PROPERTY_BINDING_IMPLEMENTATION(FText, AccessibleSummaryText);
1244#endif
1245};
EWidgetClipping
Definition Clipping.h:20
#define GIntraFrameDebuggingGameThread
Definition CoreGlobals.h:234
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
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 DECLARE_MULTICAST_DELEGATE_TwoParams(DelegateName, Param1Type, Param2Type)
Definition DelegateCombinations.h:58
#define DECLARE_DYNAMIC_DELEGATE_RetVal_TwoParams(ReturnValueType, DelegateName, Param1Type, Param1Name, Param2Type, Param2Name)
Definition DelegateCombinations.h:64
#define DECLARE_DYNAMIC_DELEGATE_RetVal_OneParam(ReturnValueType, DelegateName, Param1Type, Param1Name)
Definition DelegateCombinations.h:55
#define DECLARE_DYNAMIC_DELEGATE_RetVal(ReturnValueType, DelegateName)
Definition DelegateCombinations.h:44
constexpr bool EnumHasAnyFlags(Enum Flags, Enum Contains)
Definition EnumClassFlags.h:35
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
return true
Definition ExternalRpcRegistry.cpp:601
#define UE_FIELD_NOTIFICATION_DECLARE_ENUM_FIELD_END()
Definition FieldNotificationDeclaration.h:86
#define UE_FIELD_NOTIFICATION_DECLARE_CLASS_DESCRIPTOR_BASE_END()
Definition FieldNotificationDeclaration.h:75
#define UE_FIELD_NOTIFICATION_DECLARE_FIELD(Name, API_STRING)
Definition FieldNotificationDeclaration.h:91
#define UE_FIELD_NOTIFICATION_DECLARE_ENUM_FIELD(Name)
Definition FieldNotificationDeclaration.h:95
#define UE_FIELD_NOTIFICATION_DECLARE_ENUM_FIELD_BEGIN(Name)
Definition FieldNotificationDeclaration.h:80
#define UE_FIELD_NOTIFICATION_DECLARE_CLASS_DESCRIPTOR_BASE_BEGIN(API_STRING)
Definition FieldNotificationDeclaration.h:63
EFlowDirectionPreference
Definition FlowDirection.h:30
const void * FDelegateUserObjectConst
Definition IDelegateInstance.h:108
EUINavigationRule
Definition NavigationReply.h:15
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
EUINavigation
Definition SlateEnums.h:99
ECheckBoxState
Definition SlateTypes.h:65
ESlateVisibility
Definition SlateWrapperTypes.h:22
ESlateAccessibleBehavior
Definition SlateWrapperTypes.h:38
uint32 Size
Definition VulkanMemory.cpp:4034
EWidgetPixelSnapping
Definition WidgetPixelSnapping.h:15
EWidgetDesignFlags
Definition Widget.h:176
#define PROPERTY_BINDING_IMPLEMENTATION(Type, MemberName)
Definition Widget.h:151
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition PlayerController.h:261
Definition IDelegateInstance.h:14
Definition UnrealType.h:6397
Definition NameTypes.h:617
Definition ObjectSaveContext.h:244
Definition UnrealType.h:174
Definition Text.h:385
bool IsRoutingPostLoad
Definition UObjectThreadContext.h:95
Definition FieldNotification.Build.cs:6
Definition INotifyFieldValueChanged.h:23
Definition SObjectWidget.h:31
Definition SWidget.h:165
Definition Array.h:670
Definition Attribute.h:17
Definition BitArray.h:350
Definition DelegateSignatureImpl.inl:310
Definition EnumAsByte.h:22
Definition AssetRegistryState.h:50
Definition SharedPointer.h:692
Definition SharedPointer.h:153
Definition SubclassOf.h:30
static FORCEINLINE FUObjectThreadContext & Get()
Definition ThreadSingleton.h:101
Definition SharedPointer.h:1295
Definition GameInstance.h:152
Definition GameViewportSubsystem.h:53
Definition LocalPlayer.h:169
Definition Object.h:95
Definition PanelSlot.h:13
Definition PanelWidget.h:15
Definition PropertyBinding.h:18
Definition SlateWrapperTypes.h:62
Definition UserWidget.h:284
Definition Visual.h:13
Definition WidgetNavigation.h:53
Definition Widget.h:217
bool IsPreviewTime() const
Definition Widget.h:992
TWeakObjectPtr< UClass > WidgetGeneratedByClass
Definition Widget.h:495
bool CanSafelyRouteCall()
Definition Widget.h:1041
bool IsDesignTime() const
Definition Widget.h:991
FOnWidgetStateBroadcast PostWidgetStateChanged
Definition Widget.h:1199
bool CanSafelyRouteEvent()
Definition Widget.h:1030
TOptional< float > ConvertFloatToOptionalFloat(TAttribute< float > InFloat) const
Definition Widget.h:1168
bool CanSafelyRoutePaint()
Definition Widget.h:1035
EVisibility ConvertVisibility(TAttribute< ESlateVisibility > SerializedType) const
Definition Widget.h:1162
TWeakPtr< SObjectWidget > MyGCWidget
Definition Widget.h:1193
FWidgetStateBitfield MyWidgetStateBitfield
Definition Widget.h:1196
TWeakPtr< SWidget > MyWidget
Definition Widget.h:1187
FSlateColor ConvertLinearColorToSlateColor(TAttribute< FLinearColor > InLinearColor) const
Definition Widget.h:1173
TWeakPtr< SWidget > ComponentWrapperWidget
Definition Widget.h:1190
Definition World.h:918
Definition ICursor.h:16
Definition FieldSystemNoiseAlgo.cpp:6
Definition AdvancedWidgetsModule.cpp:13
Definition Widget.h:49
@ BindWidgetAnim
Definition Widget.h:82
@ BindWidgetOptional
Definition Widget.h:74
@ DesignerRebuild
Definition Widget.h:66
@ BindWidgetAnimOptional
Definition Widget.h:86
@ BindWidget
Definition Widget.h:70
@ OptionalWidget
Definition Widget.h:78
@ IsBindableEvent
Definition Widget.h:90
@ EntryInterface
Definition Widget.h:57
@ EntryClass
Definition Widget.h:54
@ false
Definition radaudio_common.h:23
Definition Visibility.h:12
Definition DynamicPropertyPath.h:19
Definition SlateWrapperTypes.h:129
Definition FieldNotificationId.h:86
Definition Geometry.h:40
Definition Color.h:48
Definition NavigationMethod.h:12
Definition Events.h:695
Definition UnrealType.h:6865
Definition SlateStructs.h:96
Definition SlateBrush.h:239
Definition SlateWrapperTypes.h:145
Definition SlateColor.h:42
Definition WidgetStateBitfield.h:23
Definition WidgetTransform.h:16
Definition InstancedStruct.h:307
Definition UnrealTypeTraits.h:40
Definition ObjectPtr.h:488
Definition Optional.h:131
constexpr const OptionalType & Get(const OptionalType &DefaultValue UE_LIFETIMEBOUND) const UE_LIFETIMEBOUND
Definition Optional.h:472
Definition WeakObjectPtrTemplates.h:25