diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-01-04 09:06:38 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-01-04 09:06:38 (GMT) |
commit | 60ba709c2f47cc2c7b877aef1b0f297b097853e5 (patch) | |
tree | c722b0dacce3c7c0b1df7bf6ccb2b322bc819f6b /src/FbTk | |
parent | b20b243b48683d209f8134b46c6dcea4df94b6cc (diff) | |
download | fluxbox_lack-60ba709c2f47cc2c7b877aef1b0f297b097853e5.zip fluxbox_lack-60ba709c2f47cc2c7b877aef1b0f297b097853e5.tar.bz2 |
add a level of indirection to themes
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/MenuTheme.hh | 8 | ||||
-rw-r--r-- | src/FbTk/TextTheme.cc | 4 | ||||
-rw-r--r-- | src/FbTk/TextTheme.hh | 2 | ||||
-rw-r--r-- | src/FbTk/Theme.hh | 12 |
4 files changed, 22 insertions, 4 deletions
diff --git a/src/FbTk/MenuTheme.hh b/src/FbTk/MenuTheme.hh index d496f1e..017e4f3 100644 --- a/src/FbTk/MenuTheme.hh +++ b/src/FbTk/MenuTheme.hh | |||
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | namespace FbTk { | 34 | namespace FbTk { |
35 | 35 | ||
36 | class MenuTheme:public Theme { | 36 | class MenuTheme: public Theme, public ThemeProxy<MenuTheme> { |
37 | public: | 37 | public: |
38 | //!! TODO | 38 | //!! TODO |
39 | // this isn't actually used with a theme item | 39 | // this isn't actually used with a theme item |
@@ -140,6 +140,12 @@ public: | |||
140 | m_hl_selected_pixmap->pixmap().dontFree(); | 140 | m_hl_selected_pixmap->pixmap().dontFree(); |
141 | } | 141 | } |
142 | 142 | ||
143 | virtual Subject &reconfigSig() { return Theme::reconfigSig(); } | ||
144 | virtual const Subject &reconfigSig() const { return Theme::reconfigSig(); } | ||
145 | |||
146 | virtual MenuTheme *operator ->() { return this; } | ||
147 | virtual const MenuTheme *operator ->() const { return this; } | ||
148 | |||
143 | private: | 149 | private: |
144 | ThemeItem<Color> t_text, f_text, h_text, d_text, u_text; | 150 | ThemeItem<Color> t_text, f_text, h_text, d_text, u_text; |
145 | ThemeItem<Texture> title, frame, hilite; | 151 | ThemeItem<Texture> title, frame, hilite; |
diff --git a/src/FbTk/TextTheme.cc b/src/FbTk/TextTheme.cc index 848ee01..dad002e 100644 --- a/src/FbTk/TextTheme.cc +++ b/src/FbTk/TextTheme.cc | |||
@@ -38,10 +38,10 @@ TextTheme::TextTheme(Theme &theme, | |||
38 | // set default values | 38 | // set default values |
39 | m_text_color->setFromString("white", theme.screenNum()); | 39 | m_text_color->setFromString("white", theme.screenNum()); |
40 | 40 | ||
41 | update(); | 41 | updateTextColor(); |
42 | } | 42 | } |
43 | 43 | ||
44 | void TextTheme::update() { | 44 | void TextTheme::updateTextColor() { |
45 | m_text_gc.setForeground(*m_text_color); | 45 | m_text_gc.setForeground(*m_text_color); |
46 | } | 46 | } |
47 | 47 | ||
diff --git a/src/FbTk/TextTheme.hh b/src/FbTk/TextTheme.hh index ea22d4b..9a83788 100644 --- a/src/FbTk/TextTheme.hh +++ b/src/FbTk/TextTheme.hh | |||
@@ -36,7 +36,7 @@ public: | |||
36 | TextTheme(Theme &theme, const std::string &name, const std::string &altname); | 36 | TextTheme(Theme &theme, const std::string &name, const std::string &altname); |
37 | virtual ~TextTheme() { } | 37 | virtual ~TextTheme() { } |
38 | 38 | ||
39 | void update(); | 39 | void updateTextColor(); |
40 | 40 | ||
41 | Font &font() { return *m_font; } | 41 | Font &font() { return *m_font; } |
42 | const Font &font() const { return *m_font; } | 42 | const Font &font() const { return *m_font; } |
diff --git a/src/FbTk/Theme.hh b/src/FbTk/Theme.hh index 159364e..1ae3387 100644 --- a/src/FbTk/Theme.hh +++ b/src/FbTk/Theme.hh | |||
@@ -118,6 +118,18 @@ private: | |||
118 | FbTk::Subject m_reconfig_sig; | 118 | FbTk::Subject m_reconfig_sig; |
119 | }; | 119 | }; |
120 | 120 | ||
121 | /// Proxy interface for themes, so they can be substituted dynamically | ||
122 | template <class BaseTheme> | ||
123 | class ThemeProxy { | ||
124 | public: | ||
125 | virtual ~ThemeProxy() { } | ||
126 | |||
127 | virtual Subject &reconfigSig() = 0; | ||
128 | virtual const Subject &reconfigSig() const = 0; | ||
129 | |||
130 | virtual BaseTheme *operator ->() = 0; | ||
131 | virtual const BaseTheme *operator ->() const = 0; | ||
132 | }; | ||
121 | 133 | ||
122 | /// Singleton theme manager | 134 | /// Singleton theme manager |
123 | /** | 135 | /** |