2014-07-31 10:49:08 -04:00
|
|
|
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "UMGPrivatePCH.h"
|
|
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "UMG"
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
// UScaleBox
|
|
|
|
|
|
|
|
|
|
UScaleBox::UScaleBox(const FPostConstructInitializeProperties& PCIP)
|
|
|
|
|
: Super(PCIP)
|
|
|
|
|
{
|
|
|
|
|
bIsVariable = false;
|
|
|
|
|
|
|
|
|
|
StretchDirection = EStretchDirection::Both;
|
|
|
|
|
Stretch = EStretch::ScaleToFit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UScaleBox::ReleaseNativeWidget()
|
|
|
|
|
{
|
|
|
|
|
Super::ReleaseNativeWidget();
|
|
|
|
|
|
|
|
|
|
MyScaleBox.Reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TSharedRef<SWidget> UScaleBox::RebuildWidget()
|
|
|
|
|
{
|
|
|
|
|
MyScaleBox = SNew(SScaleBox);
|
|
|
|
|
|
|
|
|
|
if ( GetChildrenCount() > 0 )
|
|
|
|
|
{
|
|
|
|
|
Cast<UScaleBoxSlot>(GetContentSlot())->BuildSlot(MyScaleBox.ToSharedRef());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return MyScaleBox.ToSharedRef();
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-13 17:04:49 -04:00
|
|
|
void UScaleBox::SynchronizeProperties()
|
2014-07-31 10:49:08 -04:00
|
|
|
{
|
2014-08-13 17:04:49 -04:00
|
|
|
Super::SynchronizeProperties();
|
2014-07-31 10:49:08 -04:00
|
|
|
|
|
|
|
|
MyScaleBox->SetStretchDirection(StretchDirection);
|
|
|
|
|
MyScaleBox->SetStretch(Stretch);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UClass* UScaleBox::GetSlotClass() const
|
|
|
|
|
{
|
|
|
|
|
return UScaleBoxSlot::StaticClass();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UScaleBox::OnSlotAdded(UPanelSlot* Slot)
|
|
|
|
|
{
|
|
|
|
|
// Add the child to the live slot if it already exists
|
|
|
|
|
if ( MyScaleBox.IsValid() )
|
|
|
|
|
{
|
|
|
|
|
Cast<UScaleBoxSlot>(Slot)->BuildSlot(MyScaleBox.ToSharedRef());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UScaleBox::OnSlotRemoved(UPanelSlot* Slot)
|
|
|
|
|
{
|
|
|
|
|
// Remove the widget from the live slot if it exists.
|
|
|
|
|
if ( MyScaleBox.IsValid() )
|
|
|
|
|
{
|
|
|
|
|
MyScaleBox->SetContent(SNullWidget::NullWidget);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if WITH_EDITOR
|
|
|
|
|
|
|
|
|
|
const FSlateBrush* UScaleBox::GetEditorIcon()
|
|
|
|
|
{
|
|
|
|
|
return FUMGStyle::Get().GetBrush("Widget.ScaleBox");
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-15 11:21:09 -04:00
|
|
|
const FText UScaleBox::GetPaletteCategory()
|
2014-09-03 12:32:27 -04:00
|
|
|
{
|
|
|
|
|
return LOCTEXT("Panel", "Panel");
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-31 10:49:08 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|