[EMAIL PROTECTED] wrote:
Message: 5
Date: Wed, 16 Mar 2005 08:11:06 0100
From: Antonio Coralles <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
> I have a derived widget - derived from an EventBox. It has a funtion"voidnotebook> doShowHidden(bool);". > > There are several instances of these derived widgets on different> pages - so it is not easy to get direct access to them. So is ispossiblecheckbox> that I could call all their doShowHidden(bool) functions with a signal? > They will all be either true or false - whatever the state of the> is. > > So... how could I do that? All the examples of signals I've seen call > functions within the same class. > > -Sud.
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
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list