On Thursday 21 April 2005 19:06, [EMAIL PROTECTED] wrote: [snip]
> The other thing that I noticed about this way of implementing this > is that you are limited to a single instance of a window that can render > HTML. I was starting to create a C++ wrapper class, but found out that the > lines: > > g_signal_connect( G_OBJECT( document ), "request_url", G_CALLBACK( > >khtml::url_requested ), NULL ); > g_signal_connect( G_OBJECT( document ), "link_clicked", G_CALLBACK( > >khtml::link_clicked ), NULL ); > > are proving to be difficult to resolve. How would you connect gtk+ > signals to a C++ class instance? That appears to be the question now, for > me at least. I am not sure I have understood the question but if relates to making the callback aware of the class instance invoking the callback (say the one in whose constructor the call to g_signal_connect() was made) then pass the address of that instance (the this pointer) as the data argument, which is the last argument and is of type void*, thus: g_signal_connect( G_OBJECT( document ), "request_url", G_CALLBACK(>khtml::url_requested ), this ); then gtkhtml::url_requested() would use static_cast<>() to cast its last argument back to a pointer of the relevant type. gtkhtml::url_requested() should have extern "C" linkage (and made a friend if it needs to have access to the class internals), but it looks as if it is a static class member function, which cannot have "C" linkage. Using a static member function will work with some compilers (eg g++) but not with others - it is implementation dependent. Chris. -- Summer is y-cumen in, lhude sing, cuccu! Groweth sed and bloweth med, springeth the wude nu. _______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list