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

Re: more news about a static member func declaration for a signal func



On Mon, 2004-07-05 at 20:34, Michael Torrie wrote:
> On Mon, 2004-07-05 at 19:43, philip dahlquist wrote:
> > well, when i static-ized my signal function, it made it no possible to 
> > any other non-static
> > member functions or non-static data members.  the static declaration
> > solved one problem but created other problems.  are there any other
> > solutions to the signal function declaration problems?
> > should i re-post the code snippet?
> 
> If you're going to us C++, check out the GTK-- C++ bindings for GTK. 
> GTK-- lets you define callbacks to member functions in the same class.  
> 
> Under the hood, though, you'll have to pass a pointer to your class
> (this) as the data parameter to the static method.  If you wish to pass
> other pieces of information, you'll need to make a structure with the
> this pointer plus the extra params you want to send the call-back, and
> pass that to the g_connect call.

I meant to say that under if you stick with the C apis for GTK, you'll
have to pass the class pointer as the data argument to your signal
callback.

If you use gtkmm,  you can do exactly as you want to without any special
"this" passing.

Michael


> 
> Honestly, though, if you're bent on wrapping GTK calls in C++ objects,
> you're far better off using GTK-- which has a really nice object model
> and the signaling interface is really handy, allowing extra arbitrary
> parameters to be passed to a call-back (g_connect only allows one extra
> parameter).  See http://gtkmm.sourceforge.net.
> 
> > 
> > thanks for the help,
> > philip
> > 
> > _______________________________________________
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
-- 
Michael Torrie <torriem chem byu edu>


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