aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ButtonTheme.hh8
-rw-r--r--src/FbTk/MenuTheme.hh8
-rw-r--r--src/FbTk/TextTheme.cc4
-rw-r--r--src/FbTk/TextTheme.hh2
-rw-r--r--src/FbTk/Theme.hh12
-rw-r--r--src/FbWinFrameTheme.hh9
-rw-r--r--src/IconbarTheme.cc4
-rw-r--r--src/IconbarTheme.hh8
-rw-r--r--src/RootTheme.hh10
-rw-r--r--src/SlitTheme.hh9
-rw-r--r--src/ToolTheme.cc2
-rw-r--r--src/ToolTheme.hh9
-rw-r--r--src/ToolbarTheme.hh9
-rw-r--r--src/WinButtonTheme.hh9
-rw-r--r--src/WorkspaceNameTheme.hh10
15 files changed, 96 insertions, 17 deletions
diff --git a/src/ButtonTheme.hh b/src/ButtonTheme.hh
index 00c6446..7f43eb9 100644
--- a/src/ButtonTheme.hh
+++ b/src/ButtonTheme.hh
@@ -27,7 +27,7 @@
27 27
28#include "FbTk/GContext.hh" 28#include "FbTk/GContext.hh"
29 29
30class ButtonTheme: public ToolTheme { 30class ButtonTheme: public ToolTheme, public FbTk::ThemeProxy<ButtonTheme> {
31public: 31public:
32 ButtonTheme(int screen_num, 32 ButtonTheme(int screen_num,
33 const std::string &name, const std::string &alt_name, 33 const std::string &name, const std::string &alt_name,
@@ -43,6 +43,12 @@ public:
43 int scale() const { return *m_scale; } // scale factor for inside objects 43 int scale() const { return *m_scale; } // scale factor for inside objects
44 const std::string &name() { return m_name; } 44 const std::string &name() { return m_name; }
45 45
46 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
47 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
48
49 virtual ButtonTheme *operator ->() { return this; }
50 virtual const ButtonTheme *operator ->() const { return this; }
51
46private: 52private:
47 FbTk::ThemeItem<FbTk::Color> m_pic_color; 53 FbTk::ThemeItem<FbTk::Color> m_pic_color;
48 FbTk::ThemeItem<FbTk::Texture> m_pressed_texture; 54 FbTk::ThemeItem<FbTk::Texture> m_pressed_texture;
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
34namespace FbTk { 34namespace FbTk {
35 35
36class MenuTheme:public Theme { 36class MenuTheme: public Theme, public ThemeProxy<MenuTheme> {
37public: 37public:
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
143private: 149private:
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
44void TextTheme::update() { 44void 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
122template <class BaseTheme>
123class ThemeProxy {
124public:
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/**
diff --git a/src/FbWinFrameTheme.hh b/src/FbWinFrameTheme.hh
index 7d5106c..e72d6f5 100644
--- a/src/FbWinFrameTheme.hh
+++ b/src/FbWinFrameTheme.hh
@@ -32,7 +32,8 @@
32 32
33#include "IconbarTheme.hh" 33#include "IconbarTheme.hh"
34 34
35class FbWinFrameTheme: public FbTk::Theme { 35class FbWinFrameTheme: public FbTk::Theme,
36 public FbTk::ThemeProxy<FbWinFrameTheme> {
36public: 37public:
37 explicit FbWinFrameTheme(int screen_num); 38 explicit FbWinFrameTheme(int screen_num);
38 ~FbWinFrameTheme(); 39 ~FbWinFrameTheme();
@@ -93,6 +94,12 @@ public:
93 94
94 IconbarTheme &iconbarTheme() { return m_iconbar_theme; } 95 IconbarTheme &iconbarTheme() { return m_iconbar_theme; }
95 96
97 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
98 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
99
100 virtual FbWinFrameTheme *operator ->() { return this; }
101 virtual const FbWinFrameTheme *operator ->() const { return this; }
102
96private: 103private:
97 FbTk::ThemeItem<FbTk::Texture> m_title_focus, m_title_unfocus; 104 FbTk::ThemeItem<FbTk::Texture> m_title_focus, m_title_unfocus;
98 FbTk::ThemeItem<FbTk::Texture> m_handle_focus, m_handle_unfocus; 105 FbTk::ThemeItem<FbTk::Texture> m_handle_focus, m_handle_unfocus;
diff --git a/src/IconbarTheme.cc b/src/IconbarTheme.cc
index 3cc2bf3..f2247aa 100644
--- a/src/IconbarTheme.cc
+++ b/src/IconbarTheme.cc
@@ -58,8 +58,8 @@ IconbarTheme::~IconbarTheme() {
58 58
59 59
60void IconbarTheme::reconfigTheme() { 60void IconbarTheme::reconfigTheme() {
61 m_focused_text.update(); 61 m_focused_text.updateTextColor();
62 m_unfocused_text.update(); 62 m_unfocused_text.updateTextColor();
63} 63}
64 64
65// fallback resources 65// fallback resources
diff --git a/src/IconbarTheme.hh b/src/IconbarTheme.hh
index 6d41f28..3a56eb8 100644
--- a/src/IconbarTheme.hh
+++ b/src/IconbarTheme.hh
@@ -28,7 +28,7 @@
28#include "FbTk/Texture.hh" 28#include "FbTk/Texture.hh"
29#include "FbTk/TextTheme.hh" 29#include "FbTk/TextTheme.hh"
30 30
31class IconbarTheme:public FbTk::Theme { 31class IconbarTheme: public FbTk::Theme, public FbTk::ThemeProxy<IconbarTheme> {
32public: 32public:
33 IconbarTheme(int screen_num, const std::string &name, const std::string &altname); 33 IconbarTheme(int screen_num, const std::string &name, const std::string &altname);
34 virtual ~IconbarTheme(); 34 virtual ~IconbarTheme();
@@ -47,6 +47,12 @@ public:
47 const FbTk::Texture &unfocusedTexture() const { return *m_unfocused_texture; } 47 const FbTk::Texture &unfocusedTexture() const { return *m_unfocused_texture; }
48 const FbTk::Texture &emptyTexture() const { return *m_empty_texture; } 48 const FbTk::Texture &emptyTexture() const { return *m_empty_texture; }
49 49
50 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
51 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
52
53 virtual IconbarTheme *operator ->() { return this; }
54 virtual const IconbarTheme *operator ->() const { return this; }
55
50private: 56private:
51 FbTk::ThemeItem<FbTk::Texture> m_focused_texture, m_unfocused_texture, m_empty_texture; 57 FbTk::ThemeItem<FbTk::Texture> m_focused_texture, m_unfocused_texture, m_empty_texture;
52 FbTk::BorderTheme m_focused_border, m_unfocused_border, m_border; 58 FbTk::BorderTheme m_focused_border, m_unfocused_border, m_border;
diff --git a/src/RootTheme.hh b/src/RootTheme.hh
index 96d9f0e..1e37cfe 100644
--- a/src/RootTheme.hh
+++ b/src/RootTheme.hh
@@ -34,7 +34,7 @@ class ImageControl;
34} 34}
35 35
36/// Contains border color, border size, bevel width and opGC for objects like geometry window in BScreen 36/// Contains border color, border size, bevel width and opGC for objects like geometry window in BScreen
37class RootTheme: public FbTk::Theme { 37class RootTheme: public FbTk::Theme, public FbTk::ThemeProxy<RootTheme> {
38public: 38public:
39 /// constructor 39 /// constructor
40 /// @param resmanager resource manager for finding specific resources 40 /// @param resmanager resource manager for finding specific resources
@@ -53,7 +53,13 @@ public:
53 int join_style) { 53 int join_style) {
54 m_opgc.setLineAttributes(width, line_style, cap_style, join_style); 54 m_opgc.setLineAttributes(width, line_style, cap_style, join_style);
55 } 55 }
56 56
57 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
58 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
59
60 virtual RootTheme *operator ->() { return this; }
61 virtual const RootTheme *operator ->() const { return this; }
62
57private: 63private:
58 BackgroundItem *m_background;///< background image/texture 64 BackgroundItem *m_background;///< background image/texture
59 FbTk::GContext m_opgc; 65 FbTk::GContext m_opgc;
diff --git a/src/SlitTheme.hh b/src/SlitTheme.hh
index 33fada7..20be862 100644
--- a/src/SlitTheme.hh
+++ b/src/SlitTheme.hh
@@ -26,7 +26,7 @@
26#include "FbTk/Texture.hh" 26#include "FbTk/Texture.hh"
27#include "FbTk/Color.hh" 27#include "FbTk/Color.hh"
28 28
29class SlitTheme:public FbTk::Theme { 29class SlitTheme: public FbTk::Theme, public FbTk::ThemeProxy<SlitTheme> {
30public: 30public:
31 explicit SlitTheme(int screen_num); 31 explicit SlitTheme(int screen_num);
32 32
@@ -37,6 +37,13 @@ public:
37 const FbTk::Color &borderColor() const { return *m_border_color; } 37 const FbTk::Color &borderColor() const { return *m_border_color; }
38 int borderWidth() const { return *m_border_width; } 38 int borderWidth() const { return *m_border_width; }
39 int bevelWidth() const { return *m_bevel_width; } 39 int bevelWidth() const { return *m_bevel_width; }
40
41 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
42 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
43
44 virtual SlitTheme *operator ->() { return this; }
45 virtual const SlitTheme *operator ->() const { return this; }
46
40private: 47private:
41 FbTk::ThemeItem<FbTk::Texture> m_texture; 48 FbTk::ThemeItem<FbTk::Texture> m_texture;
42 FbTk::ThemeItem<int> m_border_width, m_bevel_width; 49 FbTk::ThemeItem<int> m_border_width, m_bevel_width;
diff --git a/src/ToolTheme.cc b/src/ToolTheme.cc
index 5741fd0..a5abc1a 100644
--- a/src/ToolTheme.cc
+++ b/src/ToolTheme.cc
@@ -38,7 +38,7 @@ ToolTheme::~ToolTheme() {
38 38
39void ToolTheme::reconfigTheme() { 39void ToolTheme::reconfigTheme() {
40 // update text theme 40 // update text theme
41 update(); 41 updateTextColor();
42} 42}
43 43
44bool ToolTheme::fallback(FbTk::ThemeItem_base &item) { 44bool ToolTheme::fallback(FbTk::ThemeItem_base &item) {
diff --git a/src/ToolTheme.hh b/src/ToolTheme.hh
index b9d98df..552e8f8 100644
--- a/src/ToolTheme.hh
+++ b/src/ToolTheme.hh
@@ -29,7 +29,8 @@
29#include "FbTk/Texture.hh" 29#include "FbTk/Texture.hh"
30 30
31/// Handles toolbar item theme for text and texture 31/// Handles toolbar item theme for text and texture
32class ToolTheme: public FbTk::Theme, public FbTk::TextTheme { 32class ToolTheme: public FbTk::Theme, public FbTk::TextTheme,
33 public FbTk::ThemeProxy<ToolTheme> {
33public: 34public:
34 ToolTheme(int screen_num, const std::string &name, const std::string &altname); 35 ToolTheme(int screen_num, const std::string &name, const std::string &altname);
35 virtual ~ToolTheme(); 36 virtual ~ToolTheme();
@@ -43,6 +44,12 @@ public:
43 unsigned char alpha() const { return m_alpha; } 44 unsigned char alpha() const { return m_alpha; }
44 void setAlpha(unsigned char alpha) { m_alpha = alpha; } 45 void setAlpha(unsigned char alpha) { m_alpha = alpha; }
45 46
47 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
48 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
49
50 virtual ToolTheme *operator ->() { return this; }
51 virtual const ToolTheme *operator ->() const { return this; }
52
46protected: 53protected:
47 FbTk::ThemeItem<FbTk::Texture> &textureTheme() { return m_texture; } 54 FbTk::ThemeItem<FbTk::Texture> &textureTheme() { return m_texture; }
48 55
diff --git a/src/ToolbarTheme.hh b/src/ToolbarTheme.hh
index 57f8eb1..1a183e2 100644
--- a/src/ToolbarTheme.hh
+++ b/src/ToolbarTheme.hh
@@ -27,7 +27,7 @@
27#include "FbTk/BorderTheme.hh" 27#include "FbTk/BorderTheme.hh"
28 28
29/// toolbar theme class container 29/// toolbar theme class container
30class ToolbarTheme: public FbTk::Theme { 30class ToolbarTheme: public FbTk::Theme, public FbTk::ThemeProxy<ToolbarTheme> {
31public: 31public:
32 explicit ToolbarTheme(int screen_num); 32 explicit ToolbarTheme(int screen_num);
33 virtual ~ToolbarTheme(); 33 virtual ~ToolbarTheme();
@@ -43,6 +43,13 @@ public:
43 bool shape() const { return *m_shape; } 43 bool shape() const { return *m_shape; }
44 int height() const { return *m_height; } 44 int height() const { return *m_height; }
45 int buttonSize() const { return *m_button_size; } 45 int buttonSize() const { return *m_button_size; }
46
47 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
48 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
49
50 virtual ToolbarTheme *operator ->() { return this; }
51 virtual const ToolbarTheme *operator ->() const { return this; }
52
46private: 53private:
47 FbTk::ThemeItem<FbTk::Texture> m_toolbar; 54 FbTk::ThemeItem<FbTk::Texture> m_toolbar;
48 FbTk::BorderTheme m_border; 55 FbTk::BorderTheme m_border;
diff --git a/src/WinButtonTheme.hh b/src/WinButtonTheme.hh
index 70a2297..7d00e1e 100644
--- a/src/WinButtonTheme.hh
+++ b/src/WinButtonTheme.hh
@@ -27,7 +27,8 @@
27 27
28class FbWinFrameTheme; 28class FbWinFrameTheme;
29 29
30class WinButtonTheme: public FbTk::Theme { 30class WinButtonTheme: public FbTk::Theme,
31 public FbTk::ThemeProxy<WinButtonTheme> {
31public: 32public:
32 WinButtonTheme(int screen_num, FbWinFrameTheme &frame_theme); 33 WinButtonTheme(int screen_num, FbWinFrameTheme &frame_theme);
33 ~WinButtonTheme(); 34 ~WinButtonTheme();
@@ -84,6 +85,12 @@ public:
84 FbTk::PixmapWithMask &titleUnfocusPixmap() { return *m_title_unfocus_pm; } 85 FbTk::PixmapWithMask &titleUnfocusPixmap() { return *m_title_unfocus_pm; }
85 const FbTk::PixmapWithMask &titleUnfocusPixmap() const { return *m_title_unfocus_pm; } 86 const FbTk::PixmapWithMask &titleUnfocusPixmap() const { return *m_title_unfocus_pm; }
86 87
88 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
89 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
90
91 virtual WinButtonTheme *operator ->() { return this; }
92 virtual const WinButtonTheme *operator ->() const { return this; }
93
87private: 94private:
88 95
89 FbTk::ThemeItem<FbTk::PixmapWithMask> m_close_pm, m_close_unfocus_pm, m_close_pressed_pm; 96 FbTk::ThemeItem<FbTk::PixmapWithMask> m_close_pm, m_close_unfocus_pm, m_close_pressed_pm;
diff --git a/src/WorkspaceNameTheme.hh b/src/WorkspaceNameTheme.hh
index 2e4dc42..860f6ec 100644
--- a/src/WorkspaceNameTheme.hh
+++ b/src/WorkspaceNameTheme.hh
@@ -25,7 +25,8 @@
25 25
26#include "ToolTheme.hh" 26#include "ToolTheme.hh"
27 27
28class WorkspaceNameTheme:public ToolTheme { 28class WorkspaceNameTheme: public ToolTheme,
29 public FbTk::ThemeProxy<WorkspaceNameTheme> {
29public: 30public:
30 WorkspaceNameTheme(int screen_num, 31 WorkspaceNameTheme(int screen_num,
31 const std::string &name, 32 const std::string &name,
@@ -44,6 +45,13 @@ public:
44 45
45 return ToolTheme::fallback(item); 46 return ToolTheme::fallback(item);
46 } 47 }
48
49 virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
50 virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
51
52 virtual WorkspaceNameTheme *operator ->() { return this; }
53 virtual const WorkspaceNameTheme *operator ->() const { return this; }
54
47}; 55};
48 56
49#endif // WORKSPACENAMETHEME_HH 57#endif // WORKSPACENAMETHEME_HH