From 6229592c747784456b3fe360ecd0d90c31b68877 Mon Sep 17 00:00:00 2001
From: Leon Styhre <leon@leonstyhre.com>
Date: Sat, 22 Jan 2022 21:21:13 +0100
Subject: [PATCH] Added two new 'metadata' and 'scrollHide' elements to
 ThemeData.

---
 es-core/src/ThemeData.cpp |  5 +++++
 es-core/src/ThemeData.h   | 38 +++++++++++++++++++++-----------------
 2 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/es-core/src/ThemeData.cpp b/es-core/src/ThemeData.cpp
index 111965bfe..a935bbafa 100644
--- a/es-core/src/ThemeData.cpp
+++ b/es-core/src/ThemeData.cpp
@@ -74,6 +74,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
        {"rotation", FLOAT},
        {"rotationOrigin", NORMALIZED_PAIR},
        {"text", STRING},
+       {"metadata", STRING},
        {"backgroundColor", COLOR},
        {"fontPath", PATH},
        {"fontSize", FLOAT},
@@ -100,6 +101,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
        {"secondaryColor", COLOR},
        {"fontPath", PATH},
        {"fontSize", FLOAT},
+       {"scrollHide", BOOLEAN},
        {"scrollSound", PATH}, // For backward compatibility with old themes.
        {"alignment", STRING},
        {"horizontalMargin", FLOAT},
@@ -110,6 +112,8 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
       {{"pos", NORMALIZED_PAIR},
        {"size", NORMALIZED_PAIR},
        {"origin", NORMALIZED_PAIR},
+       {"text", STRING},
+       {"metadata", STRING},
        {"visible", BOOLEAN},
        {"zIndex", FLOAT}}},
      {"ninepatch",
@@ -124,6 +128,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
        {"origin", NORMALIZED_PAIR},
        {"rotation", FLOAT},
        {"rotationOrigin", NORMALIZED_PAIR},
+       {"metadata", STRING},
        {"backgroundColor", COLOR},
        {"fontPath", PATH},
        {"fontSize", FLOAT},
diff --git a/es-core/src/ThemeData.h b/es-core/src/ThemeData.h
index 04f3f1219..fc6805aa2 100644
--- a/es-core/src/ThemeData.h
+++ b/es-core/src/ThemeData.h
@@ -37,26 +37,30 @@ class Window;
 
 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 {
-        PATH = 1,
-        POSITION = 2,
-        SIZE = 4,
-        ORIGIN = 8,
-        COLOR = 16,
-        FONT_PATH = 32,
-        FONT_SIZE = 64,
-        SOUND = 128,
-        ALIGNMENT = 256,
-        TEXT = 512,
-        FORCE_UPPERCASE = 1024,
-        LINE_SPACING = 2048,
-        DELAY = 4096,
-        Z_INDEX = 8192,
-        ROTATION = 16384,
-        VISIBLE = 32768,
+        PATH =            0x00000001,
+        POSITION =        0x00000002,
+        SIZE =            0x00000004,
+        ORIGIN =          0x00000008,
+        COLOR =           0x00000010,
+        FONT_PATH =       0x00000020,
+        FONT_SIZE =       0x00000040,
+        ALIGNMENT =       0x00000080,
+        TEXT =            0x00000100,
+        METADATA =        0x00000200,
+        FORCE_UPPERCASE = 0x00000400,
+        LINE_SPACING =    0x00000800,
+        DELAY =           0x00001000,
+        Z_INDEX =         0x00002000,
+        ROTATION =        0x00004000,
+        VISIBLE =         0x00008000,
         ALL = 0xFFFFFFFF
     };
-}
+    // clang-format on
+} // namespace ThemeFlags
 
 class ThemeException : public std::exception
 {