added theme listener subject

This commit is contained in:
fluxgen 2003-02-15 01:59:00 +00:00
parent 2031f46de3
commit f25cf733d6
4 changed files with 24 additions and 7 deletions

View file

@ -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();
}

View file

@ -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<FbTk::Texture> m_label_focus, m_label_unfocus;
FbTk::ThemeItem<FbTk::Texture> m_title_focus, m_title_unfocus;
@ -91,6 +95,8 @@ private:
FbTk::ThemeItem<FbTk::Justify> m_textjustify;
GC m_label_text_focus_gc, m_label_text_unfocus_gc;
FbTk::Subject m_theme_change;
};
#endif // FBWINFRAMETHEME_HH

View file

@ -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();
}

View file

@ -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<FbTk::Color> 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