aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorHenrik Kinnunen <fluxgen@fluxbox.org>2010-03-18 18:35:19 (GMT)
committerHenrik Kinnunen <fluxgen@fluxbox.org>2010-03-18 18:35:19 (GMT)
commit02bb93590c69b619150735f026f7719df2e5c271 (patch)
treebd1e1d1ca78674ffe57a800fe17aed13f9975b25 /src/FbTk
parent31a458f3657e53b51849111cf5ddc438c7e612a2 (diff)
downloadfluxbox-02bb93590c69b619150735f026f7719df2e5c271.zip
fluxbox-02bb93590c69b619150735f026f7719df2e5c271.tar.bz2
Added FbTk::relaySignal, which relays new signals to old Subject type signals.
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/RelaySignal.hh62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/FbTk/RelaySignal.hh b/src/FbTk/RelaySignal.hh
new file mode 100644
index 0000000..e9b7281
--- /dev/null
+++ b/src/FbTk/RelaySignal.hh
@@ -0,0 +1,62 @@
1// RelaySignal.hh
2// Copyright (c) 2010 Fluxbox Team (fluxgen at fluxbox dot org)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22#ifndef FBTK_RELAY_SIGNAL_HH
23#define FBTK_RELAY_SIGNAL_HH
24
25#include "Signal.hh"
26#include "MemFun.hh"
27#include "Subject.hh"
28
29namespace FbTk {
30
31/**
32 * Relays a new signal type to the old subject type signal. When the new signal
33 * emits the subject notify() will be called.
34 * This function is temporary and just a helper during transition between old
35 * and new signal system.
36 *
37 * @param from The original source of the signal.
38 * @param to_subject The destination Subject.
39 */
40template < typename Signal >
41void relaySignal(Signal& from, FbTk::Subject& to_subject) {
42 from.connect(MemFunIgnoreArgs(to_subject, &FbTk::Subject::notify));
43}
44
45/**
46 * Relays a new signal type to the old subject type signal. When the new signal
47 * emits the subject notify() will be called.
48 * This function is temporary and just a helper during transition between old
49 * and new signal system.
50 *
51 * @param tracker Keeps track of signals
52 * @param from The original source of the signal.
53 * @param to_subject The destination Subject
54 */
55template < typename Signal >
56void relaySignal(SignalTracker& tracker, Signal& from, FbTk::Subject& to_subject) {
57 tracker.join(from, MemFunIgnoreArgs(to_subject, &FbTk::Subject::notify));
58}
59
60} // end namespace FbTk
61
62#endif // FBTK_RELAY_SIGNAL_HH