Files
UnrealEngineUWP/Engine/Source/Runtime/UMG/Private/Components/VerticalBoxSlot.cpp
Ben Marsh 20bf0eb6a1 Updating copyright notices to 2017 (copying from //Tasks/UE4/Dev-Copyright-2017).
#rb none
#lockdown Nick.Penwarden

[CL 3226823 by Ben Marsh in Main branch]
2016-12-08 08:52:44 -05:00

81 lines
1.8 KiB
C++

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "Components/VerticalBoxSlot.h"
#include "Components/Widget.h"
/////////////////////////////////////////////////////
// UVerticalBoxSlot
UVerticalBoxSlot::UVerticalBoxSlot(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
, Slot(NULL)
{
HorizontalAlignment = HAlign_Fill;
VerticalAlignment = VAlign_Fill;
Size = FSlateChildSize(ESlateSizeRule::Automatic);
}
void UVerticalBoxSlot::ReleaseSlateResources(bool bReleaseChildren)
{
Super::ReleaseSlateResources(bReleaseChildren);
Slot = NULL;
}
void UVerticalBoxSlot::BuildSlot(TSharedRef<SVerticalBox> VerticalBox)
{
Slot = &VerticalBox->AddSlot()
.Padding(Padding)
.HAlign(HorizontalAlignment)
.VAlign(VerticalAlignment)
[
Content == NULL ? SNullWidget::NullWidget : Content->TakeWidget()
];
Slot->SizeParam = UWidget::ConvertSerializedSizeParamToRuntime(Size);
}
void UVerticalBoxSlot::SetPadding(FMargin InPadding)
{
Padding = InPadding;
if ( Slot )
{
Slot->Padding(InPadding);
}
}
void UVerticalBoxSlot::SetSize(FSlateChildSize InSize)
{
Size = InSize;
if ( Slot )
{
Slot->SizeParam = UWidget::ConvertSerializedSizeParamToRuntime(InSize);
}
}
void UVerticalBoxSlot::SetHorizontalAlignment(EHorizontalAlignment InHorizontalAlignment)
{
HorizontalAlignment = InHorizontalAlignment;
if ( Slot )
{
Slot->HAlign(InHorizontalAlignment);
}
}
void UVerticalBoxSlot::SetVerticalAlignment(EVerticalAlignment InVerticalAlignment)
{
VerticalAlignment = InVerticalAlignment;
if ( Slot )
{
Slot->VAlign(InVerticalAlignment);
}
}
void UVerticalBoxSlot::SynchronizeProperties()
{
SetPadding(Padding);
SetSize(Size);
SetHorizontalAlignment(HorizontalAlignment);
SetVerticalAlignment(VerticalAlignment);
}