Elaztek Developer Hub
Blamite Game Engine - Keystone  00369.02.19.23.2014.blamite
A library that enables the use of Qt in Blamite's editing tools.
themes.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 #include <map>
6 #include <Strings/components/resources/resources.h>
7 
9 
10 #ifndef KEYSTONE
11 #define KEYSTONE
12 #endif
13 
17 #define DEFAULT_QT_STYLE "windowsvista"
18 
19 #define THEME_RESOURCE(group_id, id) BlamKeystone::Themes::GetActiveTheme()->GetResource(group_id, id)
20 
25 {
27  User,
29 };
30 
37 {
38  std::string name;
39  std::map<std::string, std::string> properties;
40 };
41 
50 {
51 private:
52  std::string name = "";
53  std::string author = "";
54  std::string description = "";
55  std::string version = "";
56  std::string base_qt_style = "";
57 
58  BlamEditorThemeType theme_type;
59 
60  std::string stylesheet = "";
61  std::string content_dir = "";
62 
63  std::vector<BlamEditorThemeVariant> variants;
64  std::map<std::string, BlamResourceGroup> resource_group_overrides;
65 
66  std::string EvaluateVariantPlaceholders(std::map<std::string, std::string> properties, std::string base_stylesheet);
67  std::string EvaluateResourcePlaceholders(std::string base_stylesheet);
68 
69 public:
70 
83  BlamEditorTheme(std::string _name, std::string _author, std::string _desc, std::string _ver, BlamEditorThemeType type, std::string _content_dir);
84 
97  BlamEditorTheme(std::string _name, std::string _author, std::string _desc, std::string _ver, BlamEditorThemeType type, std::string _stylesheet,
98  std::string _qt_style, std::vector<BlamEditorThemeVariant> _variants, std::string _content_dir,
99  std::map<std::string, BlamResourceGroup> _resource_group_overrides);
100 
106  bool ApplyTheme();
107 
115  bool ApplyVariant(std::string variant_name);
116 
122  std::string GetName();
123 
129  std::string GetAuthor();
130 
136  std::string GetDescription();
137 
143  std::string GetVersion();
144 
151 
157  std::string GetStylesheet();
158 
164  std::vector<BlamEditorThemeVariant> GetVariants();
165 
175  std::string GetResource(std::string group_id, std::string id);
176 };
177 
182 {
188  KEYSTONE bool LoadThemes();
189 
197  KEYSTONE bool ApplyTheme(std::string name);
198 
204  KEYSTONE std::vector<BlamEditorTheme>* GetThemeList();
205 
213  KEYSTONE BlamEditorTheme* GetTheme(std::string name);
214 
221 
230 
237 
244 }
BlamEditorThemeVariant::properties
std::map< std::string, std::string > properties
The list of properties for this theme variant.
Definition: themes.h:39
BlamEditorTheme::GetResource
std::string GetResource(std::string group_id, std::string id)
Retrieves a resource path from the theme.
Definition: BlamEditorTheme.cpp:158
BlamEditorTheme::GetAuthor
std::string GetAuthor()
Retrieves the theme author.
Definition: BlamEditorTheme.cpp:128
KeystoneThemeChangeReceiver
Interface used to listen to theme change events.
Definition: KeystoneThemeChangeReceiver.h:10
BlamKeystone::Themes::UpdateActiveTheme
KEYSTONE void UpdateActiveTheme(BlamEditorTheme *theme)
Updates the stored index of the current active theme.
Definition: themes.cpp:345
BlamKeystone::Themes
Namespace containing functions for the Keystone theme component.
Definition: themes.h:181
BlamEditorThemeType
BlamEditorThemeType
Enumerator for all possible theme types.
Definition: themes.h:24
BuiltIn
@ BuiltIn
Indicates the theme is a built-in theme, provided by Elaztek.
Definition: themes.h:26
BlamEditorTheme::ApplyVariant
bool ApplyVariant(std::string variant_name)
Applies a specified theme variant to the application.
Definition: BlamEditorTheme.cpp:78
BlamEditorTheme
Class representing a Blamite Editor Theme.
Definition: themes.h:49
BlamEditorThemeVariant::name
std::string name
The name of this theme variant.
Definition: themes.h:38
KEYSTONE
#define KEYSTONE
Definition: themes.h:11
BlamEditorTheme::GetVariants
std::vector< BlamEditorThemeVariant > GetVariants()
Retrieves the list of theme variants.
Definition: BlamEditorTheme.cpp:153
BlamEditorThemeVariant
Structure representing a theme variant.
Definition: themes.h:36
BlamKeystone::Themes::ApplyTheme
KEYSTONE bool ApplyTheme(std::string name)
Applies a new theme to the application.
Definition: themes.cpp:300
BlamEditorTheme::GetVersion
std::string GetVersion()
Retrieves the theme version.
Definition: BlamEditorTheme.cpp:138
BlamKeystone::Themes::GetActiveTheme
KEYSTONE BlamEditorTheme * GetActiveTheme()
Retrieves the currently selected theme.
Definition: themes.cpp:335
BlamKeystone::Themes::RemoveReceiver
KEYSTONE void RemoveReceiver(KeystoneThemeChangeReceiver *receiver)
Unregisters a theme change receiver.
Definition: themes.cpp:378
BlamEditorTheme::ApplyTheme
bool ApplyTheme()
Applies this theme to the application.
Definition: BlamEditorTheme.cpp:37
BlamKeystone::Themes::LoadThemes
KEYSTONE bool LoadThemes()
Loads all themes from Qt and the keystone theme folders.
Definition: themes.cpp:259
BlamEditorTheme::GetDescription
std::string GetDescription()
Retrieves the theme description.
Definition: BlamEditorTheme.cpp:133
BlamKeystone::Themes::GetTheme
KEYSTONE BlamEditorTheme * GetTheme(std::string name)
Retrieves a theme.
Definition: themes.cpp:320
BlamEditorTheme::GetName
std::string GetName()
Retrieves the theme name.
Definition: BlamEditorTheme.cpp:123
BlamEditorTheme::GetThemeType
BlamEditorThemeType GetThemeType()
Retrieves the theme type.
Definition: BlamEditorTheme.cpp:143
User
@ User
Indicates the theme is a custom theme added by the user.
Definition: themes.h:27
BlamKeystone::Themes::AddReceiver
KEYSTONE void AddReceiver(KeystoneThemeChangeReceiver *receiver)
Registers a new theme change receiver, which will be notified whenever the active theme changes.
Definition: themes.cpp:370
KeystoneThemeChangeReceiver.h
BlamEditorTheme::BlamEditorTheme
BlamEditorTheme(std::string _name, std::string _author, std::string _desc, std::string _ver, BlamEditorThemeType type, std::string _content_dir)
Prepares a new Editor Theme.
Definition: BlamEditorTheme.cpp:25
BlamEditorTheme::GetStylesheet
std::string GetStylesheet()
Retrieves the theme stylesheet.
Definition: BlamEditorTheme.cpp:148
QtTheme
@ QtTheme
Indicates the theme is a default theme made available from Qt.
Definition: themes.h:28
BlamKeystone::Themes::GetThemeList
KEYSTONE std::vector< BlamEditorTheme > * GetThemeList()
Retrieves the list of loaded themes.
Definition: themes.cpp:315