aboutsummaryrefslogtreecommitdiff
path: root/src/Focusable.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/Focusable.hh')
-rw-r--r--src/Focusable.hh24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/Focusable.hh b/src/Focusable.hh
index cf2169a..679e00b 100644
--- a/src/Focusable.hh
+++ b/src/Focusable.hh
@@ -24,7 +24,6 @@
24 24
25#include "FbTk/PixmapWithMask.hh" 25#include "FbTk/PixmapWithMask.hh"
26#include "FbTk/ITypeAheadable.hh" 26#include "FbTk/ITypeAheadable.hh"
27#include "FbTk/Subject.hh"
28#include "FbTk/Signal.hh" 27#include "FbTk/Signal.hh"
29#include "FbTk/FbString.hh" 28#include "FbTk/FbString.hh"
30 29
@@ -41,7 +40,7 @@ public:
41 m_screen(scr), m_fbwin(fbwin), 40 m_screen(scr), m_fbwin(fbwin),
42 m_instance_name("fluxbox"), m_class_name("fluxbox"), 41 m_instance_name("fluxbox"), m_class_name("fluxbox"),
43 m_focused(false), m_attention_state(false), 42 m_focused(false), m_attention_state(false),
44 m_attentionsig(*this), 43 m_attentionsig(),
45 m_focussig(), 44 m_focussig(),
46 m_diesig(), 45 m_diesig(),
47 m_titlesig() { } 46 m_titlesig() { }
@@ -62,7 +61,7 @@ public:
62 bool getAttentionState() const { return m_attention_state; } 61 bool getAttentionState() const { return m_attention_state; }
63 /// @set the attention state 62 /// @set the attention state
64 virtual void setAttentionState(bool value) { 63 virtual void setAttentionState(bool value) {
65 m_attention_state = value; attentionSig().notify(); 64 m_attention_state = value; attentionSig().emit(*this);
66 } 65 }
67 66
68 /// @return the screen in which this object resides 67 /// @return the screen in which this object resides
@@ -101,19 +100,6 @@ public:
101 virtual const FbTk::BiDiString &title() const { return m_title; } 100 virtual const FbTk::BiDiString &title() const { return m_title; }
102 /// @return type ahead string 101 /// @return type ahead string
103 const std::string &iTypeString() const { return title().logical(); } 102 const std::string &iTypeString() const { return title().logical(); }
104 /**
105 * Signaling object to attatch observers to.
106 */
107 class FocusSubject: public FbTk::Subject {
108 public:
109 explicit FocusSubject(Focusable &w):m_win(w) { }
110 /// @return context focusable for this signal
111 Focusable &win() { return m_win; }
112 /// @return context focusable for this signal
113 const Focusable &win() const { return m_win; }
114 private:
115 Focusable &m_win; //< the context
116 };
117 103
118 /** 104 /**
119 @name signals 105 @name signals
@@ -126,8 +112,7 @@ public:
126 const TitleSignal &titleSig() const { return m_titlesig; } 112 const TitleSignal &titleSig() const { return m_titlesig; }
127 FbTk::Signal<Focusable&> &focusSig() { return m_focussig; } 113 FbTk::Signal<Focusable&> &focusSig() { return m_focussig; }
128 FbTk::Signal<Focusable&> &dieSig() { return m_diesig; } 114 FbTk::Signal<Focusable&> &dieSig() { return m_diesig; }
129 FbTk::Subject &attentionSig() { return m_attentionsig; } 115 FbTk::Signal<Focusable&> &attentionSig() { return m_attentionsig; }
130 const FbTk::Subject &attentionSig() const { return m_attentionsig; }
131 /** @} */ // end group signals 116 /** @} */ // end group signals
132 117
133 /// Notify any listeners that the focus changed for this window. 118 /// Notify any listeners that the focus changed for this window.
@@ -147,10 +132,9 @@ protected:
147 bool m_attention_state; //< state of icon button while demanding attention 132 bool m_attention_state; //< state of icon button while demanding attention
148 FbTk::PixmapWithMask m_icon; //< icon pixmap with mask 133 FbTk::PixmapWithMask m_icon; //< icon pixmap with mask
149 134
150 // state and hint signals
151 FocusSubject m_attentionsig;
152 135
153private: 136private:
137 FbTk::Signal<Focusable&> m_attentionsig;
154 FbTk::Signal<Focusable&> m_focussig; 138 FbTk::Signal<Focusable&> m_focussig;
155 FbTk::Signal<Focusable&> m_diesig; 139 FbTk::Signal<Focusable&> m_diesig;
156 TitleSignal m_titlesig; 140 TitleSignal m_titlesig;