aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ToolbarTheme.cc24
-rw-r--r--src/ToolbarTheme.hh20
2 files changed, 33 insertions, 11 deletions
diff --git a/src/ToolbarTheme.cc b/src/ToolbarTheme.cc
index 28a80a4..c6aa5d2 100644
--- a/src/ToolbarTheme.cc
+++ b/src/ToolbarTheme.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: ToolbarTheme.cc,v 1.5 2003/07/10 13:48:35 fluxgen Exp $ 22// $Id: ToolbarTheme.cc,v 1.6 2003/08/11 16:54:46 fluxgen Exp $
23 23
24#include "ToolbarTheme.hh" 24#include "ToolbarTheme.hh"
25 25
@@ -55,8 +55,10 @@ ToolbarTheme::ToolbarTheme(int screen_num):
55 m_button_color(*this, 55 m_button_color(*this,
56 "toolbar.button.picColor", "Toolbar.Button.PicColor"), 56 "toolbar.button.picColor", "Toolbar.Button.PicColor"),
57 m_border_color(*this, 57 m_border_color(*this,
58 "toolbar.borderColor", "toolbar.borderColor"), 58 "toolbar.borderColor", "Toolbar.BorderColor"),
59 m_toolbar(*this, "toolbar", "Toolbar"), 59 m_toolbar(*this, "toolbar", "Toolbar"),
60 m_iconbar_focused(*this, "toolbar.iconbar.focused", "Toolbar.Iconbar.Focused"),
61 m_iconbar_unfocused(*this, "toolbar.iconbar.unfocused", "Toolbar.Iconbar.Unfocused"),
60 m_label(*this, "toolbar.label", "Toolbar.Label"), 62 m_label(*this, "toolbar.label", "Toolbar.Label"),
61 m_window(*this, "toolbar.windowLabel", "Toolbar.WindowLabel"), 63 m_window(*this, "toolbar.windowLabel", "Toolbar.WindowLabel"),
62 m_button(*this, "toolbar.button", "Toolbar.Button"), 64 m_button(*this, "toolbar.button", "Toolbar.Button"),
@@ -64,11 +66,13 @@ ToolbarTheme::ToolbarTheme(int screen_num):
64 "toolbar.button.pressed", "Toolbar.Button.Pressed"), 66 "toolbar.button.pressed", "Toolbar.Button.Pressed"),
65 m_clock(*this, "toolbar.clock", "Toolbar.Clock"), 67 m_clock(*this, "toolbar.clock", "Toolbar.Clock"),
66 m_font(*this, "toolbar.font", "Toolbar.Font"), 68 m_font(*this, "toolbar.font", "Toolbar.Font"),
69 m_icon_font(*this, "toolbar.iconFont", "Toolbar.IconFont"),
67 m_justify(*this, "toolbar.justify", "Toolbar.Justify"), 70 m_justify(*this, "toolbar.justify", "Toolbar.Justify"),
68 m_border_width(*this, "toolbar.borderWidth", "Toolbar.BorderWidth"), 71 m_border_width(*this, "toolbar.borderWidth", "Toolbar.BorderWidth"),
69 m_bevel_width(*this, "toolbar.bevelWidth", "Toolbar.BevelWidth"), 72 m_bevel_width(*this, "toolbar.bevelWidth", "Toolbar.BevelWidth"),
70 m_button_border_width(*this, "toolbar.button.borderWidth", "Toolbar.Button.BorderWidth"), 73 m_button_border_width(*this, "toolbar.button.borderWidth", "Toolbar.Button.BorderWidth"),
71 m_shape(*this, "toolbar.shaped", "Toolbar.Shaped"), 74 m_shape(*this, "toolbar.shaped", "Toolbar.Shaped"),
75 m_alpha(*this, "toolbar.alpha", "Toolbar.Alpha"),
72 m_display(FbTk::App::instance()->display()) { 76 m_display(FbTk::App::instance()->display()) {
73 77
74 Window rootwindow = RootWindow(m_display, screen_num); 78 Window rootwindow = RootWindow(m_display, screen_num);
@@ -96,6 +100,16 @@ ToolbarTheme::ToolbarTheme(int screen_num):
96 m_button_pic_gc = 100 m_button_pic_gc =
97 XCreateGC(m_display, rootwindow, 101 XCreateGC(m_display, rootwindow,
98 gc_value_mask, &gcv); 102 gc_value_mask, &gcv);
103
104 gcv.foreground = m_iconbar_focused->color().pixel();
105 m_icon_text_focused_gc =
106 XCreateGC(m_display, rootwindow,
107 gc_value_mask, &gcv);
108
109 m_icon_text_unfocused_gc =
110 XCreateGC(m_display, rootwindow,
111 gc_value_mask, &gcv);
112
99 // load from current database 113 // load from current database
100 FbTk::ThemeManager::instance().loadTheme(*this); 114 FbTk::ThemeManager::instance().loadTheme(*this);
101} 115}
@@ -108,6 +122,10 @@ ToolbarTheme::~ToolbarTheme() {
108} 122}
109 123
110void ToolbarTheme::reconfigTheme() { 124void ToolbarTheme::reconfigTheme() {
125 if (*m_alpha > 255)
126 *m_alpha = 255;
127 else if (*m_alpha < 0)
128 *m_alpha = 0;
111 129
112 XGCValues gcv; 130 XGCValues gcv;
113 unsigned long gc_value_mask = GCForeground; 131 unsigned long gc_value_mask = GCForeground;
@@ -129,6 +147,4 @@ void ToolbarTheme::reconfigTheme() {
129 XChangeGC(m_display, m_button_pic_gc, 147 XChangeGC(m_display, m_button_pic_gc,
130 gc_value_mask, &gcv); 148 gc_value_mask, &gcv);
131 149
132 // notify listeners
133 m_theme_change_sig.notify();
134} 150}
diff --git a/src/ToolbarTheme.hh b/src/ToolbarTheme.hh
index eaa7811..d356ead 100644
--- a/src/ToolbarTheme.hh
+++ b/src/ToolbarTheme.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: ToolbarTheme.hh,v 1.5 2003/07/10 13:48:35 fluxgen Exp $ 22// $Id: ToolbarTheme.hh,v 1.6 2003/08/11 16:54:46 fluxgen Exp $
23 23
24#ifndef TOOLBARTHEME_HH 24#ifndef TOOLBARTHEME_HH
25#define TOOLBARTHEME_HH 25#define TOOLBARTHEME_HH
@@ -54,6 +54,8 @@ public:
54 */ 54 */
55 ///@{ 55 ///@{
56 const FbTk::Texture &toolbar() const { return *m_toolbar; } 56 const FbTk::Texture &toolbar() const { return *m_toolbar; }
57 const FbTk::Texture &iconbarFocused() const { return *m_iconbar_focused; }
58 const FbTk::Texture &iconbarUnfocused() const { return *m_iconbar_unfocused; }
57 const FbTk::Texture &label() const { return *m_label; } 59 const FbTk::Texture &label() const { return *m_label; }
58 const FbTk::Texture &window() const { return *m_window; } 60 const FbTk::Texture &window() const { return *m_window; }
59 const FbTk::Texture &button() const { return *m_button; } 61 const FbTk::Texture &button() const { return *m_button; }
@@ -62,6 +64,8 @@ public:
62 ///@} 64 ///@}
63 const FbTk::Font &font() const { return *m_font; } 65 const FbTk::Font &font() const { return *m_font; }
64 FbTk::Font &font() { return *m_font; } 66 FbTk::Font &font() { return *m_font; }
67 const FbTk::Font &iconFont() const { return *m_icon_font; }
68 FbTk::Font &iconFont() { return *m_icon_font; }
65 /** 69 /**
66 @name graphic context 70 @name graphic context
67 */ 71 */
@@ -70,6 +74,8 @@ public:
70 GC windowTextGC() const { return m_window_text_gc; } 74 GC windowTextGC() const { return m_window_text_gc; }
71 GC clockTextGC() const { return m_clock_text_gc; } 75 GC clockTextGC() const { return m_clock_text_gc; }
72 GC buttonPicGC() const { return m_button_pic_gc; } 76 GC buttonPicGC() const { return m_button_pic_gc; }
77 GC iconTextFocusedGC() const { return m_icon_text_focused_gc; }
78 GC iconTextUnfocusedGC() const { return m_icon_text_unfocused_gc; }
73 ///@} 79 ///@}
74 FbTk::Justify justify() const { return *m_justify; } 80 FbTk::Justify justify() const { return *m_justify; }
75 81
@@ -77,27 +83,27 @@ public:
77 inline int bevelWidth() const { return *m_bevel_width; } 83 inline int bevelWidth() const { return *m_bevel_width; }
78 inline int buttonBorderWidth() const { return *m_button_border_width; } 84 inline int buttonBorderWidth() const { return *m_button_border_width; }
79 inline bool shape() const { return *m_shape; } 85 inline bool shape() const { return *m_shape; }
80 86 inline unsigned char alpha() const { return *m_alpha; }
81 void addListener(FbTk::Observer &obs) { m_theme_change_sig.attach(&obs); }
82 void removeListener(FbTk::Observer &obs) { m_theme_change_sig.detach(&obs); }
83 87
84private: 88private:
85 // text colors 89 // text colors
86 FbTk::ThemeItem<FbTk::Color> m_label_textcolor, m_window_textcolor, m_clock_textcolor; 90 FbTk::ThemeItem<FbTk::Color> m_label_textcolor, m_window_textcolor, m_clock_textcolor;
87 FbTk::ThemeItem<FbTk::Color> m_button_color, m_border_color; 91 FbTk::ThemeItem<FbTk::Color> m_button_color, m_border_color;
88 // textures 92 // textures
89 FbTk::ThemeItem<FbTk::Texture> m_toolbar, m_label, m_window, m_button, m_pressed_button, m_clock; 93 FbTk::ThemeItem<FbTk::Texture> m_toolbar, m_iconbar_focused, m_iconbar_unfocused,
90 FbTk::ThemeItem<FbTk::Font> m_font; 94 m_label, m_window, m_button, m_pressed_button, m_clock;
95 FbTk::ThemeItem<FbTk::Font> m_font, m_icon_font;
91 FbTk::ThemeItem<FbTk::Justify> m_justify; 96 FbTk::ThemeItem<FbTk::Justify> m_justify;
92 97
93 FbTk::ThemeItem<int> m_border_width, m_bevel_width, m_button_border_width; 98 FbTk::ThemeItem<int> m_border_width, m_bevel_width, m_button_border_width;
94 FbTk::ThemeItem<bool> m_shape; 99 FbTk::ThemeItem<bool> m_shape;
100 FbTk::ThemeItem<int> m_alpha;
95 101
96 // graphic context 102 // graphic context
97 GC m_label_text_gc, m_window_text_gc, m_clock_text_gc, m_button_pic_gc; 103 GC m_label_text_gc, m_window_text_gc, m_clock_text_gc, m_button_pic_gc;
104 GC m_icon_text_unfocused_gc, m_icon_text_focused_gc;
98 Display *m_display; 105 Display *m_display;
99 106
100 FbTk::Subject m_theme_change_sig;
101}; 107};
102 108
103#endif // TOOLBARTHEME_HH 109#endif // TOOLBARTHEME_HH