From 6016857678cc2a58bfb8af62e5474c3671d7bd38 Mon Sep 17 00:00:00 2001
From: fluxgen <fluxgen>
Date: Mon, 11 Aug 2003 16:54:46 +0000
Subject: updated for new toolbar

---
 src/ToolbarTheme.cc | 24 ++++++++++++++++++++----
 src/ToolbarTheme.hh | 20 +++++++++++++-------
 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 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-// $Id: ToolbarTheme.cc,v 1.5 2003/07/10 13:48:35 fluxgen Exp $
+// $Id: ToolbarTheme.cc,v 1.6 2003/08/11 16:54:46 fluxgen Exp $
 
 #include "ToolbarTheme.hh"
 
@@ -55,8 +55,10 @@ ToolbarTheme::ToolbarTheme(int screen_num):
     m_button_color(*this, 
                    "toolbar.button.picColor", "Toolbar.Button.PicColor"),
     m_border_color(*this,
-                   "toolbar.borderColor", "toolbar.borderColor"),
+                   "toolbar.borderColor", "Toolbar.BorderColor"),
     m_toolbar(*this, "toolbar", "Toolbar"),
+    m_iconbar_focused(*this, "toolbar.iconbar.focused", "Toolbar.Iconbar.Focused"),
+    m_iconbar_unfocused(*this, "toolbar.iconbar.unfocused", "Toolbar.Iconbar.Unfocused"),
     m_label(*this, "toolbar.label", "Toolbar.Label"),
     m_window(*this, "toolbar.windowLabel", "Toolbar.WindowLabel"),
     m_button(*this, "toolbar.button", "Toolbar.Button"),
@@ -64,11 +66,13 @@ ToolbarTheme::ToolbarTheme(int screen_num):
                      "toolbar.button.pressed", "Toolbar.Button.Pressed"),
     m_clock(*this, "toolbar.clock", "Toolbar.Clock"),
     m_font(*this, "toolbar.font", "Toolbar.Font"),
+    m_icon_font(*this, "toolbar.iconFont", "Toolbar.IconFont"),
     m_justify(*this, "toolbar.justify", "Toolbar.Justify"),
     m_border_width(*this, "toolbar.borderWidth", "Toolbar.BorderWidth"),
     m_bevel_width(*this, "toolbar.bevelWidth", "Toolbar.BevelWidth"),
     m_button_border_width(*this, "toolbar.button.borderWidth", "Toolbar.Button.BorderWidth"),
     m_shape(*this, "toolbar.shaped", "Toolbar.Shaped"),    
+    m_alpha(*this, "toolbar.alpha", "Toolbar.Alpha"),
     m_display(FbTk::App::instance()->display()) {
 
     Window rootwindow = RootWindow(m_display, screen_num);
@@ -96,6 +100,16 @@ ToolbarTheme::ToolbarTheme(int screen_num):
     m_button_pic_gc =
         XCreateGC(m_display, rootwindow,
                   gc_value_mask, &gcv);
+
+    gcv.foreground = m_iconbar_focused->color().pixel();
+    m_icon_text_focused_gc = 
+        XCreateGC(m_display, rootwindow,
+                  gc_value_mask, &gcv);
+
+    m_icon_text_unfocused_gc = 
+        XCreateGC(m_display, rootwindow,
+                  gc_value_mask, &gcv);
+
     // load from current database
     FbTk::ThemeManager::instance().loadTheme(*this);
 }
@@ -108,6 +122,10 @@ ToolbarTheme::~ToolbarTheme() {
 }
 
 void ToolbarTheme::reconfigTheme() {
+    if (*m_alpha > 255)
+        *m_alpha = 255;
+    else if (*m_alpha < 0)
+        *m_alpha = 0;
 
     XGCValues gcv;
     unsigned long gc_value_mask = GCForeground;
@@ -129,6 +147,4 @@ void ToolbarTheme::reconfigTheme() {
     XChangeGC(m_display, m_button_pic_gc,
               gc_value_mask, &gcv);
 
-    // notify listeners
-    m_theme_change_sig.notify();
 }
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 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-// $Id: ToolbarTheme.hh,v 1.5 2003/07/10 13:48:35 fluxgen Exp $
+// $Id: ToolbarTheme.hh,v 1.6 2003/08/11 16:54:46 fluxgen Exp $
 
 #ifndef TOOLBARTHEME_HH
 #define TOOLBARTHEME_HH
@@ -54,6 +54,8 @@ public:
     */
     ///@{
     const FbTk::Texture &toolbar() const { return *m_toolbar; }
+    const FbTk::Texture &iconbarFocused() const { return *m_iconbar_focused; }
+    const FbTk::Texture &iconbarUnfocused() const { return *m_iconbar_unfocused; }
     const FbTk::Texture &label() const { return *m_label; }
     const FbTk::Texture &window() const { return *m_window; }
     const FbTk::Texture &button() const { return *m_button; }
@@ -62,6 +64,8 @@ public:
     ///@}
     const FbTk::Font &font() const { return *m_font; }
     FbTk::Font &font() { return *m_font; }
+    const FbTk::Font &iconFont() const { return *m_icon_font; }
+    FbTk::Font &iconFont() { return *m_icon_font; }
     /**
        @name graphic context
      */
@@ -70,6 +74,8 @@ public:
     GC windowTextGC() const { return m_window_text_gc; }
     GC clockTextGC() const { return m_clock_text_gc; }
     GC buttonPicGC() const { return m_button_pic_gc; }
+    GC iconTextFocusedGC() const { return m_icon_text_focused_gc; }
+    GC iconTextUnfocusedGC() const { return m_icon_text_unfocused_gc; }
     ///@}
     FbTk::Justify justify() const { return *m_justify; }
 
@@ -77,27 +83,27 @@ public:
     inline int bevelWidth() const { return *m_bevel_width; }    
     inline int buttonBorderWidth() const { return *m_button_border_width; }
     inline bool shape() const { return *m_shape; }
-
-    void addListener(FbTk::Observer &obs) { m_theme_change_sig.attach(&obs); }
-    void removeListener(FbTk::Observer &obs) { m_theme_change_sig.detach(&obs); }
+    inline unsigned char alpha() const { return *m_alpha; }
 
 private:
     // text colors
     FbTk::ThemeItem<FbTk::Color> m_label_textcolor, m_window_textcolor, m_clock_textcolor;
     FbTk::ThemeItem<FbTk::Color> m_button_color, m_border_color;
     // textures
-    FbTk::ThemeItem<FbTk::Texture> m_toolbar, m_label, m_window, m_button, m_pressed_button, m_clock;
-    FbTk::ThemeItem<FbTk::Font> m_font;
+    FbTk::ThemeItem<FbTk::Texture> m_toolbar, m_iconbar_focused, m_iconbar_unfocused, 
+        m_label, m_window, m_button, m_pressed_button, m_clock;
+    FbTk::ThemeItem<FbTk::Font> m_font, m_icon_font;
     FbTk::ThemeItem<FbTk::Justify> m_justify;
 
     FbTk::ThemeItem<int> m_border_width, m_bevel_width, m_button_border_width;
     FbTk::ThemeItem<bool> m_shape;
+    FbTk::ThemeItem<int> m_alpha;
 
     // graphic context
     GC m_label_text_gc, m_window_text_gc, m_clock_text_gc, m_button_pic_gc;
+    GC m_icon_text_unfocused_gc, m_icon_text_focused_gc;
     Display *m_display;
 
-    FbTk::Subject m_theme_change_sig;
 };
 
 #endif // TOOLBARTHEME_HH
-- 
cgit v0.11.2