Files
UnrealEngineUWP/Engine/Source/Editor/ClassViewer/Private/ClassViewerModule.cpp

64 lines
2.1 KiB
C++
Raw Normal View History

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "ClassViewerPrivatePCH.h"
#include "Editor/ClassViewer/Private/SClassViewer.h"
#include "Editor/WorkspaceMenuStructure/Public/WorkspaceMenuStructureModule.h"
#include "ModuleManager.h"
#include "SDockTab.h"
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") )
Window menu refactor & polish - Window menu is now sectioned and labeled based on the current editor. There's now a local workspace root member in FTabManager and a workspace category in FAssetEditorToolkit (both are FWorkspaceItem objects). Individual editors attach their local category to the tab manager's local root. Workflow app modes have their own category members that are swapped out when the mode changes. - Finally, the AssetEditorCategory of FWorkspaceMenuStructure has been removed entirely. - Replaced the AddMenuSeparator() call in FTabManager::PopulateSpawnerMenu_Helper() with a section of the same title as the workspace category. - Tab spawner menu entries for the local editor now properly show the icon of the associated tab. To accomplish this it was necessary to change FWorkflowTabFactory::TabIcon to be an FSlateIcon instead of an FSlateBrush*. All factory instances have been updated accordingly. - Added & updated lots of icons! (those missing will be TTP'd) - The nomad tab spawner section (named "General" in the menu) has been largely compressed into the Developer Tools submenu, which has also been organized into sections for readability. - Unreal frontend options were also moved into a context menu within the General section - Moved all experimental tools to their own section of the Window menu. When they're no longer experimental they should register as nomads in the appropriate category - Undo history now under Edit menu [CL 2324285 by Dan Hertzka in Main branch]
2014-10-09 12:34:55 -04:00
.SetTooltipText( NSLOCTEXT("ClassViewerApp", "TooltipText", "Displays all classes that exist within this project.") )
.SetGroup( WorkspaceMenu::GetMenuStructure().GetDeveloperToolsMiscCategory() )
.SetIcon( FSlateIcon(FEditorStyle::GetStyleSetName(), "ClassViewer.TabIcon") );
}
void FClassViewerModule::ShutdownModule()
{
if (FSlateApplication::IsInitialized())
{
FGlobalTabmanager::Get()->UnregisterNomadTabSpawner( ClassViewerModule::ClassViewerApp );
}
SClassViewer::DestroyClassHierarchy();
}
/**
* 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);
}