From f25cf733d6fc1496f02514695948c09797755dae Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sat, 15 Feb 2003 01:59:00 +0000 Subject: added theme listener subject --- src/FbWinFrameTheme.cc | 5 ++++- src/FbWinFrameTheme.hh | 8 +++++++- src/ToolbarTheme.cc | 5 ++++- src/ToolbarTheme.hh | 13 +++++++++---- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/FbWinFrameTheme.cc b/src/FbWinFrameTheme.cc index 8fc562f..ece7dcc 100644 --- a/src/FbWinFrameTheme.cc +++ b/src/FbWinFrameTheme.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrameTheme.cc,v 1.1 2003/01/05 22:14:10 fluxgen Exp $ +// $Id: FbWinFrameTheme.cc,v 1.2 2003/02/15 01:55:45 fluxgen Exp $ #include "FbWinFrameTheme.hh" #include "App.hh" @@ -81,5 +81,8 @@ void FbWinFrameTheme::reconfigTheme() { gcv.foreground = m_label_unfocus_color->pixel(); XChangeGC(disp, m_label_text_unfocus_gc, gc_value_mask, &gcv); + + // notify listeners + m_theme_change.notify(); } diff --git a/src/FbWinFrameTheme.hh b/src/FbWinFrameTheme.hh index 4c702c4..d98b629 100644 --- a/src/FbWinFrameTheme.hh +++ b/src/FbWinFrameTheme.hh @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrameTheme.hh,v 1.1 2003/01/05 22:14:10 fluxgen Exp $ +// $Id: FbWinFrameTheme.hh,v 1.2 2003/02/15 01:55:27 fluxgen Exp $ #ifndef FBWINFRAMETHEME_HH #define FBWINFRAMETHEME_HH @@ -29,6 +29,7 @@ #include "Text.hh" #include "Color.hh" #include "FbTk/Theme.hh" +#include "Subject.hh" class FbWinFrameTheme: public FbTk::Theme { public: @@ -76,6 +77,9 @@ public: GC labelTextUnfocusGC() const { return m_label_text_unfocus_gc; } void reconfigTheme(); + + void addListener(FbTk::Observer &obs) { m_theme_change.attach(&obs); } + void removeListener(FbTk::Observer &obs) { m_theme_change.detach(&obs); } private: FbTk::ThemeItem m_label_focus, m_label_unfocus; FbTk::ThemeItem m_title_focus, m_title_unfocus; @@ -91,6 +95,8 @@ private: FbTk::ThemeItem m_textjustify; GC m_label_text_focus_gc, m_label_text_unfocus_gc; + + FbTk::Subject m_theme_change; }; #endif // FBWINFRAMETHEME_HH diff --git a/src/ToolbarTheme.cc b/src/ToolbarTheme.cc index 138104f..374a596 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.1 2002/12/02 19:56:38 fluxgen Exp $ +// $Id: ToolbarTheme.cc,v 1.2 2003/02/15 01:59:00 fluxgen Exp $ #include "ToolbarTheme.hh" @@ -106,4 +106,7 @@ void ToolbarTheme::reconfigTheme() { gcv.foreground = m_button_color->pixel(); 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 f40ed19..cbe9c90 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.1 2002/12/02 19:56:08 fluxgen Exp $ +// $Id: ToolbarTheme.hh,v 1.2 2003/02/15 01:58:52 fluxgen Exp $ #ifndef TOOLBARTHEME_HH #define TOOLBARTHEME_HH @@ -29,9 +29,9 @@ #include "Texture.hh" #include "Color.hh" #include "Text.hh" -/** - Toolbar theme class container -*/ +#include "Subject.hh" + +/// toolbar theme class container class ToolbarTheme: public FbTk::Theme { public: explicit ToolbarTheme(int screen_num); @@ -71,6 +71,9 @@ public: GC buttonPicGC() const { return m_button_pic_gc; } ///@} FbTk::Justify justify() const { return *m_justify; } + + void addListener(FbTk::Observer &obs) { m_theme_change_sig.attach(&obs); } + void removeListener(FbTk::Observer &obs) { m_theme_change_sig.detach(&obs); } private: // text colors FbTk::ThemeItem m_label_textcolor, m_window_textcolor, m_clock_textcolor; @@ -82,6 +85,8 @@ private: // graphic context GC m_label_text_gc, m_window_text_gc, m_clock_text_gc, m_button_pic_gc; Display *m_display; + + FbTk::Subject m_theme_change_sig; }; #endif // TOOLBARTHEME_HH -- cgit v0.11.2