summaryrefslogtreecommitdiff
path: root/src/gui/guiFormSpecMenu.cpp
diff options
context:
space:
mode:
authorv-rob <robinsonvincent89@gmail.com>2020-05-06 10:36:02 -0700
committerGitHub <noreply@github.com>2020-05-06 19:36:02 +0200
commit664800b2adda44039a85c3566b4ed958abff8b95 (patch)
treeeebc1a69335938833321ddb3cd6382b26e58db99 /src/gui/guiFormSpecMenu.cpp
parent4f9a5f67ee745d78fdc3e173972a3df110f989cf (diff)
downloadminetest-664800b2adda44039a85c3566b4ed958abff8b95.tar.gz
minetest-664800b2adda44039a85c3566b4ed958abff8b95.tar.bz2
minetest-664800b2adda44039a85c3566b4ed958abff8b95.zip
FormSpec: Add universal style selector `*` (#9718)
Diffstat (limited to 'src/gui/guiFormSpecMenu.cpp')
-rw-r--r--src/gui/guiFormSpecMenu.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp
index 567f0ca7e..72095a86e 100644
--- a/src/gui/guiFormSpecMenu.cpp
+++ b/src/gui/guiFormSpecMenu.cpp
@@ -4609,20 +4609,32 @@ StyleSpec GUIFormSpecMenu::getDefaultStyleForElement(const std::string &type,
return getStyleForElement(type, name, parent_type)[StyleSpec::STATE_DEFAULT];
}
-std::array<StyleSpec, StyleSpec::NUM_STATES> GUIFormSpecMenu::getStyleForElement(const std::string &type,
- const std::string &name, const std::string &parent_type)
+std::array<StyleSpec, StyleSpec::NUM_STATES> GUIFormSpecMenu::getStyleForElement(
+ const std::string &type, const std::string &name, const std::string &parent_type)
{
std::array<StyleSpec, StyleSpec::NUM_STATES> ret;
+ auto it = theme_by_type.find("*");
+ if (it != theme_by_type.end()) {
+ for (const StyleSpec &spec : it->second)
+ ret[(u32)spec.getState()] |= spec;
+ }
+
+ it = theme_by_name.find("*");
+ if (it != theme_by_name.end()) {
+ for (const StyleSpec &spec : it->second)
+ ret[(u32)spec.getState()] |= spec;
+ }
+
if (!parent_type.empty()) {
- auto it = theme_by_type.find(parent_type);
+ it = theme_by_type.find(parent_type);
if (it != theme_by_type.end()) {
for (const StyleSpec &spec : it->second)
ret[(u32)spec.getState()] |= spec;
}
}
- auto it = theme_by_type.find(type);
+ it = theme_by_type.find(type);
if (it != theme_by_type.end()) {
for (const StyleSpec &spec : it->second)
ret[(u32)spec.getState()] |= spec;