Added two new 'metadata' and 'scrollHide' elements to ThemeData.

This commit is contained in:
Leon Styhre 2022-01-22 21:21:13 +01:00
parent d04a49957c
commit 6229592c74
2 changed files with 26 additions and 17 deletions

View file

@ -74,6 +74,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
{"rotation", FLOAT}, {"rotation", FLOAT},
{"rotationOrigin", NORMALIZED_PAIR}, {"rotationOrigin", NORMALIZED_PAIR},
{"text", STRING}, {"text", STRING},
{"metadata", STRING},
{"backgroundColor", COLOR}, {"backgroundColor", COLOR},
{"fontPath", PATH}, {"fontPath", PATH},
{"fontSize", FLOAT}, {"fontSize", FLOAT},
@ -100,6 +101,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
{"secondaryColor", COLOR}, {"secondaryColor", COLOR},
{"fontPath", PATH}, {"fontPath", PATH},
{"fontSize", FLOAT}, {"fontSize", FLOAT},
{"scrollHide", BOOLEAN},
{"scrollSound", PATH}, // For backward compatibility with old themes. {"scrollSound", PATH}, // For backward compatibility with old themes.
{"alignment", STRING}, {"alignment", STRING},
{"horizontalMargin", FLOAT}, {"horizontalMargin", FLOAT},
@ -110,6 +112,8 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
{{"pos", NORMALIZED_PAIR}, {{"pos", NORMALIZED_PAIR},
{"size", NORMALIZED_PAIR}, {"size", NORMALIZED_PAIR},
{"origin", NORMALIZED_PAIR}, {"origin", NORMALIZED_PAIR},
{"text", STRING},
{"metadata", STRING},
{"visible", BOOLEAN}, {"visible", BOOLEAN},
{"zIndex", FLOAT}}}, {"zIndex", FLOAT}}},
{"ninepatch", {"ninepatch",
@ -124,6 +128,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
{"origin", NORMALIZED_PAIR}, {"origin", NORMALIZED_PAIR},
{"rotation", FLOAT}, {"rotation", FLOAT},
{"rotationOrigin", NORMALIZED_PAIR}, {"rotationOrigin", NORMALIZED_PAIR},
{"metadata", STRING},
{"backgroundColor", COLOR}, {"backgroundColor", COLOR},
{"fontPath", PATH}, {"fontPath", PATH},
{"fontSize", FLOAT}, {"fontSize", FLOAT},

View file

@ -37,26 +37,30 @@ class Window;
namespace ThemeFlags namespace ThemeFlags
{ {
// clang-format off
// These are only the most common flags shared accross multiple components, in addition
// to these there are many component-specific options.
enum PropertyFlags : unsigned int { enum PropertyFlags : unsigned int {
PATH = 1, PATH = 0x00000001,
POSITION = 2, POSITION = 0x00000002,
SIZE = 4, SIZE = 0x00000004,
ORIGIN = 8, ORIGIN = 0x00000008,
COLOR = 16, COLOR = 0x00000010,
FONT_PATH = 32, FONT_PATH = 0x00000020,
FONT_SIZE = 64, FONT_SIZE = 0x00000040,
SOUND = 128, ALIGNMENT = 0x00000080,
ALIGNMENT = 256, TEXT = 0x00000100,
TEXT = 512, METADATA = 0x00000200,
FORCE_UPPERCASE = 1024, FORCE_UPPERCASE = 0x00000400,
LINE_SPACING = 2048, LINE_SPACING = 0x00000800,
DELAY = 4096, DELAY = 0x00001000,
Z_INDEX = 8192, Z_INDEX = 0x00002000,
ROTATION = 16384, ROTATION = 0x00004000,
VISIBLE = 32768, VISIBLE = 0x00008000,
ALL = 0xFFFFFFFF ALL = 0xFFFFFFFF
}; };
} // clang-format on
} // namespace ThemeFlags
class ThemeException : public std::exception class ThemeException : public std::exception
{ {