// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved. /*============================================================================= DeviceManagerModule.cpp: Implements the FDeviceManagerModule class. =============================================================================*/ #include "DeviceManagerPrivatePCH.h" static const FName DeviceManagerTabName("DeviceManager"); /** * Implements the DeviceManager module. */ class FDeviceManagerModule : public IDeviceManagerModule { public: // Begin IModuleInterface interface virtual void StartupModule( ) OVERRIDE { // @todo gmp: implement an IoC container ITargetDeviceServicesModule& TargetDeviceServicesModule = FModuleManager::LoadModuleChecked(TEXT("TargetDeviceServices")); TargetDeviceServiceManager = TargetDeviceServicesModule.GetDeviceServiceManager(); FGlobalTabmanager::Get()->RegisterTabSpawner(DeviceManagerTabName, FOnSpawnTab::CreateRaw(this, &FDeviceManagerModule::SpawnDeviceManagerTab)) .SetDisplayName(NSLOCTEXT("FDeviceManagerModule", "DeviceManagerTabTitle", "Device Manager")) .SetTooltipText(NSLOCTEXT("FDeviceManagerModule", "DeviceManagerTooltipText", "Open the Device Manager tab.")) .SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "DeviceDetails.TabIcon")); } virtual void ShutdownModule( ) OVERRIDE { FGlobalTabmanager::Get()->UnregisterTabSpawner(DeviceManagerTabName); } // End IModuleInterface interface public: // Begin IDeviceManagerModule interface virtual TSharedRef CreateDeviceManager( const ITargetDeviceServiceManagerRef& DeviceServiceManager, const TSharedRef& ConstructUnderMajorTab, const TSharedPtr& ConstructUnderWindow ) OVERRIDE { return SNew(SDeviceManager, DeviceServiceManager, ConstructUnderMajorTab, ConstructUnderWindow); } // End IDeviceManagerModule interface private: /** * Creates a new device manager tab. * * @param SpawnTabArgs - The arguments for the tab to spawn. * * @return The spawned tab. */ TSharedRef SpawnDeviceManagerTab( const FSpawnTabArgs& SpawnTabArgs ) { const TSharedRef DockTab = SNew(SDockTab) .TabRole(ETabRole::MajorTab); DockTab->SetContent(CreateDeviceManager(TargetDeviceServiceManager.ToSharedRef(), DockTab, SpawnTabArgs.GetOwnerWindow())); return DockTab; } private: // @todo gmp: implement an IoC container ITargetDeviceServiceManagerPtr TargetDeviceServiceManager; }; IMPLEMENT_MODULE(FDeviceManagerModule, DeviceManager);