2 /* This is a generated file, do not edit. Generated from signalproxy.h.m4 */
4 #ifndef _GLIBMM_SIGNALPROXY_H
5 #define _GLIBMM_SIGNALPROXY_H
9 typedef void (*GCallback) (void);
10 typedef struct _GObject GObject;
13 #include <sigc++/sigc++.h>
14 #include <glibmm/signalproxy_connectionnode.h>
20 // Forward declarations
23 #ifndef DOXYGEN_SHOULD_SKIP_THIS
25 struct SignalProxyInfo
27 const char* signal_name;
29 GCallback notify_callback;
32 #endif //DOXYGEN_SHOULD_SKIP_THIS
34 // This base class is used by SignalProxyNormal and SignalProxyProperty.
38 SignalProxyBase(Glib::ObjectBase* obj);
40 #ifndef DOXYGEN_SHOULD_SKIP_THIS
41 static inline sigc::slot_base* data_to_slot(void* data)
43 SignalProxyConnectionNode *const pConnectionNode = static_cast<SignalProxyConnectionNode*>(data);
45 // Return 0 if the connection is blocked.
46 return (!pConnectionNode->slot_.blocked()) ? &pConnectionNode->slot_ : 0;
48 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
54 SignalProxyBase& operator=(const SignalProxyBase&); // not implemented
58 // shared portion of a Signal
59 /** The SignalProxy provides an API similar to sigc::signal that can be used to
60 * connect sigc::slots to glib signals.
62 * This holds the name of the glib signal and the object
63 * which might emit it. Actually, proxies are controlled by
64 * the template derivatives, which serve as gatekeepers for the
65 * types allowed on a particular signal.
68 class SignalProxyNormal : public SignalProxyBase
73 /// stops the current signal emmision (not in libsigc++)
76 #ifndef DOXYGEN_SHOULD_SKIP_THIS
77 // This callback for SignalProxy0<void>
78 // is defined here to avoid code duplication.
79 static void slot0_void_callback(GObject*, void* data);
84 /** Create a proxy for a signal that can be emitted by @a obj.
85 * @param obj The object that can emit the signal.
86 * @param info Information about the signal, including its name, and the C callbacks that should be called by glib.
88 SignalProxyNormal(Glib::ObjectBase* obj, const SignalProxyInfo* info);
90 /** Connects a signal to a generic signal handler. This is called by connect() in derived SignalProxy classes.
92 * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun().
93 * @param after Whether this signal handler should be called before or after the default signal handler.
95 sigc::slot_base& connect_(const sigc::slot_base& slot, bool after);
97 /** Connects a signal to a signal handler without a return value.
98 * This is called by connect() in derived SignalProxy classes.
100 * By default, the signal handler will be called before the default signal handler,
101 * in which case any return value would be replaced anyway by that of the later signal handler.
103 * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun().
104 * @param after Whether this signal handler should be called before or after the default signal handler.
106 sigc::slot_base& connect_notify_(const sigc::slot_base& slot, bool after);
109 const SignalProxyInfo* info_;
111 //TODO: We could maybe replace both connect_ and connect_notify_ with this in future, because they don't do anything extra.
112 /** This is called by connect_ and connect_impl_.
114 sigc::slot_base& connect_impl_(GCallback callback, const sigc::slot_base& slot, bool after);
116 // no copy assignment
117 SignalProxyNormal& operator=(const SignalProxyNormal&);
124 /**** Glib::SignalProxy0 ***************************************************/
126 /** Proxy for signals with 0 arguments.
127 * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() to connect signals to signal handlers.
130 class SignalProxy0 : public SignalProxyNormal
133 typedef sigc::slot<R> SlotType;
134 typedef sigc::slot<void> VoidSlotType;
136 SignalProxy0(ObjectBase* obj, const SignalProxyInfo* info)
137 : SignalProxyNormal(obj, info) {}
139 /** Connects a signal to a signal handler.
140 * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) );
142 * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun().
143 * @param after Whether this signal handler should be called before or after the default signal handler.
145 sigc::connection connect(const SlotType& slot, bool after = true)
146 { return sigc::connection(connect_(slot, after)); }
148 /** Connects a signal to a signal handler without a return value.
149 * By default, the signal handler will be called before the default signal handler,
150 * in which case any return value would be replaced anyway by that of the later signal handler.
152 * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) );
154 * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun().
155 * @param after Whether this signal handler should be called before or after the default signal handler.
157 sigc::connection connect_notify(const VoidSlotType& slot, bool after = false)
158 { return sigc::connection(connect_notify_(slot, after)); }
162 /**** Glib::SignalProxy1 ***************************************************/
164 /** Proxy for signals with 1 arguments.
165 * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() to connect signals to signal handlers.
167 template <class R,class P1>
168 class SignalProxy1 : public SignalProxyNormal
171 typedef sigc::slot<R,P1> SlotType;
172 typedef sigc::slot<void,P1> VoidSlotType;
174 SignalProxy1(ObjectBase* obj, const SignalProxyInfo* info)
175 : SignalProxyNormal(obj, info) {}
177 /** Connects a signal to a signal handler.
178 * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) );
180 * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun().
181 * @param after Whether this signal handler should be called before or after the default signal handler.
183 sigc::connection connect(const SlotType& slot, bool after = true)
184 { return sigc::connection(connect_(slot, after)); }
186 /** Connects a signal to a signal handler without a return value.
187 * By default, the signal handler will be called before the default signal handler,
188 * in which case any return value would be replaced anyway by that of the later signal handler.
190 * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) );
192 * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun().
193 * @param after Whether this signal handler should be called before or after the default signal handler.
195 sigc::connection connect_notify(const VoidSlotType& slot, bool after = false)
196 { return sigc::connection(connect_notify_(slot, after)); }
200 /**** Glib::SignalProxy2 ***************************************************/
202 /** Proxy for signals with 2 arguments.
203 * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() to connect signals to signal handlers.
205 template <class R,class P1,class P2>
206 class SignalProxy2 : public SignalProxyNormal
209 typedef sigc::slot<R,P1,P2> SlotType;
210 typedef sigc::slot<void,P1,P2> VoidSlotType;
212 SignalProxy2(ObjectBase* obj, const SignalProxyInfo* info)
213 : SignalProxyNormal(obj, info) {}
215 /** Connects a signal to a signal handler.
216 * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) );
218 * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun().
219 * @param after Whether this signal handler should be called before or after the default signal handler.
221 sigc::connection connect(const SlotType& slot, bool after = true)
222 { return sigc::connection(connect_(slot, after)); }
224 /** Connects a signal to a signal handler without a return value.
225 * By default, the signal handler will be called before the default signal handler,
226 * in which case any return value would be replaced anyway by that of the later signal handler.
228 * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) );
230 * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun().
231 * @param after Whether this signal handler should be called before or after the default signal handler.
233 sigc::connection connect_notify(const VoidSlotType& slot, bool after = false)
234 { return sigc::connection(connect_notify_(slot, after)); }
238 /**** Glib::SignalProxy3 ***************************************************/
240 /** Proxy for signals with 3 arguments.
241 * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() to connect signals to signal handlers.
243 template <class R,class P1,class P2,class P3>
244 class SignalProxy3 : public SignalProxyNormal
247 typedef sigc::slot<R,P1,P2,P3> SlotType;
248 typedef sigc::slot<void,P1,P2,P3> VoidSlotType;
250 SignalProxy3(ObjectBase* obj, const SignalProxyInfo* info)
251 : SignalProxyNormal(obj, info) {}
253 /** Connects a signal to a signal handler.
254 * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) );
256 * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun().
257 * @param after Whether this signal handler should be called before or after the default signal handler.
259 sigc::connection connect(const SlotType& slot, bool after = true)
260 { return sigc::connection(connect_(slot, after)); }
262 /** Connects a signal to a signal handler without a return value.
263 * By default, the signal handler will be called before the default signal handler,
264 * in which case any return value would be replaced anyway by that of the later signal handler.
266 * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) );
268 * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun().
269 * @param after Whether this signal handler should be called before or after the default signal handler.
271 sigc::connection connect_notify(const VoidSlotType& slot, bool after = false)
272 { return sigc::connection(connect_notify_(slot, after)); }
276 /**** Glib::SignalProxy4 ***************************************************/
278 /** Proxy for signals with 4 arguments.
279 * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() to connect signals to signal handlers.
281 template <class R,class P1,class P2,class P3,class P4>
282 class SignalProxy4 : public SignalProxyNormal
285 typedef sigc::slot<R,P1,P2,P3,P4> SlotType;
286 typedef sigc::slot<void,P1,P2,P3,P4> VoidSlotType;
288 SignalProxy4(ObjectBase* obj, const SignalProxyInfo* info)
289 : SignalProxyNormal(obj, info) {}
291 /** Connects a signal to a signal handler.
292 * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) );
294 * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun().
295 * @param after Whether this signal handler should be called before or after the default signal handler.
297 sigc::connection connect(const SlotType& slot, bool after = true)
298 { return sigc::connection(connect_(slot, after)); }
300 /** Connects a signal to a signal handler without a return value.
301 * By default, the signal handler will be called before the default signal handler,
302 * in which case any return value would be replaced anyway by that of the later signal handler.
304 * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) );
306 * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun().
307 * @param after Whether this signal handler should be called before or after the default signal handler.
309 sigc::connection connect_notify(const VoidSlotType& slot, bool after = false)
310 { return sigc::connection(connect_notify_(slot, after)); }
314 /**** Glib::SignalProxy5 ***************************************************/
316 /** Proxy for signals with 5 arguments.
317 * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() to connect signals to signal handlers.
319 template <class R,class P1,class P2,class P3,class P4,class P5>
320 class SignalProxy5 : public SignalProxyNormal
323 typedef sigc::slot<R,P1,P2,P3,P4,P5> SlotType;
324 typedef sigc::slot<void,P1,P2,P3,P4,P5> VoidSlotType;
326 SignalProxy5(ObjectBase* obj, const SignalProxyInfo* info)
327 : SignalProxyNormal(obj, info) {}
329 /** Connects a signal to a signal handler.
330 * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) );
332 * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun().
333 * @param after Whether this signal handler should be called before or after the default signal handler.
335 sigc::connection connect(const SlotType& slot, bool after = true)
336 { return sigc::connection(connect_(slot, after)); }
338 /** Connects a signal to a signal handler without a return value.
339 * By default, the signal handler will be called before the default signal handler,
340 * in which case any return value would be replaced anyway by that of the later signal handler.
342 * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) );
344 * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun().
345 * @param after Whether this signal handler should be called before or after the default signal handler.
347 sigc::connection connect_notify(const VoidSlotType& slot, bool after = false)
348 { return sigc::connection(connect_notify_(slot, after)); }
352 /**** Glib::SignalProxy6 ***************************************************/
354 /** Proxy for signals with 6 arguments.
355 * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() to connect signals to signal handlers.
357 template <class R,class P1,class P2,class P3,class P4,class P5,class P6>
358 class SignalProxy6 : public SignalProxyNormal
361 typedef sigc::slot<R,P1,P2,P3,P4,P5,P6> SlotType;
362 typedef sigc::slot<void,P1,P2,P3,P4,P5,P6> VoidSlotType;
364 SignalProxy6(ObjectBase* obj, const SignalProxyInfo* info)
365 : SignalProxyNormal(obj, info) {}
367 /** Connects a signal to a signal handler.
368 * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) );
370 * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun().
371 * @param after Whether this signal handler should be called before or after the default signal handler.
373 sigc::connection connect(const SlotType& slot, bool after = true)
374 { return sigc::connection(connect_(slot, after)); }
376 /** Connects a signal to a signal handler without a return value.
377 * By default, the signal handler will be called before the default signal handler,
378 * in which case any return value would be replaced anyway by that of the later signal handler.
380 * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) );
382 * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun().
383 * @param after Whether this signal handler should be called before or after the default signal handler.
385 sigc::connection connect_notify(const VoidSlotType& slot, bool after = false)
386 { return sigc::connection(connect_notify_(slot, after)); }
393 #endif /* _GLIBMM_SIGNALPROXY_H */