2014-05-22 09:13:35 -04:00
|
|
|
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "UMGPrivatePCH.h"
|
|
|
|
|
|
2014-07-08 15:25:09 -04:00
|
|
|
#define LOCTEXT_NAMESPACE "UMG"
|
|
|
|
|
|
2014-05-22 09:13:35 -04:00
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
// UUniformGridPanel
|
|
|
|
|
|
|
|
|
|
UUniformGridPanel::UUniformGridPanel(const FPostConstructInitializeProperties& PCIP)
|
|
|
|
|
: Super(PCIP)
|
|
|
|
|
{
|
|
|
|
|
bIsVariable = false;
|
2014-06-30 18:18:16 -04:00
|
|
|
|
|
|
|
|
SUniformGridPanel::FArguments Defaults;
|
|
|
|
|
Visiblity = UWidget::ConvertRuntimeToSerializedVisiblity(Defaults._Visibility.Get());
|
2014-05-22 09:13:35 -04:00
|
|
|
}
|
|
|
|
|
|
2014-09-22 15:09:37 -04:00
|
|
|
void UUniformGridPanel::ReleaseSlateResources(bool bReleaseChildren)
|
2014-07-18 16:14:03 -04:00
|
|
|
{
|
2014-09-22 15:09:37 -04:00
|
|
|
Super::ReleaseSlateResources(bReleaseChildren);
|
2014-07-18 16:14:03 -04:00
|
|
|
|
|
|
|
|
MyUniformGridPanel.Reset();
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-23 18:09:49 -04:00
|
|
|
UClass* UUniformGridPanel::GetSlotClass() const
|
2014-05-22 09:13:35 -04:00
|
|
|
{
|
2014-06-23 18:09:49 -04:00
|
|
|
return UUniformGridSlot::StaticClass();
|
2014-05-22 09:13:35 -04:00
|
|
|
}
|
|
|
|
|
|
2014-06-23 18:09:49 -04:00
|
|
|
void UUniformGridPanel::OnSlotAdded(UPanelSlot* Slot)
|
2014-05-22 09:13:35 -04:00
|
|
|
{
|
2014-06-23 18:09:49 -04:00
|
|
|
// Add the child to the live canvas if it already exists
|
|
|
|
|
if ( MyUniformGridPanel.IsValid() )
|
2014-06-15 15:40:45 -04:00
|
|
|
{
|
2014-06-23 18:09:49 -04:00
|
|
|
Cast<UUniformGridSlot>(Slot)->BuildSlot(MyUniformGridPanel.ToSharedRef());
|
2014-06-15 15:40:45 -04:00
|
|
|
}
|
2014-05-22 09:13:35 -04:00
|
|
|
}
|
|
|
|
|
|
2014-06-23 18:09:49 -04:00
|
|
|
void UUniformGridPanel::OnSlotRemoved(UPanelSlot* Slot)
|
2014-05-22 09:13:35 -04:00
|
|
|
{
|
2014-06-23 18:09:49 -04:00
|
|
|
// Remove the widget from the live slot if it exists.
|
|
|
|
|
if ( MyUniformGridPanel.IsValid() )
|
2014-05-22 09:13:35 -04:00
|
|
|
{
|
2014-07-21 14:20:34 -04:00
|
|
|
TSharedPtr<SWidget> Widget = Slot->Content->GetCachedWidget();
|
|
|
|
|
if ( Widget.IsValid() )
|
|
|
|
|
{
|
|
|
|
|
MyUniformGridPanel->RemoveSlot(Widget.ToSharedRef());
|
|
|
|
|
}
|
2014-05-22 09:13:35 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TSharedRef<SWidget> UUniformGridPanel::RebuildWidget()
|
|
|
|
|
{
|
2014-06-15 15:40:45 -04:00
|
|
|
MyUniformGridPanel =
|
2014-06-01 22:35:19 -04:00
|
|
|
SNew(SUniformGridPanel)
|
|
|
|
|
.MinDesiredSlotWidth(MinDesiredSlotWidth)
|
|
|
|
|
.MinDesiredSlotHeight(MinDesiredSlotHeight);
|
2014-05-22 09:13:35 -04:00
|
|
|
|
2014-06-23 18:09:49 -04:00
|
|
|
for ( UPanelSlot* Slot : Slots )
|
2014-05-22 09:13:35 -04:00
|
|
|
{
|
2014-06-23 18:09:49 -04:00
|
|
|
if ( UUniformGridSlot* TypedSlot = Cast<UUniformGridSlot>(Slot) )
|
|
|
|
|
{
|
|
|
|
|
TypedSlot->Parent = this;
|
|
|
|
|
TypedSlot->BuildSlot(MyUniformGridPanel.ToSharedRef());
|
|
|
|
|
}
|
2014-05-22 09:13:35 -04:00
|
|
|
}
|
|
|
|
|
|
2014-06-15 15:40:45 -04:00
|
|
|
return BuildDesignTimeWidget( MyUniformGridPanel.ToSharedRef() );
|
2014-05-22 09:13:35 -04:00
|
|
|
}
|
2014-06-30 18:18:16 -04:00
|
|
|
|
2014-09-18 13:44:34 -04:00
|
|
|
UUniformGridSlot* UUniformGridPanel::AddChildToUniformGrid(UWidget* Content)
|
|
|
|
|
{
|
|
|
|
|
return Cast<UUniformGridSlot>(Super::AddChild(Content));
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-13 17:04:49 -04:00
|
|
|
void UUniformGridPanel::SynchronizeProperties()
|
2014-06-30 18:18:16 -04:00
|
|
|
{
|
2014-08-13 17:04:49 -04:00
|
|
|
Super::SynchronizeProperties();
|
2014-06-30 18:18:16 -04:00
|
|
|
|
|
|
|
|
MyUniformGridPanel->SetSlotPadding(SlotPadding);
|
|
|
|
|
}
|
2014-07-08 15:25:09 -04:00
|
|
|
|
|
|
|
|
#if WITH_EDITOR
|
|
|
|
|
|
|
|
|
|
const FSlateBrush* UUniformGridPanel::GetEditorIcon()
|
|
|
|
|
{
|
|
|
|
|
return FUMGStyle::Get().GetBrush("Widget.UniformGrid");
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-15 11:21:09 -04:00
|
|
|
const FText UUniformGridPanel::GetPaletteCategory()
|
2014-09-03 12:32:27 -04:00
|
|
|
{
|
|
|
|
|
return LOCTEXT("Panel", "Panel");
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-08 15:25:09 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|