UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UIComponentUserWidgetExtension.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"
7
8#include "UIComponentUserWidgetExtension.generated.h"
9
10#define UE_API UMG_API
11
12class UUserWidget;
13class UWidget;
14class UUIComponent;
16
20UCLASS(MinimalAPI, NotBlueprintType, DefaultToInstanced, Experimental)
21class UUIComponentUserWidgetExtension : public UUserWidgetExtension // This Contains all runtime version the components. They should be already resolved.
22{
24
25public:
26 UE_API virtual void Initialize() override;
27 UE_API virtual void PreConstruct(bool bIsDesignTime) override;
28 UE_API virtual void Construct() override;
29 UE_API virtual void Destruct() override;
30
31 UE_API TArray<UUIComponent*> GetComponentsFor(UWidget* Target) const;
32 UE_API UUIComponent* GetComponent(const UClass* ComponentClass, FName OwnerName) const;
33
34 UE_API void InitializeContainer(UUIComponentContainer* InComponentContainer);
35 UE_API bool IsContainerInitialized() const;
36
37
38#if WITH_EDITOR
39 UE_API virtual void InitializeInEditor() override;
40
42
43 // Used only to create a Component on the PreviewWidget in the editor, based on the Component Archetype object in the WidgetBlueprint.
45
46 UE_API void RemoveComponent(const UClass* ComponentClass, FName OwnerName);
47
49
50 UE_API void MoveComponent(FName OwnerName, const UClass* ComponentClass, const UClass* RelativeToComponentClass, bool bMoveAfter);
51
52#endif // WITH_EDITOR
53
54private:
56
57 // Use a single TArray for the Entire UUserWidget to reduce memory usage.
58 UPROPERTY(Transient, DuplicateTransient)
59 TObjectPtr<UUIComponentContainer> ComponentContainer;
60
61 bool bInitialized = false;
62};
63
64#undef UE_API
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UCLASS(...)
Definition ObjectMacros.h:776
void Construct(const FArguments &InArgs)
#define UE_API
Definition UIComponentUserWidgetExtension.h:10
Definition NameTypes.h:617
Definition Array.h:670
Definition Class.h:3793
Definition UIComponentContainer.h:52
UE_API void MoveComponent(FName TargetName, const UClass *ComponentClass, const UClass *RelativeToComponentClass, bool bMoveAfter)
Definition UIComponentContainer.cpp:125
UE_API void RemoveComponent(FName TargetName, UUIComponent *Component)
Definition UIComponentContainer.cpp:49
UE_API UUIComponent * GetComponent(const UClass *ComponentClass, FName TargetName) const
Definition UIComponentContainer.cpp:169
UE_API void InitializeComponents(const UUserWidget *UserWidget)
Definition UIComponentContainer.cpp:201
Definition UIComponentUserWidgetExtension.h:22
Definition UIComponent.h:25
Definition UserWidgetExtension.h:20
Definition UserWidget.h:284
Definition Widget.h:217
Definition RobinHoodHashTable.h:18
Definition ObjectPtr.h:488