diff options
-rw-r--r-- | src/ButtonTheme.hh | 2 | ||||
-rw-r--r-- | src/FbTk/MenuTheme.hh | 2 | ||||
-rw-r--r-- | src/FbTk/Signal.hh | 102 | ||||
-rw-r--r-- | src/FbTk/Slot.hh | 70 | ||||
-rw-r--r-- | src/FbTk/Theme.hh | 6 | ||||
-rw-r--r-- | src/FbWinFrameTheme.hh | 2 | ||||
-rw-r--r-- | src/Focusable.hh | 8 | ||||
-rw-r--r-- | src/FocusableTheme.hh | 10 | ||||
-rw-r--r-- | src/IconbarTheme.hh | 2 | ||||
-rw-r--r-- | src/RootTheme.hh | 2 | ||||
-rw-r--r-- | src/Screen.hh | 6 | ||||
-rw-r--r-- | src/SlitTheme.hh | 2 | ||||
-rw-r--r-- | src/ToolTheme.hh | 2 | ||||
-rw-r--r-- | src/ToolbarTheme.hh | 2 | ||||
-rw-r--r-- | src/WinButtonTheme.hh | 2 | ||||
-rw-r--r-- | src/Workspace.hh | 2 | ||||
-rw-r--r-- | src/WorkspaceNameTheme.hh | 2 | ||||
-rw-r--r-- | src/tests/testSignals.cc | 18 |
18 files changed, 103 insertions, 139 deletions
diff --git a/src/ButtonTheme.hh b/src/ButtonTheme.hh index 77cc159..a293b71 100644 --- a/src/ButtonTheme.hh +++ b/src/ButtonTheme.hh | |||
@@ -43,7 +43,7 @@ public: | |||
43 | int scale() const { return *m_scale; } // scale factor for inside objects | 43 | int scale() const { return *m_scale; } // scale factor for inside objects |
44 | const std::string &name() { return m_name; } | 44 | const std::string &name() { return m_name; } |
45 | 45 | ||
46 | virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } | 46 | virtual FbTk::Signal<> &reconfigSig() { return FbTk::Theme::reconfigSig(); } |
47 | 47 | ||
48 | virtual ButtonTheme &operator *() { return *this; } | 48 | virtual ButtonTheme &operator *() { return *this; } |
49 | virtual const ButtonTheme &operator *() const { return *this; } | 49 | virtual const ButtonTheme &operator *() const { return *this; } |
diff --git a/src/FbTk/MenuTheme.hh b/src/FbTk/MenuTheme.hh index b575860..d39b5df 100644 --- a/src/FbTk/MenuTheme.hh +++ b/src/FbTk/MenuTheme.hh | |||
@@ -130,7 +130,7 @@ public: | |||
130 | m_hl_selected_pixmap->pixmap().dontFree(); | 130 | m_hl_selected_pixmap->pixmap().dontFree(); |
131 | } | 131 | } |
132 | 132 | ||
133 | virtual Signal<void> &reconfigSig() { return Theme::reconfigSig(); } | 133 | virtual Signal<> &reconfigSig() { return Theme::reconfigSig(); } |
134 | 134 | ||
135 | virtual MenuTheme &operator *() { return *this; } | 135 | virtual MenuTheme &operator *() { return *this; } |
136 | virtual const MenuTheme &operator *() const { return *this; } | 136 | virtual const MenuTheme &operator *() const { return *this; } |
diff --git a/src/FbTk/Signal.hh b/src/FbTk/Signal.hh index 432bb3f..a7b91ba 100644 --- a/src/FbTk/Signal.hh +++ b/src/FbTk/Signal.hh | |||
@@ -22,7 +22,6 @@ | |||
22 | #ifndef FBTK_SIGNAL_HH | 22 | #ifndef FBTK_SIGNAL_HH |
23 | #define FBTK_SIGNAL_HH | 23 | #define FBTK_SIGNAL_HH |
24 | 24 | ||
25 | #include "RefCount.hh" | ||
26 | #include "Slot.hh" | 25 | #include "Slot.hh" |
27 | #include <algorithm> | 26 | #include <algorithm> |
28 | #include <list> | 27 | #include <list> |
@@ -35,7 +34,7 @@ namespace FbTk { | |||
35 | namespace SigImpl { | 34 | namespace SigImpl { |
36 | 35 | ||
37 | /** | 36 | /** |
38 | * Parent class for all \c Signal[0...*] classes. | 37 | * Parent class for all \c Signal template classes. |
39 | * It handles the disconnect and holds all the slots. The connect must be | 38 | * It handles the disconnect and holds all the slots. The connect must be |
40 | * handled by the child class so it can do the type checking. | 39 | * handled by the child class so it can do the type checking. |
41 | */ | 40 | */ |
@@ -121,93 +120,66 @@ private: | |||
121 | unsigned m_emitting; | 120 | unsigned m_emitting; |
122 | }; | 121 | }; |
123 | 122 | ||
124 | struct EmptyArg {}; | 123 | template <typename Arg1, typename Arg2, typename Arg3> |
125 | 124 | class SignalTemplate: public SignalHolder { | |
126 | } // namespace SigImpl | ||
127 | |||
128 | |||
129 | /// Specialization for three arguments. | ||
130 | template <typename ReturnType, | ||
131 | typename Arg1 = SigImpl::EmptyArg, typename Arg2 = SigImpl::EmptyArg, typename Arg3 = SigImpl::EmptyArg > | ||
132 | class Signal: public SigImpl::SignalHolder { | ||
133 | public: | 125 | public: |
134 | void emit(Arg1 arg1, Arg2 arg2, Arg3 arg3) { | 126 | template<typename Functor> |
127 | SlotID connect(const Functor& functor) { | ||
128 | return SignalHolder::connect(SlotPtr( new Slot<Arg1, Arg2, Arg3, Functor>(functor) )); | ||
129 | } | ||
130 | |||
131 | protected: | ||
132 | void emit_(Arg1 arg1, Arg2 arg2, Arg3 arg3) { | ||
135 | begin_emitting(); | 133 | begin_emitting(); |
136 | for ( Iterator it = begin(); it != end(); ++it ) { | 134 | for ( Iterator it = begin(); it != end(); ++it ) { |
137 | if(*it) | 135 | if(*it) |
138 | static_cast<SigImpl::SlotBase3<ReturnType, Arg1, Arg2, Arg3> &>(**it)(arg1, arg2, arg3); | 136 | static_cast<SigImpl::SlotTemplate<Arg1, Arg2, Arg3> &>(**it)(arg1, arg2, arg3); |
139 | } | 137 | } |
140 | end_emitting(); | 138 | end_emitting(); |
141 | } | 139 | } |
140 | }; | ||
142 | 141 | ||
143 | template<typename Functor> | 142 | } // namespace SigImpl |
144 | SlotID connect(const Functor& functor) { | 143 | |
145 | return SignalHolder::connect(SlotPtr( | 144 | |
146 | new SigImpl::Slot3<ReturnType, Arg1, Arg2, Arg3, Functor>(functor) | 145 | /// Base template for three arguments. |
147 | )); | 146 | template <typename Arg1 = SigImpl::EmptyArg, typename Arg2 = SigImpl::EmptyArg, typename Arg3 = SigImpl::EmptyArg > |
148 | } | 147 | class Signal: public SigImpl::SignalTemplate<Arg1, Arg2, Arg3> { |
148 | public: | ||
149 | void emit(Arg1 arg1, Arg2 arg2, Arg3 arg3) | ||
150 | { SigImpl::SignalTemplate<Arg1, Arg2, Arg3>::emit_(arg1, arg2, arg3); } | ||
149 | }; | 151 | }; |
150 | 152 | ||
151 | /// Specialization for two arguments. | 153 | /// Specialization for two arguments. |
152 | template <typename ReturnType, typename Arg1, typename Arg2> | 154 | template <typename Arg1, typename Arg2> |
153 | class Signal<ReturnType, Arg1, Arg2, SigImpl::EmptyArg>: public SigImpl::SignalHolder { | 155 | class Signal<Arg1, Arg2, SigImpl::EmptyArg>: |
156 | public SigImpl::SignalTemplate<Arg1, Arg2, SigImpl::EmptyArg> { | ||
154 | public: | 157 | public: |
155 | void emit(Arg1 arg1, Arg2 arg2) { | 158 | void emit(Arg1 arg1, Arg2 arg2) { |
156 | begin_emitting(); | 159 | SigImpl::SignalTemplate<Arg1, Arg2, SigImpl::EmptyArg>:: |
157 | for ( Iterator it = begin(); it != end(); ++it ) { | 160 | emit_(arg1, arg2, SigImpl::EmptyArg()); |
158 | if(*it) | ||
159 | static_cast<SigImpl::SlotBase2<ReturnType, Arg1, Arg2> &>(**it)(arg1, arg2); | ||
160 | } | ||
161 | end_emitting(); | ||
162 | } | ||
163 | |||
164 | template<typename Functor> | ||
165 | SlotID connect(const Functor& functor) { | ||
166 | return SignalHolder::connect(SlotPtr( | ||
167 | new SigImpl::Slot2<ReturnType, Arg1, Arg2, Functor>(functor) | ||
168 | )); | ||
169 | } | 161 | } |
170 | }; | 162 | }; |
171 | 163 | ||
172 | /// Specialization for one argument. | 164 | /// Specialization for one argument. |
173 | template <typename ReturnType, typename Arg1> | 165 | template <typename Arg1> |
174 | class Signal<ReturnType, Arg1, SigImpl::EmptyArg, SigImpl::EmptyArg>: public SigImpl::SignalHolder { | 166 | class Signal<Arg1, SigImpl::EmptyArg, SigImpl::EmptyArg>: |
167 | public SigImpl::SignalTemplate<Arg1, SigImpl::EmptyArg, SigImpl::EmptyArg> { | ||
175 | public: | 168 | public: |
176 | void emit(Arg1 arg) { | 169 | void emit(Arg1 arg1) { |
177 | begin_emitting(); | 170 | SigImpl::SignalTemplate<Arg1, SigImpl::EmptyArg, SigImpl::EmptyArg> |
178 | for ( Iterator it = begin(); it != end(); ++it ) { | 171 | ::emit_(arg1, SigImpl::EmptyArg(), SigImpl::EmptyArg()); |
179 | if(*it) | ||
180 | static_cast<SigImpl::SlotBase1<ReturnType, Arg1> &>(**it)(arg); | ||
181 | } | ||
182 | end_emitting(); | ||
183 | } | ||
184 | |||
185 | template<typename Functor> | ||
186 | SlotID connect(const Functor& functor) { | ||
187 | return SignalHolder::connect(SlotPtr( | ||
188 | new SigImpl::Slot1<ReturnType, Arg1, Functor>(functor) | ||
189 | )); | ||
190 | } | 172 | } |
191 | }; | 173 | }; |
192 | 174 | ||
193 | /// Specialization for no arguments. | 175 | /// Specialization for no arguments. |
194 | template <typename ReturnType> | 176 | template <> |
195 | class Signal<ReturnType, SigImpl::EmptyArg, SigImpl::EmptyArg, SigImpl::EmptyArg>: public SigImpl::SignalHolder { | 177 | class Signal<SigImpl::EmptyArg, SigImpl::EmptyArg, SigImpl::EmptyArg>: |
178 | public SigImpl::SignalTemplate<SigImpl::EmptyArg, SigImpl::EmptyArg, SigImpl::EmptyArg> { | ||
196 | public: | 179 | public: |
197 | void emit() { | 180 | void emit() { |
198 | begin_emitting(); | 181 | SigImpl::SignalTemplate<SigImpl::EmptyArg, SigImpl::EmptyArg, SigImpl::EmptyArg> |
199 | for ( Iterator it = begin(); it != end(); ++it ) { | 182 | ::emit_(SigImpl::EmptyArg(), SigImpl::EmptyArg(), SigImpl::EmptyArg()); |
200 | if(*it) | ||
201 | static_cast<SigImpl::SlotBase0<ReturnType> &>(**it)(); | ||
202 | } | ||
203 | end_emitting(); | ||
204 | } | ||
205 | |||
206 | template<typename Functor> | ||
207 | SlotID connect(const Functor& functor) { | ||
208 | return SignalHolder::connect(SlotPtr( | ||
209 | new SigImpl::Slot0<ReturnType, Functor>(functor) | ||
210 | )); | ||
211 | } | 183 | } |
212 | }; | 184 | }; |
213 | 185 | ||
diff --git a/src/FbTk/Slot.hh b/src/FbTk/Slot.hh index 3daca4e..ea7ee2f 100644 --- a/src/FbTk/Slot.hh +++ b/src/FbTk/Slot.hh | |||
@@ -22,81 +22,72 @@ | |||
22 | #ifndef FBTK_SLOT_HH | 22 | #ifndef FBTK_SLOT_HH |
23 | #define FBTK_SLOT_HH | 23 | #define FBTK_SLOT_HH |
24 | 24 | ||
25 | #include "RefCount.hh" | ||
26 | |||
25 | namespace FbTk { | 27 | namespace FbTk { |
26 | 28 | ||
27 | /// \namespace Implementation details for signals, do not use anything in this namespace | 29 | /// \namespace Implementation details for signals, do not use anything in this namespace |
28 | namespace SigImpl { | 30 | namespace SigImpl { |
29 | 31 | ||
32 | struct EmptyArg {}; | ||
33 | |||
30 | class SlotBase { | 34 | class SlotBase { |
31 | public: | 35 | public: |
32 | virtual ~SlotBase() {} | 36 | virtual ~SlotBase() {} |
33 | }; | 37 | }; |
34 | 38 | ||
35 | template<typename ReturnType> | 39 | template<typename Arg1, typename Arg2, typename Arg3> |
36 | class SlotBase0: public SlotBase { | 40 | class SlotTemplate: public SlotBase { |
37 | public: | 41 | public: |
38 | virtual ReturnType operator()() = 0; | 42 | virtual void operator()(Arg1, Arg2, Arg3) = 0; |
39 | }; | 43 | }; |
40 | 44 | ||
41 | template<typename ReturnType, typename Functor> | 45 | template<typename Arg1, typename Arg2, typename Arg3, typename Functor> |
42 | class Slot0: public SlotBase0<ReturnType> { | 46 | class Slot: public SlotTemplate<Arg1, Arg2, Arg3> { |
43 | public: | 47 | public: |
44 | virtual ReturnType operator()() { return m_functor(); } | 48 | virtual void operator()(Arg1 arg1, Arg2 arg2, Arg3 arg3) |
49 | { m_functor(arg1, arg2, arg3); } | ||
45 | 50 | ||
46 | Slot0(Functor functor) : m_functor(functor) {} | 51 | Slot(Functor functor) : m_functor(functor) {} |
47 | 52 | ||
48 | private: | 53 | private: |
49 | Functor m_functor; | 54 | Functor m_functor; |
50 | }; | 55 | }; |
51 | 56 | ||
52 | template<typename ReturnType, typename Arg1> | 57 | // specialization for two arguments |
53 | class SlotBase1: public SlotBase { | 58 | template<typename Arg1, typename Arg2, typename Functor> |
54 | public: | 59 | class Slot<Arg1, Arg2, EmptyArg, Functor>: public SlotTemplate<Arg1, Arg2, EmptyArg> { |
55 | virtual ReturnType operator()(Arg1) = 0; | ||
56 | }; | ||
57 | |||
58 | template<typename ReturnType, typename Arg1, typename Functor> | ||
59 | class Slot1: public SlotBase1<ReturnType, Arg1> { | ||
60 | public: | 60 | public: |
61 | virtual ReturnType operator()(Arg1 arg1) { return m_functor(arg1); } | 61 | virtual void operator()(Arg1 arg1, Arg2 arg2, EmptyArg) |
62 | { m_functor(arg1, arg2); } | ||
62 | 63 | ||
63 | Slot1(Functor functor) : m_functor(functor) {} | 64 | Slot(Functor functor) : m_functor(functor) {} |
64 | 65 | ||
65 | private: | 66 | private: |
66 | Functor m_functor; | 67 | Functor m_functor; |
67 | }; | 68 | }; |
68 | 69 | ||
69 | template<typename ReturnType, typename Arg1, typename Arg2> | 70 | // specialization for one argument |
70 | class SlotBase2: public SlotBase { | 71 | template<typename Arg1, typename Functor> |
71 | public: | 72 | class Slot<Arg1, EmptyArg, EmptyArg, Functor>: public SlotTemplate<Arg1, EmptyArg, EmptyArg> { |
72 | virtual ReturnType operator()(Arg1, Arg2) = 0; | ||
73 | }; | ||
74 | |||
75 | template<typename ReturnType, typename Arg1, typename Arg2, typename Functor> | ||
76 | class Slot2: public SlotBase2<ReturnType, Arg1, Arg2> { | ||
77 | public: | 73 | public: |
78 | virtual ReturnType operator()(Arg1 arg1, Arg2 arg2) { return m_functor(arg1, arg2); } | 74 | virtual void operator()(Arg1 arg1, EmptyArg, EmptyArg) |
75 | { m_functor(arg1); } | ||
79 | 76 | ||
80 | Slot2(Functor functor) : m_functor(functor) {} | 77 | Slot(Functor functor) : m_functor(functor) {} |
81 | 78 | ||
82 | private: | 79 | private: |
83 | Functor m_functor; | 80 | Functor m_functor; |
84 | }; | 81 | }; |
85 | 82 | ||
86 | template<typename ReturnType, typename Arg1, typename Arg2, typename Arg3> | 83 | // specialization for no arguments |
87 | class SlotBase3: public SlotBase { | 84 | template<typename Functor> |
88 | public: | 85 | class Slot<EmptyArg, EmptyArg, EmptyArg, Functor>: public SlotTemplate<EmptyArg, EmptyArg, EmptyArg> { |
89 | virtual ReturnType operator()(Arg1, Arg2, Arg3) = 0; | ||
90 | virtual ~SlotBase3() {} | ||
91 | }; | ||
92 | |||
93 | template<typename ReturnType, typename Arg1, typename Arg2, typename Arg3, typename Functor> | ||
94 | class Slot3: public SlotBase3<ReturnType, Arg1, Arg2, Arg3> { | ||
95 | public: | 86 | public: |
96 | virtual ReturnType operator()(Arg1 arg1, Arg2 arg2, Arg3 arg3) | 87 | virtual void operator()(EmptyArg, EmptyArg, EmptyArg) |
97 | { return m_functor(arg1, arg2, arg3); } | 88 | { m_functor(); } |
98 | 89 | ||
99 | Slot3(Functor functor) : m_functor(functor) {} | 90 | Slot(Functor functor) : m_functor(functor) {} |
100 | 91 | ||
101 | private: | 92 | private: |
102 | Functor m_functor; | 93 | Functor m_functor; |
@@ -106,4 +97,5 @@ private: | |||
106 | 97 | ||
107 | } // namespace FbTk | 98 | } // namespace FbTk |
108 | 99 | ||
100 | |||
109 | #endif // FBTK_SLOT_H | 101 | #endif // FBTK_SLOT_H |
diff --git a/src/FbTk/Theme.hh b/src/FbTk/Theme.hh index c700f9b..a0f2717 100644 --- a/src/FbTk/Theme.hh +++ b/src/FbTk/Theme.hh | |||
@@ -107,13 +107,13 @@ public: | |||
107 | template <typename T> | 107 | template <typename T> |
108 | void remove(ThemeItem<T> &item); | 108 | void remove(ThemeItem<T> &item); |
109 | virtual bool fallback(ThemeItem_base &) { return false; } | 109 | virtual bool fallback(ThemeItem_base &) { return false; } |
110 | Signal<void> &reconfigSig() { return m_reconfig_sig; } | 110 | Signal<> &reconfigSig() { return m_reconfig_sig; } |
111 | 111 | ||
112 | private: | 112 | private: |
113 | const int m_screen_num; | 113 | const int m_screen_num; |
114 | 114 | ||
115 | ItemList m_themeitems; | 115 | ItemList m_themeitems; |
116 | Signal<void> m_reconfig_sig; | 116 | Signal<> m_reconfig_sig; |
117 | }; | 117 | }; |
118 | 118 | ||
119 | /// Proxy interface for themes, so they can be substituted dynamically | 119 | /// Proxy interface for themes, so they can be substituted dynamically |
@@ -122,7 +122,7 @@ class ThemeProxy { | |||
122 | public: | 122 | public: |
123 | virtual ~ThemeProxy() { } | 123 | virtual ~ThemeProxy() { } |
124 | 124 | ||
125 | virtual Signal<void> &reconfigSig() = 0; | 125 | virtual Signal<> &reconfigSig() = 0; |
126 | 126 | ||
127 | virtual BaseTheme &operator *() = 0; | 127 | virtual BaseTheme &operator *() = 0; |
128 | virtual const BaseTheme &operator *() const = 0; | 128 | virtual const BaseTheme &operator *() const = 0; |
diff --git a/src/FbWinFrameTheme.hh b/src/FbWinFrameTheme.hh index 613c66a..8e7274c 100644 --- a/src/FbWinFrameTheme.hh +++ b/src/FbWinFrameTheme.hh | |||
@@ -79,7 +79,7 @@ public: | |||
79 | 79 | ||
80 | IconbarTheme &iconbarTheme() { return m_iconbar_theme; } | 80 | IconbarTheme &iconbarTheme() { return m_iconbar_theme; } |
81 | 81 | ||
82 | virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } | 82 | virtual FbTk::Signal<> &reconfigSig() { return FbTk::Theme::reconfigSig(); } |
83 | 83 | ||
84 | virtual FbWinFrameTheme &operator *() { return *this; } | 84 | virtual FbWinFrameTheme &operator *() { return *this; } |
85 | virtual const FbWinFrameTheme &operator *() const { return *this; } | 85 | virtual const FbWinFrameTheme &operator *() const { return *this; } |
diff --git a/src/Focusable.hh b/src/Focusable.hh index 0aae1a4..72a1dcc 100644 --- a/src/Focusable.hh +++ b/src/Focusable.hh | |||
@@ -119,13 +119,13 @@ public: | |||
119 | @name signals | 119 | @name signals |
120 | @{ | 120 | @{ |
121 | */ | 121 | */ |
122 | typedef FbTk::Signal<void, const std::string&, Focusable&> TitleSignal; | 122 | typedef FbTk::Signal<const std::string&, Focusable&> TitleSignal; |
123 | /// Used for both title and icon changes. | 123 | /// Used for both title and icon changes. |
124 | TitleSignal &titleSig() { return m_titlesig; } | 124 | TitleSignal &titleSig() { return m_titlesig; } |
125 | /// Used for both title and icon changes. | 125 | /// Used for both title and icon changes. |
126 | const TitleSignal &titleSig() const { return m_titlesig; } | 126 | const TitleSignal &titleSig() const { return m_titlesig; } |
127 | FbTk::Signal<void, Focusable&> &focusSig() { return m_focussig; } | 127 | FbTk::Signal<Focusable&> &focusSig() { return m_focussig; } |
128 | const FbTk::Signal<void, Focusable&> &focusSig() const { return m_focussig; } | 128 | const FbTk::Signal<Focusable&> &focusSig() const { return m_focussig; } |
129 | FbTk::Subject &dieSig() { return m_diesig; } | 129 | FbTk::Subject &dieSig() { return m_diesig; } |
130 | const FbTk::Subject &dieSig() const { return m_diesig; } | 130 | const FbTk::Subject &dieSig() const { return m_diesig; } |
131 | FbTk::Subject &attentionSig() { return m_attentionsig; } | 131 | FbTk::Subject &attentionSig() { return m_attentionsig; } |
@@ -153,7 +153,7 @@ protected: | |||
153 | FocusSubject m_diesig, m_attentionsig; | 153 | FocusSubject m_diesig, m_attentionsig; |
154 | 154 | ||
155 | private: | 155 | private: |
156 | FbTk::Signal<void, Focusable&> m_focussig; | 156 | FbTk::Signal<Focusable&> m_focussig; |
157 | TitleSignal m_titlesig; | 157 | TitleSignal m_titlesig; |
158 | }; | 158 | }; |
159 | 159 | ||
diff --git a/src/FocusableTheme.hh b/src/FocusableTheme.hh index 6643b43..d379c15 100644 --- a/src/FocusableTheme.hh +++ b/src/FocusableTheme.hh | |||
@@ -36,13 +36,13 @@ public: | |||
36 | m_win(win), m_focused_theme(focused), m_unfocused_theme(unfocused) { | 36 | m_win(win), m_focused_theme(focused), m_unfocused_theme(unfocused) { |
37 | 37 | ||
38 | m_signals.join(m_win.focusSig(), | 38 | m_signals.join(m_win.focusSig(), |
39 | FbTk::MemFunIgnoreArgs(m_reconfig_sig, &FbTk::Signal<void>::emit)); | 39 | FbTk::MemFunIgnoreArgs(m_reconfig_sig, &FbTk::Signal<>::emit)); |
40 | 40 | ||
41 | m_win.attentionSig().attach(this); | 41 | m_win.attentionSig().attach(this); |
42 | m_signals.join(m_focused_theme.reconfigSig(), | 42 | m_signals.join(m_focused_theme.reconfigSig(), |
43 | FbTk::MemFun(m_reconfig_sig, &FbTk::Signal<void>::emit)); | 43 | FbTk::MemFun(m_reconfig_sig, &FbTk::Signal<>::emit)); |
44 | m_signals.join(m_unfocused_theme.reconfigSig(), | 44 | m_signals.join(m_unfocused_theme.reconfigSig(), |
45 | FbTk::MemFun(m_reconfig_sig, &FbTk::Signal<void>::emit)); | 45 | FbTk::MemFun(m_reconfig_sig, &FbTk::Signal<>::emit)); |
46 | } | 46 | } |
47 | 47 | ||
48 | Focusable &win() { return m_win; } | 48 | Focusable &win() { return m_win; } |
@@ -54,7 +54,7 @@ public: | |||
54 | FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() { return m_unfocused_theme; } | 54 | FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() { return m_unfocused_theme; } |
55 | const FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() const { return m_unfocused_theme; } | 55 | const FbTk::ThemeProxy<BaseTheme> &unfocusedTheme() const { return m_unfocused_theme; } |
56 | 56 | ||
57 | FbTk::Signal<void> &reconfigSig() { return m_reconfig_sig; } | 57 | FbTk::Signal<> &reconfigSig() { return m_reconfig_sig; } |
58 | 58 | ||
59 | virtual BaseTheme &operator *() { | 59 | virtual BaseTheme &operator *() { |
60 | return (m_win.isFocused() || m_win.getAttentionState()) ? | 60 | return (m_win.isFocused() || m_win.getAttentionState()) ? |
@@ -70,7 +70,7 @@ private: | |||
70 | 70 | ||
71 | Focusable &m_win; | 71 | Focusable &m_win; |
72 | FbTk::ThemeProxy<BaseTheme> &m_focused_theme, &m_unfocused_theme; | 72 | FbTk::ThemeProxy<BaseTheme> &m_focused_theme, &m_unfocused_theme; |
73 | FbTk::Signal<void> m_reconfig_sig; | 73 | FbTk::Signal<> m_reconfig_sig; |
74 | FbTk::SignalTracker m_signals; | 74 | FbTk::SignalTracker m_signals; |
75 | }; | 75 | }; |
76 | 76 | ||
diff --git a/src/IconbarTheme.hh b/src/IconbarTheme.hh index f43a915..734e008 100644 --- a/src/IconbarTheme.hh +++ b/src/IconbarTheme.hh | |||
@@ -41,7 +41,7 @@ public: | |||
41 | const FbTk::Texture &texture() const { return *m_texture; } | 41 | const FbTk::Texture &texture() const { return *m_texture; } |
42 | const FbTk::Texture &emptyTexture() const { return *m_empty_texture; } | 42 | const FbTk::Texture &emptyTexture() const { return *m_empty_texture; } |
43 | 43 | ||
44 | virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } | 44 | virtual FbTk::Signal<> &reconfigSig() { return FbTk::Theme::reconfigSig(); } |
45 | 45 | ||
46 | virtual IconbarTheme &operator *() { return *this; } | 46 | virtual IconbarTheme &operator *() { return *this; } |
47 | virtual const IconbarTheme &operator *() const { return *this; } | 47 | virtual const IconbarTheme &operator *() const { return *this; } |
diff --git a/src/RootTheme.hh b/src/RootTheme.hh index 6485448..f39c264 100644 --- a/src/RootTheme.hh +++ b/src/RootTheme.hh | |||
@@ -48,7 +48,7 @@ public: | |||
48 | 48 | ||
49 | GC opGC() const { return m_opgc.gc(); } | 49 | GC opGC() const { return m_opgc.gc(); } |
50 | 50 | ||
51 | virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } | 51 | virtual FbTk::Signal<> &reconfigSig() { return FbTk::Theme::reconfigSig(); } |
52 | 52 | ||
53 | virtual RootTheme &operator *() { return *this; } | 53 | virtual RootTheme &operator *() { return *this; } |
54 | virtual const RootTheme &operator *() const { return *this; } | 54 | virtual const RootTheme &operator *() const { return *this; } |
diff --git a/src/Screen.hh b/src/Screen.hh index 4d1d933..96a4d43 100644 --- a/src/Screen.hh +++ b/src/Screen.hh | |||
@@ -197,7 +197,7 @@ public: | |||
197 | @name Screen signals | 197 | @name Screen signals |
198 | */ | 198 | */ |
199 | //@{ | 199 | //@{ |
200 | typedef FbTk::Signal<void, BScreen&> ScreenSignal; | 200 | typedef FbTk::Signal<BScreen&> ScreenSignal; |
201 | /// client list signal | 201 | /// client list signal |
202 | ScreenSignal &clientListSig() { return m_clientlist_sig; } | 202 | ScreenSignal &clientListSig() { return m_clientlist_sig; } |
203 | /// icon list sig | 203 | /// icon list sig |
@@ -211,7 +211,7 @@ public: | |||
211 | /// current workspace signal | 211 | /// current workspace signal |
212 | ScreenSignal ¤tWorkspaceSig() { return m_currentworkspace_sig; } | 212 | ScreenSignal ¤tWorkspaceSig() { return m_currentworkspace_sig; } |
213 | /// focused window signal | 213 | /// focused window signal |
214 | FbTk::Signal<void, BScreen&, FluxboxWindow*, WinClient*> &focusedWindowSig() { return m_focusedwindow_sig; } | 214 | FbTk::Signal<BScreen&, FluxboxWindow*, WinClient*> &focusedWindowSig() { return m_focusedwindow_sig; } |
215 | /// reconfigure signal | 215 | /// reconfigure signal |
216 | FbTk::Subject &reconfigureSig() { return m_reconfigure_sig; } | 216 | FbTk::Subject &reconfigureSig() { return m_reconfigure_sig; } |
217 | ScreenSignal &resizeSig() { return m_resize_sig; } | 217 | ScreenSignal &resizeSig() { return m_resize_sig; } |
@@ -479,7 +479,7 @@ private: | |||
479 | ScreenSubject m_reconfigure_sig; ///< reconfigure signal | 479 | ScreenSubject m_reconfigure_sig; ///< reconfigure signal |
480 | 480 | ||
481 | 481 | ||
482 | FbTk::Signal<void, BScreen&, FluxboxWindow*, WinClient*> m_focusedwindow_sig; ///< focused window signal | 482 | FbTk::Signal<BScreen&, FluxboxWindow*, WinClient*> m_focusedwindow_sig; ///< focused window signal |
483 | ScreenSignal m_resize_sig; ///< resize signal | 483 | ScreenSignal m_resize_sig; ///< resize signal |
484 | ScreenSignal m_workspace_area_sig; ///< workspace area changed signal | 484 | ScreenSignal m_workspace_area_sig; ///< workspace area changed signal |
485 | ScreenSignal m_iconlist_sig; ///< notify if a window gets iconified/deiconified | 485 | ScreenSignal m_iconlist_sig; ///< notify if a window gets iconified/deiconified |
diff --git a/src/SlitTheme.hh b/src/SlitTheme.hh index 5a1b9d1..86dd498 100644 --- a/src/SlitTheme.hh +++ b/src/SlitTheme.hh | |||
@@ -38,7 +38,7 @@ public: | |||
38 | int borderWidth() const { return *m_border_width; } | 38 | int borderWidth() const { return *m_border_width; } |
39 | int bevelWidth() const { return *m_bevel_width; } | 39 | int bevelWidth() const { return *m_bevel_width; } |
40 | 40 | ||
41 | virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } | 41 | virtual FbTk::Signal<> &reconfigSig() { return FbTk::Theme::reconfigSig(); } |
42 | 42 | ||
43 | virtual SlitTheme &operator *() { return *this; } | 43 | virtual SlitTheme &operator *() { return *this; } |
44 | virtual const SlitTheme &operator *() const { return *this; } | 44 | virtual const SlitTheme &operator *() const { return *this; } |
diff --git a/src/ToolTheme.hh b/src/ToolTheme.hh index 8daad7d..5c2352d 100644 --- a/src/ToolTheme.hh +++ b/src/ToolTheme.hh | |||
@@ -43,7 +43,7 @@ public: | |||
43 | int alpha() const { return m_alpha; } | 43 | int alpha() const { return m_alpha; } |
44 | void setAlpha(int alpha) { m_alpha = alpha; } | 44 | void setAlpha(int alpha) { m_alpha = alpha; } |
45 | 45 | ||
46 | virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } | 46 | virtual FbTk::Signal<> &reconfigSig() { return FbTk::Theme::reconfigSig(); } |
47 | 47 | ||
48 | virtual ToolTheme &operator *() { return *this; } | 48 | virtual ToolTheme &operator *() { return *this; } |
49 | virtual const ToolTheme &operator *() const { return *this; } | 49 | virtual const ToolTheme &operator *() const { return *this; } |
diff --git a/src/ToolbarTheme.hh b/src/ToolbarTheme.hh index dbb6786..853ea70 100644 --- a/src/ToolbarTheme.hh +++ b/src/ToolbarTheme.hh | |||
@@ -44,7 +44,7 @@ public: | |||
44 | int height() const { return *m_height; } | 44 | int height() const { return *m_height; } |
45 | int buttonSize() const { return *m_button_size; } | 45 | int buttonSize() const { return *m_button_size; } |
46 | 46 | ||
47 | virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } | 47 | virtual FbTk::Signal<> &reconfigSig() { return FbTk::Theme::reconfigSig(); } |
48 | 48 | ||
49 | virtual ToolbarTheme &operator *() { return *this; } | 49 | virtual ToolbarTheme &operator *() { return *this; } |
50 | virtual const ToolbarTheme &operator *() const { return *this; } | 50 | virtual const ToolbarTheme &operator *() const { return *this; } |
diff --git a/src/WinButtonTheme.hh b/src/WinButtonTheme.hh index f7f2337..4765822 100644 --- a/src/WinButtonTheme.hh +++ b/src/WinButtonTheme.hh | |||
@@ -65,7 +65,7 @@ public: | |||
65 | FbTk::PixmapWithMask &titlePixmap() { return *m_title_pm; } | 65 | FbTk::PixmapWithMask &titlePixmap() { return *m_title_pm; } |
66 | const FbTk::PixmapWithMask &titlePixmap() const { return *m_title_pm; } | 66 | const FbTk::PixmapWithMask &titlePixmap() const { return *m_title_pm; } |
67 | 67 | ||
68 | virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } | 68 | virtual FbTk::Signal<> &reconfigSig() { return FbTk::Theme::reconfigSig(); } |
69 | 69 | ||
70 | virtual WinButtonTheme &operator *() { return *this; } | 70 | virtual WinButtonTheme &operator *() { return *this; } |
71 | virtual const WinButtonTheme &operator *() const { return *this; } | 71 | virtual const WinButtonTheme &operator *() const { return *this; } |
diff --git a/src/Workspace.hh b/src/Workspace.hh index b62a400..2dabb3e 100644 --- a/src/Workspace.hh +++ b/src/Workspace.hh | |||
@@ -85,7 +85,7 @@ private: | |||
85 | BScreen &m_screen; | 85 | BScreen &m_screen; |
86 | 86 | ||
87 | Windows m_windowlist; | 87 | Windows m_windowlist; |
88 | FbTk::Signal<void> m_clientlist_sig; | 88 | FbTk::Signal<> m_clientlist_sig; |
89 | ClientMenu m_clientmenu; | 89 | ClientMenu m_clientmenu; |
90 | 90 | ||
91 | FbTk::FbString m_name; ///< name of this workspace | 91 | FbTk::FbString m_name; ///< name of this workspace |
diff --git a/src/WorkspaceNameTheme.hh b/src/WorkspaceNameTheme.hh index 0096682..83cf124 100644 --- a/src/WorkspaceNameTheme.hh +++ b/src/WorkspaceNameTheme.hh | |||
@@ -49,7 +49,7 @@ public: | |||
49 | return ToolTheme::fallback(item); | 49 | return ToolTheme::fallback(item); |
50 | } | 50 | } |
51 | 51 | ||
52 | virtual FbTk::Signal<void> &reconfigSig() { return FbTk::Theme::reconfigSig(); } | 52 | virtual FbTk::Signal<> &reconfigSig() { return FbTk::Theme::reconfigSig(); } |
53 | 53 | ||
54 | virtual WorkspaceNameTheme &operator *() { return *this; } | 54 | virtual WorkspaceNameTheme &operator *() { return *this; } |
55 | virtual const WorkspaceNameTheme &operator *() const { return *this; } | 55 | virtual const WorkspaceNameTheme &operator *() const { return *this; } |
diff --git a/src/tests/testSignals.cc b/src/tests/testSignals.cc index 75f046e..9b9d151 100644 --- a/src/tests/testSignals.cc +++ b/src/tests/testSignals.cc | |||
@@ -80,16 +80,16 @@ int main() { | |||
80 | using FbTk::Signal; | 80 | using FbTk::Signal; |
81 | using FbTk::SignalTracker; | 81 | using FbTk::SignalTracker; |
82 | 82 | ||
83 | Signal<void> no_arg; | 83 | Signal<> no_arg; |
84 | no_arg.connect( NoArgument() ); | 84 | no_arg.connect( NoArgument() ); |
85 | 85 | ||
86 | Signal<void, int> one_arg; | 86 | Signal<int> one_arg; |
87 | one_arg.connect( OneArgument() ); | 87 | one_arg.connect( OneArgument() ); |
88 | 88 | ||
89 | Signal<void, int, const string&> two_args; | 89 | Signal<int, const string&> two_args; |
90 | two_args.connect( TwoArguments() ); | 90 | two_args.connect( TwoArguments() ); |
91 | 91 | ||
92 | Signal<void, int, const string&, double> three_args; | 92 | Signal<int, const string&, double> three_args; |
93 | three_args.connect( ThreeArguments() ); | 93 | three_args.connect( ThreeArguments() ); |
94 | 94 | ||
95 | // emit test | 95 | // emit test |
@@ -127,7 +127,7 @@ int main() { | |||
127 | no_arg.emit(); | 127 | no_arg.emit(); |
128 | 128 | ||
129 | string takeThis("Take this"); | 129 | string takeThis("Take this"); |
130 | Signal<void, string&> ref_arg; | 130 | Signal<string&> ref_arg; |
131 | ref_arg.connect(MemFun(obj, &FunctionClass::takeIt)); | 131 | ref_arg.connect(MemFun(obj, &FunctionClass::takeIt)); |
132 | ref_arg.emit( takeThis ); | 132 | ref_arg.emit( takeThis ); |
133 | 133 | ||
@@ -145,7 +145,7 @@ int main() { | |||
145 | using FbTk::MemFunIgnoreArgs; | 145 | using FbTk::MemFunIgnoreArgs; |
146 | // Create a signal that emits with three arguments, and connect | 146 | // Create a signal that emits with three arguments, and connect |
147 | // sinks that takes less than three arguments. | 147 | // sinks that takes less than three arguments. |
148 | Signal<void, string, string, float> more_args; | 148 | Signal<string, string, float> more_args; |
149 | more_args.connect(MemFunIgnoreArgs(obj, &FunctionClass::print)); | 149 | more_args.connect(MemFunIgnoreArgs(obj, &FunctionClass::print)); |
150 | more_args.connect(MemFunIgnoreArgs(obj, &FunctionClass::takeIt)); | 150 | more_args.connect(MemFunIgnoreArgs(obj, &FunctionClass::takeIt)); |
151 | more_args.connect(MemFunIgnoreArgs(obj, &FunctionClass::showMessage2)); | 151 | more_args.connect(MemFunIgnoreArgs(obj, &FunctionClass::showMessage2)); |
@@ -168,7 +168,7 @@ int main() { | |||
168 | destination.attach(&obs); | 168 | destination.attach(&obs); |
169 | // create a new signal and relay it to the | 169 | // create a new signal and relay it to the |
170 | // old subject | 170 | // old subject |
171 | FbTk::Signal<void, string> source; | 171 | FbTk::Signal<string> source; |
172 | FbTk::relaySignal(source, destination); | 172 | FbTk::relaySignal(source, destination); |
173 | // the new signal should now make the old | 173 | // the new signal should now make the old |
174 | // subject notify its observers | 174 | // subject notify its observers |
@@ -178,7 +178,7 @@ int main() { | |||
178 | // Test argument selector | 178 | // Test argument selector |
179 | { | 179 | { |
180 | using namespace FbTk; | 180 | using namespace FbTk; |
181 | Signal<void, int, string, float> source; | 181 | Signal<int, string, float> source; |
182 | 182 | ||
183 | Printer printer; | 183 | Printer printer; |
184 | source.connect(MemFunSelectArg0(printer, &Printer::printInt)); | 184 | source.connect(MemFunSelectArg0(printer, &Printer::printInt)); |
@@ -187,7 +187,7 @@ int main() { | |||
187 | 187 | ||
188 | source.emit(10, "hello", 3.141592); | 188 | source.emit(10, "hello", 3.141592); |
189 | 189 | ||
190 | Signal<void, string, int> source2; | 190 | Signal<string, int> source2; |
191 | source2.connect(MemFunSelectArg0(printer, &Printer::printString)); | 191 | source2.connect(MemFunSelectArg0(printer, &Printer::printString)); |
192 | source2.connect(MemFunSelectArg1(printer, &Printer::printInt)); | 192 | source2.connect(MemFunSelectArg1(printer, &Printer::printInt)); |
193 | source2.emit("world", 37); | 193 | source2.emit("world", 37); |