]> git.tdb.fi Git - poefilter.git/commitdiff
Add inheritance for appearances
authorMikko Rasa <tdb@tdb.fi>
Tue, 14 Aug 2018 23:47:53 +0000 (02:47 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 15 Aug 2018 00:02:00 +0000 (03:02 +0300)
source/appearance.cpp
source/appearance.h

index ccd847666b388900534464f1ae196b0d09737e53..ffe47ff576600b13e4e11d1828bf91fb3c1e67cf 100644 (file)
@@ -60,6 +60,7 @@ Appearance::Loader::Loader(Appearance &a, const Theme *t):
        add("border_color", &Loader::border_color_alpha);
        add("border_color", &Loader::border_color_named);
        add("font_size", &Loader::font_size);
+       add("inherit", &Loader::inherit);
        add("text_color", &Loader::text_color);
        add("text_color", &Loader::text_color_alpha);
        add("text_color", &Loader::text_color_named);
@@ -105,6 +106,13 @@ void Appearance::Loader::font_size(float s)
        obj.font_size = base_size*s+0.5f;
 }
 
+void Appearance::Loader::inherit(const string &name)
+{
+       if(!theme)
+               throw logic_error("No theme");
+       obj = theme->get_appearance(name);
+}
+
 void Appearance::Loader::text_color(unsigned r, unsigned g, unsigned b)
 {
        obj.text_color = Color(r, g, b);
index 6806ed238d1d88085b5e714fa1056b927882f7ee..9e6fb6996921ff62043be9bf437fc7b9836dfe43 100644 (file)
@@ -26,6 +26,7 @@ public:
                void border_color_alpha(unsigned, unsigned, unsigned, unsigned);
                void border_color_named(const std::string &);
                void font_size(float);
+               void inherit(const std::string &);
                void text_color(unsigned, unsigned, unsigned);
                void text_color_alpha(unsigned, unsigned, unsigned, unsigned);
                void text_color_named(const std::string &);