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.8 KiB
C++
85 lines
1.8 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Components/VerticalBox.h"
|
|
#include "Components/VerticalBoxSlot.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "UMG"
|
|
|
|
/////////////////////////////////////////////////////
|
|
// UVerticalBox
|
|
|
|
UVerticalBox::UVerticalBox(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
bIsVariable = false;
|
|
SetVisibilityInternal(ESlateVisibility::SelfHitTestInvisible);
|
|
}
|
|
|
|
void UVerticalBox::ReleaseSlateResources(bool bReleaseChildren)
|
|
{
|
|
Super::ReleaseSlateResources(bReleaseChildren);
|
|
|
|
MyVerticalBox.Reset();
|
|
}
|
|
|
|
UClass* UVerticalBox::GetSlotClass() const
|
|
{
|
|
return UVerticalBoxSlot::StaticClass();
|
|
}
|
|
|
|
void UVerticalBox::OnSlotAdded(UPanelSlot* InSlot)
|
|
{
|
|
// Add the child to the live canvas if it already exists
|
|
if ( MyVerticalBox.IsValid() )
|
|
{
|
|
CastChecked<UVerticalBoxSlot>(InSlot)->BuildSlot(MyVerticalBox.ToSharedRef());
|
|
}
|
|
}
|
|
|
|
void UVerticalBox::OnSlotRemoved(UPanelSlot* InSlot)
|
|
{
|
|
// Remove the widget from the live slot if it exists.
|
|
if ( MyVerticalBox.IsValid() && InSlot->Content)
|
|
{
|
|
TSharedPtr<SWidget> Widget = InSlot->Content->GetCachedWidget();
|
|
if ( Widget.IsValid() )
|
|
{
|
|
MyVerticalBox->RemoveSlot(Widget.ToSharedRef());
|
|
}
|
|
}
|
|
}
|
|
|
|
UVerticalBoxSlot* UVerticalBox::AddChildToVerticalBox(UWidget* Content)
|
|
{
|
|
return Cast<UVerticalBoxSlot>(Super::AddChild(Content));
|
|
}
|
|
|
|
TSharedRef<SWidget> UVerticalBox::RebuildWidget()
|
|
{
|
|
MyVerticalBox = SNew(SVerticalBox);
|
|
|
|
for ( UPanelSlot* PanelSlot : Slots )
|
|
{
|
|
if ( UVerticalBoxSlot* TypedSlot = Cast<UVerticalBoxSlot>(PanelSlot) )
|
|
{
|
|
TypedSlot->Parent = this;
|
|
TypedSlot->BuildSlot(MyVerticalBox.ToSharedRef());
|
|
}
|
|
}
|
|
|
|
return MyVerticalBox.ToSharedRef();
|
|
}
|
|
|
|
#if WITH_EDITOR
|
|
|
|
const FText UVerticalBox::GetPaletteCategory()
|
|
{
|
|
return LOCTEXT("Panel", "Panel");
|
|
}
|
|
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
#undef LOCTEXT_NAMESPACE
|