2014-03-14 14:13:41 -04:00
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
# include "ModuleManager.h"
# include "WorkspaceMenuStructureModule.h"
# include "WorkspaceMenuStructure.h"
# include "Slate.h"
# include "EditorStyle.h"
IMPLEMENT_MODULE ( FWorkspaceMenuStructureModule , WorkspaceMenuStructure ) ;
# define LOCTEXT_NAMESPACE "UnrealEditor"
class FWorkspaceMenuStructure : public IWorkspaceMenuStructure
{
public :
2014-06-13 06:14:46 -04:00
virtual TSharedRef < FWorkspaceItem > GetStructureRoot ( ) const override
2014-03-14 14:13:41 -04:00
{
return MenuRoot . ToSharedRef ( ) ;
}
2014-06-13 06:14:46 -04:00
virtual TSharedRef < FWorkspaceItem > GetLevelEditorCategory ( ) const override
2014-03-14 14:13:41 -04:00
{
return LevelEditorCategory . ToSharedRef ( ) ;
}
2014-06-13 06:14:46 -04:00
virtual TSharedRef < FWorkspaceItem > GetLevelEditorViewportsCategory ( ) const override
2014-03-14 14:13:41 -04:00
{
return LevelEditorViewportsCategory . ToSharedRef ( ) ;
}
2014-06-13 06:14:46 -04:00
virtual TSharedRef < FWorkspaceItem > GetLevelEditorDetailsCategory ( ) const override
2014-03-14 14:13:41 -04:00
{
return LevelEditorDetailsCategory . ToSharedRef ( ) ;
}
2014-06-13 06:14:46 -04:00
virtual TSharedRef < FWorkspaceItem > GetLevelEditorModesCategory ( ) const override
2014-03-14 14:13:41 -04:00
{
return LevelEditorModesCategory . ToSharedRef ( ) ;
}
2014-06-13 06:14:46 -04:00
virtual TSharedRef < FWorkspaceItem > GetToolsCategory ( ) const override
2014-03-14 14:13:41 -04:00
{
return ToolsCategory . ToSharedRef ( ) ;
}
2014-10-09 12:34:55 -04:00
virtual TSharedRef < FWorkspaceItem > GetDeveloperToolsDebugCategory ( ) const override
2014-03-14 14:13:41 -04:00
{
2014-10-09 12:34:55 -04:00
return DeveloperToolsDebugCategory . ToSharedRef ( ) ;
}
virtual TSharedRef < FWorkspaceItem > GetDeveloperToolsLogCategory ( ) const override
{
return DeveloperToolsLogCategory . ToSharedRef ( ) ;
}
virtual TSharedRef < FWorkspaceItem > GetDeveloperToolsMiscCategory ( ) const override
{
return DeveloperToolsMiscCategory . ToSharedRef ( ) ;
2014-03-14 14:13:41 -04:00
}
2014-06-13 06:14:46 -04:00
virtual TSharedRef < FWorkspaceItem > GetEditOptions ( ) const override
2014-03-14 14:13:41 -04:00
{
return EditOptions . ToSharedRef ( ) ;
}
void ResetLevelEditorCategory ( )
{
LevelEditorCategory - > ClearItems ( ) ;
LevelEditorViewportsCategory = LevelEditorCategory - > AddGroup ( LOCTEXT ( " WorkspaceMenu_LevelEditorViewportCategory " , " Viewports " ) , LOCTEXT ( " WorkspaceMenu_LevelEditorViewportCategoryTooltip " , " Open a Viewport tab. " ) , FSlateIcon ( FEditorStyle : : GetStyleSetName ( ) , " LevelEditor.Tabs.Viewports " ) , true ) ;
LevelEditorDetailsCategory = LevelEditorCategory - > AddGroup ( LOCTEXT ( " WorkspaceMenu_LevelEditorDetailCategory " , " Details " ) , LOCTEXT ( " WorkspaceMenu_LevelEditorDetailCategoryTooltip " , " Open a Details tab. " ) , FSlateIcon ( FEditorStyle : : GetStyleSetName ( ) , " LevelEditor.Tabs.Details " ) , true ) ;
LevelEditorModesCategory = LevelEditorCategory - > AddGroup ( LOCTEXT ( " WorkspaceMenu_LevelEditorToolsCategory " , " Tools " ) , FSlateIcon ( FEditorStyle : : GetStyleSetName ( ) , " LevelEditor.Tabs.EditorModes " ) , true ) ;
}
void ResetToolsCategory ( )
{
ToolsCategory - > ClearItems ( ) ;
2014-10-09 12:34:55 -04:00
// Developer tools sub menu
DeveloperToolsCategory = ToolsCategory - > AddGroup ( LOCTEXT ( " WorkspaceMenu_DeveloperToolsCategory " , " Developer Tools " ) , FSlateIcon ( FEditorStyle : : GetStyleSetName ( ) , " DeveloperTools.MenuIcon " ) ) ;
// Developer tools sections
DeveloperToolsDebugCategory = DeveloperToolsCategory - > AddGroup ( LOCTEXT ( " WorkspaceMenu_DeveloperToolsDebugCategory " , " Debug " ) , FSlateIcon ( ) , true ) ;
DeveloperToolsLogCategory = DeveloperToolsCategory - > AddGroup ( LOCTEXT ( " WorkspaceMenu_DeveloperToolsLogCategory " , " Log " ) , FSlateIcon ( ) , true ) ;
DeveloperToolsMiscCategory = DeveloperToolsCategory - > AddGroup ( LOCTEXT ( " WorkspaceMenu_DeveloperToolsMiscCategory " , " Miscellaneous " ) , FSlateIcon ( ) , true ) ;
2014-03-14 14:13:41 -04:00
}
public :
FWorkspaceMenuStructure ( )
: MenuRoot ( FWorkspaceItem : : NewGroup ( LOCTEXT ( " WorkspaceMenu_Root " , " Menu Root " ) ) )
2014-10-09 12:34:55 -04:00
, LevelEditorCategory ( MenuRoot - > AddGroup ( LOCTEXT ( " WorkspaceMenu_LevelEditorCategory " , " Level Editor " ) , FSlateIcon ( ) , true ) )
, ToolsCategory ( MenuRoot - > AddGroup ( LOCTEXT ( " WorkspaceMenu_ToolsCategory " , " General " ) , FSlateIcon ( ) , true ) )
, EditOptions ( FWorkspaceItem : : NewGroup ( LOCTEXT ( " WorkspaceEdit_Options " , " Edit Options " ) ) )
2014-03-14 14:13:41 -04:00
{
ResetLevelEditorCategory ( ) ;
ResetToolsCategory ( ) ;
}
2014-07-30 14:51:27 -04:00
virtual ~ FWorkspaceMenuStructure ( ) { }
2014-03-14 14:13:41 -04:00
private :
TSharedPtr < FWorkspaceItem > MenuRoot ;
2014-10-09 12:34:55 -04:00
2014-03-14 14:13:41 -04:00
TSharedPtr < FWorkspaceItem > LevelEditorCategory ;
TSharedPtr < FWorkspaceItem > LevelEditorViewportsCategory ;
TSharedPtr < FWorkspaceItem > LevelEditorDetailsCategory ;
TSharedPtr < FWorkspaceItem > LevelEditorModesCategory ;
2014-10-09 12:34:55 -04:00
2014-03-14 14:13:41 -04:00
TSharedPtr < FWorkspaceItem > ToolsCategory ;
TSharedPtr < FWorkspaceItem > DeveloperToolsCategory ;
2014-10-09 12:34:55 -04:00
TSharedPtr < FWorkspaceItem > DeveloperToolsDebugCategory ;
TSharedPtr < FWorkspaceItem > DeveloperToolsLogCategory ;
TSharedPtr < FWorkspaceItem > DeveloperToolsMiscCategory ;
2014-03-14 14:13:41 -04:00
TSharedPtr < FWorkspaceItem > EditOptions ;
} ;
void FWorkspaceMenuStructureModule : : StartupModule ( )
{
WorkspaceMenuStructure = MakeShareable ( new FWorkspaceMenuStructure ) ;
}
void FWorkspaceMenuStructureModule : : ShutdownModule ( )
{
WorkspaceMenuStructure . Reset ( ) ;
}
const IWorkspaceMenuStructure & FWorkspaceMenuStructureModule : : GetWorkspaceMenuStructure ( ) const
{
check ( WorkspaceMenuStructure . IsValid ( ) ) ;
return * WorkspaceMenuStructure ;
}
void FWorkspaceMenuStructureModule : : ResetLevelEditorCategory ( )
{
check ( WorkspaceMenuStructure . IsValid ( ) ) ;
WorkspaceMenuStructure - > ResetLevelEditorCategory ( ) ;
}
void FWorkspaceMenuStructureModule : : ResetToolsCategory ( )
{
check ( WorkspaceMenuStructure . IsValid ( ) ) ;
WorkspaceMenuStructure - > ResetToolsCategory ( ) ;
}
# undef LOCTEXT_NAMESPACE