Re: sigc++ signals and GSignal



Murray Cumming wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi folks,

This is mainly a sigc++ question, but relates to GSignal, so I hope
it's on topic.

With GSignal, you can connect a handler, or override a virtual
function in the object class.  In addition, you can specify whether
the virtual function is run first or last, and then connect signals
to run before /or/ after the signal if it runs last.

With sigc::signal, I can only run signals in the order they were
connected.  I'd like to mimic GSignal, in that I want to provide a
default implementation which may be overridden, but if overridden, I
might not want the default to run at all.  Is this possible?


Not easily. You could connect ane empty virtual member method as a default
handler to your member signal. But making sure that it would be run before
or after other handlers would be difficult. Maybe you could play with the
signal's slot_list<> to change the calling sequence.


i guess that to add an handler after or before you could play with the "after" argument of that Glib::SignalProxyNormal::connect (const sigc::slot_base& slot, bool after) method.

Greeetings,
Luca



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]