2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#include "ClassViewerPrivatePCH.h"
|
|
|
|
|
#include "Editor/ClassViewer/Private/SClassViewer.h"
|
|
|
|
|
#include "Editor/WorkspaceMenuStructure/Public/WorkspaceMenuStructureModule.h"
|
|
|
|
|
|
|
|
|
|
#include "ModuleManager.h"
|
2014-10-14 22:50:06 -04:00
|
|
|
#include "SDockTab.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
IMPLEMENT_MODULE( FClassViewerModule, ClassViewer );
|
|
|
|
|
|
|
|
|
|
namespace ClassViewerModule
|
|
|
|
|
{
|
|
|
|
|
static const FName ClassViewerApp = FName("ClassViewerApp");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TSharedRef<SDockTab> CreateClassPickerTab( const FSpawnTabArgs& Args )
|
|
|
|
|
{
|
|
|
|
|
FClassViewerInitializationOptions InitOptions;
|
|
|
|
|
InitOptions.Mode = EClassViewerMode::ClassBrowsing;
|
|
|
|
|
InitOptions.DisplayMode = EClassViewerDisplayMode::TreeView;
|
|
|
|
|
|
|
|
|
|
return SNew(SDockTab)
|
|
|
|
|
.TabRole( ETabRole::NomadTab )
|
|
|
|
|
[
|
|
|
|
|
SNew( SClassViewer, InitOptions )
|
|
|
|
|
.OnClassPickedDelegate(FOnClassPicked())
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FClassViewerModule::StartupModule()
|
|
|
|
|
{
|
|
|
|
|
FGlobalTabmanager::Get()->RegisterNomadTabSpawner( ClassViewerModule::ClassViewerApp, FOnSpawnTab::CreateStatic( &CreateClassPickerTab ) )
|
|
|
|
|
.SetDisplayName( NSLOCTEXT("ClassViewerApp", "TabTitle", "Class Viewer") )
|
2014-10-09 12:34:55 -04:00
|
|
|
.SetTooltipText( NSLOCTEXT("ClassViewerApp", "TooltipText", "Displays all classes that exist within this project.") )
|
|
|
|
|
.SetGroup( WorkspaceMenu::GetMenuStructure().GetDeveloperToolsMiscCategory() )
|
2014-03-14 14:13:41 -04:00
|
|
|
.SetIcon( FSlateIcon(FEditorStyle::GetStyleSetName(), "ClassViewer.TabIcon") );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FClassViewerModule::ShutdownModule()
|
|
|
|
|
{
|
|
|
|
|
if (FSlateApplication::IsInitialized())
|
|
|
|
|
{
|
|
|
|
|
FGlobalTabmanager::Get()->UnregisterNomadTabSpawner( ClassViewerModule::ClassViewerApp );
|
|
|
|
|
}
|
2015-01-22 13:40:27 -05:00
|
|
|
|
|
|
|
|
SClassViewer::DestroyClassHierarchy();
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a class viewer widget
|
|
|
|
|
*
|
|
|
|
|
* @param InitOptions Programmer-driven configuration for this widget instance
|
|
|
|
|
* @param OnClassPickedDelegate Optional callback when a class is selected in 'class picking' mode
|
|
|
|
|
*
|
|
|
|
|
* @return New class viewer widget
|
|
|
|
|
*/
|
|
|
|
|
TSharedRef<SWidget> FClassViewerModule::CreateClassViewer(const FClassViewerInitializationOptions& InitOptions, const FOnClassPicked& OnClassPickedDelegate )
|
|
|
|
|
{
|
|
|
|
|
return SNew( SClassViewer, InitOptions )
|
|
|
|
|
.OnClassPickedDelegate(OnClassPickedDelegate);
|
|
|
|
|
}
|