Files
UnrealEngineUWP/Engine/Source/Editor/EditorStyle/Private/EditorStyleModule.cpp
Matt Kuhlenschmidt f594e50cd2 Added basic theme editing support and a Dark theme as an example.
Themes are basic json files which can change the named colors that the editor uses for its UI.  They work similarly to config files in that the same theme in a user dir overrides the project dir and the base dir.
Themes only work in the editor or standalone programs. Not supported in UMG or shipping games

[CL 14179270 by Matt Kuhlenschmidt in ue5-main branch]
2020-08-25 10:31:42 -04:00

65 lines
1.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"
#include "Interfaces/IEditorStyleModule.h"
#include "SlateEditorStyle.h"
#include "StarshipStyle.h"
#include "Styling/CoreStyle.h"
#include "Styling/StyleColors.h"
/**
* Implements the Editor style module, loaded by SlateApplication dynamically at startup.
*/
class FEditorStyleModule
: public IEditorStyleModule
{
public:
// IEditorStyleModule interface
virtual void StartupModule( ) override
{
if (FCoreStyle::IsStarshipStyle())
{
#if ALLOW_THEMES
USlateThemeManager::Get().ValidateActiveTheme();
#endif
bUsingStarshipStyle = true;
FStarshipEditorStyle::Initialize();
// set the application style to be the editor style
FAppStyle::SetAppStyleSetName(FStarshipEditorStyle::GetStyleSetName());
}
else
{
FSlateEditorStyle::Initialize();
// set the application style to be the editor style
FAppStyle::SetAppStyleSetName(FEditorStyle::GetStyleSetName());
}
}
virtual void ShutdownModule( ) override
{
if (bUsingStarshipStyle)
{
FStarshipEditorStyle::Shutdown();
}
else
{
FSlateEditorStyle::Shutdown();
}
}
// End IModuleInterface interface
private:
bool bUsingStarshipStyle = false;
};
IMPLEMENT_MODULE(FEditorStyleModule, EditorStyle)