You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
[FYI] vincent.gauthier #ROBOMERGE-AUTHOR: patrick.boutot #ROBOMERGE-SOURCE: CL 20142060 via CL 20143142 via CL 20143633 #ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690) [CL 20148091 by patrick boutot in ue5-main branch]
85 lines
1.7 KiB
C++
85 lines
1.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Components/Overlay.h"
|
|
#include "Components/OverlaySlot.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "UMG"
|
|
|
|
/////////////////////////////////////////////////////
|
|
// UOverlay
|
|
|
|
UOverlay::UOverlay(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
bIsVariable = false;
|
|
SetVisibilityInternal(ESlateVisibility::SelfHitTestInvisible);
|
|
}
|
|
|
|
void UOverlay::ReleaseSlateResources(bool bReleaseChildren)
|
|
{
|
|
Super::ReleaseSlateResources(bReleaseChildren);
|
|
|
|
MyOverlay.Reset();
|
|
}
|
|
|
|
UOverlaySlot* UOverlay::AddChildToOverlay(UWidget* Content)
|
|
{
|
|
return Cast<UOverlaySlot>(Super::AddChild(Content));
|
|
}
|
|
|
|
UClass* UOverlay::GetSlotClass() const
|
|
{
|
|
return UOverlaySlot::StaticClass();
|
|
}
|
|
|
|
void UOverlay::OnSlotAdded(UPanelSlot* InSlot)
|
|
{
|
|
// Add the child to the live canvas if it already exists
|
|
if ( MyOverlay.IsValid() )
|
|
{
|
|
CastChecked<UOverlaySlot>(InSlot)->BuildSlot(MyOverlay.ToSharedRef());
|
|
}
|
|
}
|
|
|
|
void UOverlay::OnSlotRemoved(UPanelSlot* InSlot)
|
|
{
|
|
// Remove the widget from the live slot if it exists.
|
|
if ( MyOverlay.IsValid() && InSlot->Content)
|
|
{
|
|
TSharedPtr<SWidget> Widget = InSlot->Content->GetCachedWidget();
|
|
if ( Widget.IsValid() )
|
|
{
|
|
MyOverlay->RemoveSlot(Widget.ToSharedRef());
|
|
}
|
|
}
|
|
}
|
|
|
|
TSharedRef<SWidget> UOverlay::RebuildWidget()
|
|
{
|
|
MyOverlay = SNew(SOverlay);
|
|
|
|
for ( UPanelSlot* PanelSlot : Slots )
|
|
{
|
|
if ( UOverlaySlot* TypedSlot = Cast<UOverlaySlot>(PanelSlot) )
|
|
{
|
|
TypedSlot->Parent = this;
|
|
TypedSlot->BuildSlot(MyOverlay.ToSharedRef());
|
|
}
|
|
}
|
|
|
|
return MyOverlay.ToSharedRef();
|
|
}
|
|
|
|
#if WITH_EDITOR
|
|
|
|
const FText UOverlay::GetPaletteCategory()
|
|
{
|
|
return LOCTEXT("Panel", "Panel");
|
|
}
|
|
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
#undef LOCTEXT_NAMESPACE
|