Files
UnrealEngineUWP/Engine/Source/Editor/AddContentDialog/Private/AddContentDialogModule.cpp
Ben Marsh 7598af0532 Update copyright notices to 2019.
#rb none
#lockdown Nick.Penwarden

[CL 4662404 by Ben Marsh in Main branch]
2018-12-14 13:41:00 -05:00

62 lines
1.9 KiB
C++

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"
#include "Widgets/DeclarativeSyntaxSupport.h"
#include "Widgets/SWindow.h"
#include "Framework/Application/SlateApplication.h"
#include "IAddContentDialogModule.h"
#include "ContentSourceProviderManager.h"
#include "AddContentDialogStyle.h"
#include "SAddContentDialog.h"
#include "ContentSourceProviders/FeaturePack/FeaturePackContentSourceProvider.h"
#include "WidgetCarouselModule.h"
#include "WidgetCarouselStyle.h"
#define LOCTEXT_NAMESPACE "AddContentDialog"
class FAddContentDialogModule : public IAddContentDialogModule
{
public:
virtual void StartupModule() override
{
FModuleManager::LoadModuleChecked<FWidgetCarouselModule>("WidgetCarousel");
FWidgetCarouselModuleStyle::Initialize();
ContentSourceProviderManager = TSharedPtr<FContentSourceProviderManager>(new FContentSourceProviderManager());
ContentSourceProviderManager->RegisterContentSourceProvider(MakeShareable(new FFeaturePackContentSourceProvider()));
FAddContentDialogStyle::Initialize();
}
virtual void ShutdownModule() override
{
FAddContentDialogStyle::Shutdown();
FWidgetCarouselModuleStyle::Shutdown();
}
virtual TSharedRef<FContentSourceProviderManager> GetContentSourceProviderManager() override
{
return ContentSourceProviderManager.ToSharedRef();
}
virtual void ShowDialog(TSharedRef<SWindow> ParentWindow) override
{
if (AddContentDialog.IsValid() == false)
{
TSharedRef<SWindow> Dialog = SNew(SAddContentDialog);
FSlateApplication::Get().AddWindowAsNativeChild(Dialog, ParentWindow);
AddContentDialog = TWeakPtr<SWindow>(Dialog);
}
}
private:
TSharedPtr<FContentSourceProviderManager> ContentSourceProviderManager;
TWeakPtr<SWindow> AddContentDialog;
};
IMPLEMENT_MODULE(FAddContentDialogModule, AddContentDialog);
#undef LOCTEXT_NAMESPACE