One way of doing this is the following (there may be better ones): Add a
static signal to your class, und connect to that static signal in your
constructor(s). If you want then to sent a signal to all instances, just
trigger the static one ...


antionio



I /think/ I get what you are saying... but doesn't a static signal require
a staic function? And static functions can only work with other static
variables and functions - nothing can happen to specific instances...


Static functions in classes must not acces non-static data, but non-static methods may acces static variables/functions.


And I've not read that signals can propagate to children in libsigc ... It may be easier to maintain a list of pointers somewhere, so I can have direct access...

-Sud.
_______________________________________________


What i mean is something like this:

class Example
{
public:
Example()
{
signalForAllExamples().connect(sigc::mem_fun(*this, &Example::triggerMe));
}
Example(const Example& copyMe) { /* the same like for Example() */ }
void triggerMe() { /* do something */ } static sigc::signal<void> signalForAllExamples() { return sig_forAllExamples_; }


   private:
   static sigc::signal<void> sig_forAllExamples_;
};

A simple Example::signalForAllExamples().emit() should then do what you want ....

antonio


By the way, it would normally be a good idea to derive Example from sigc::trackable, so that the connection is automatically destroyed when an instance of example get's deleted/out of scope. Note that this is not neccesairy for classes derived from gtkmm-classes, as they are allready derived from that class.

antonio
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to