Re: [gtkmm] Slots from non-Gtk subclasses.





I have a class that isn't derived from any Gtk classes.  It does,
however, have member functions that will pop up Gtk windows, and
member functions that will handle callbacks from those windows.

The problem is that the "SigC::slot(class, &member)" function seems
to require a class who's derived from Gtk.  I can't get the class to
compile unless I force my class to be a subclass of a Gtk class.
class Foo : public SigC::Object { ... }
Actually,

class Foo : virtual public SigC::Object { ... };

Why this solution was not mentioned yet?
There is a way to connect method of a class that is not derived from SigC::Object. I've read something about "use it on your own risk" earlier, but haven't met any problem with it for now.


#include <sigc++/class_slot.h>

...

<SIGNAL>.connect (SigC::slot_class(<MyClass>, &<MyFunc>));

...





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