Files
UnrealEngineUWP/Engine/Source/Runtime/SlateCore/Private/SlotBase.cpp
Nick Atamas badf62c330 Slate slots now use a common base class, which has a private '.Widget' member; use GetWidget() instead.
Slate TPanelChildren, TSlotlessChildren are no longer full-fledged arrays; removed any unused Array API.
Fixed up a lot of improper use cases.

This better encapsulates the action of adding/removing Slate Widgets from the runtime tree as a Slate Core concern.
Alows us to add parent pointers in the future with significantly less effort.

#codereview Wes.Hunt
#codereview Nick.Darnell
#codereview Matt.Kuhlendschmidt
#codereview Justin.Sargent

[CL 2234301 by Nick Atamas in Main branch]
2014-07-28 06:53:40 -04:00

45 lines
725 B
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "SlateCorePrivatePCH.h"
FSlotBase::FSlotBase()
: Widget( SNullWidget::NullWidget )
{
}
FSlotBase::FSlotBase( const TSharedRef<SWidget>& InWidget )
: Widget( InWidget )
{
}
void FSlotBase::AttachWidget( const TSharedRef<SWidget>& InWidget )
{
Widget = InWidget;
}
const TSharedRef<SWidget>& FSlotBase::GetWidget() const
{
return Widget;
}
const TSharedPtr<SWidget> FSlotBase::DetachWidget()
{
if (Widget != SNullWidget::NullWidget)
{
const TSharedRef<SWidget> MyExWidget = Widget;
Widget = SNullWidget::NullWidget;
return MyExWidget;
}
else
{
// Nothing to detach!
return TSharedPtr<SWidget>();
}
}
FSlotBase::~FSlotBase()
{
}