Polyphase Game Engine
Loading...
Searching...
No Matches
ThemeModule.h
Go to the documentation of this file.
1#pragma once
2
3#if EDITOR
4
5#include "../../PreferencesModule.h"
6#include "EditorTheme.h"
7#include <string>
8
9class ThemeModule : public PreferencesModule
10{
11public:
12 DECLARE_PREFERENCES_MODULE(ThemeModule)
13
14 ThemeModule();
15 virtual ~ThemeModule();
16
17 virtual const char* GetName() const override { return GetStaticName(); }
18 virtual const char* GetParentPath() const override { return GetStaticParentPath(); }
19 virtual void Render() override;
20 virtual void LoadSettings(const rapidjson::Document& doc) override;
21 virtual void SaveSettings(rapidjson::Document& doc) override;
22
23 // Settings accessors
24 EditorThemeType GetCurrentTheme() const { return mCurrentTheme; }
25 const std::string& GetCurrentFont() const { return mCurrentFont; }
26 static std::string LoadSavedFontPreference();
27
28 // Icon fonts (e.g. PolyphaseEngineIcons.ttf) only contain icon glyphs, so
29 // using one as the editor font renders every label as boxes.
30 static bool IsIconFont(const std::string& fontName);
31
32 std::string mCurrentFont = "Default";
33
34private:
35 EditorThemeType mCurrentTheme = EditorThemeType::Dark;
36 int mSelectedThemeIndex = 0;
37
38 int mSelectedFontIndex = 0;
39 std::vector<std::string> mAvailableFonts;
40
41 // Custom theme import
42 char mNewThemeName[64] = {};
43 bool mShowImportDialog = false;
44 std::string mPendingImportPath;
45
46 void RefreshAvailableFonts();
47 void LoadFont();
48 static std::string GetSettingsFilePathStatic();
49};
50
51#endif
Definition JsonHelpers.h:15