Files
UnrealEngineUWP/Engine/Source/Runtime/UMG/Private/Components/BackgroundBlurSlot.cpp
ryan durand 0f0464a30e Updating copyright for Engine Runtime.
#rnx
#rb none


#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870549 by ryan durand in Main branch]
2019-12-26 14:45:42 -05:00

105 lines
2.8 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "Components/BackgroundBlurSlot.h"
#include "ObjectEditorUtils.h"
#include "Widgets/Layout/SBackgroundBlur.h"
#include "Components/BackgroundBlur.h"
/////////////////////////////////////////////////////
// UBackgroundBlurSlot
UBackgroundBlurSlot::UBackgroundBlurSlot(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
Padding = FMargin(4, 2);
HorizontalAlignment = HAlign_Fill;
VerticalAlignment = VAlign_Fill;
}
void UBackgroundBlurSlot::ReleaseSlateResources(bool bReleaseChildren)
{
Super::ReleaseSlateResources(bReleaseChildren);
BackgroundBlur.Reset();
}
void UBackgroundBlurSlot::BuildSlot(TSharedRef<SBackgroundBlur> InBackgroundBlur)
{
BackgroundBlur = InBackgroundBlur;
BackgroundBlur->SetPadding(Padding);
BackgroundBlur->SetHAlign(HorizontalAlignment);
BackgroundBlur->SetVAlign(VerticalAlignment);
BackgroundBlur->SetContent(Content ? Content->TakeWidget() : SNullWidget::NullWidget);
}
void UBackgroundBlurSlot::SetPadding(FMargin InPadding)
{
CastChecked<UBackgroundBlur>(Parent)->SetPadding(InPadding);
}
void UBackgroundBlurSlot::SetHorizontalAlignment(EHorizontalAlignment InHorizontalAlignment)
{
CastChecked<UBackgroundBlur>(Parent)->SetHorizontalAlignment(InHorizontalAlignment);
}
void UBackgroundBlurSlot::SetVerticalAlignment(EVerticalAlignment InVerticalAlignment)
{
CastChecked<UBackgroundBlur>(Parent)->SetVerticalAlignment(InVerticalAlignment);
}
void UBackgroundBlurSlot::SynchronizeProperties()
{
if ( BackgroundBlur.IsValid() )
{
SetPadding(Padding);
SetHorizontalAlignment(HorizontalAlignment);
SetVerticalAlignment(VerticalAlignment);
}
}
#if WITH_EDITOR
void UBackgroundBlurSlot::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
Super::PostEditChangeProperty(PropertyChangedEvent);
static bool IsReentrant = false;
if ( !IsReentrant )
{
IsReentrant = true;
if ( PropertyChangedEvent.Property )
{
static const FName PaddingName("Padding");
static const FName HorizontalAlignmentName("HorizontalAlignment");
static const FName VerticalAlignmentName("VerticalAlignment");
FName PropertyName = PropertyChangedEvent.Property->GetFName();
if ( UBackgroundBlur* ParentBackgroundBlur = CastChecked<UBackgroundBlur>(Parent) )
{
if (PropertyName == PaddingName)
{
FObjectEditorUtils::MigratePropertyValue(this, PaddingName, ParentBackgroundBlur, PaddingName);
}
else if (PropertyName == HorizontalAlignmentName)
{
FObjectEditorUtils::MigratePropertyValue(this, HorizontalAlignmentName, ParentBackgroundBlur, HorizontalAlignmentName);
}
else if (PropertyName == VerticalAlignmentName)
{
FObjectEditorUtils::MigratePropertyValue(this, VerticalAlignmentName, ParentBackgroundBlur, VerticalAlignmentName);
}
}
}
IsReentrant = false;
}
}
#endif