Re: language bindings & Gnome



Andreas Kostyrka wrote:
> 
> On Thu, 2 Jul 1998, Jaka Mocnik wrote:
> 
> > An alternative to subclassing GnomeMDIChild would be to
> > gtk_object_set_data() your own data to instances of GnomeMDIChild
> > objects instead of subclassing the object. This would result in a bit
> > more code when creating new children (you'd have to create a
> > GnomeMDIChild, set its values (name), allocate the structure with your
> > data and then make a gtk_object_set_data() call so that this data could
> > be accessed via the GnomeMDIChild (in callbacks etc.). I haven't tried
> > it out, but I don't see no reason why it shouldn't work - it just seems
> > a bit awkward to me.
> It is done automatically in tomgtk ;)
> tomgtk basically provides a proxy TOM object for everything used in Gtk.
> And it stores the TOM object with set_data. So for example, if
> I somewhere receive an GtkWidget* as an object the signal relaying
> function will either return the correct proxy object, or create a new one
> ;)
just to make sure: I wasn't referring to TOM or other language bindings
only. one could use this with C as well. the only reason I subclassed
GnomeMDIChild in gnome-hello and ghex was that it seemed like a nice way
to get document specific data without having separate document structure
AND a GnomeMDIChild object. I also think that in case of objective-C
bindings subclassing would work as well, but I haven't tried it out -
this is only my impression after looking at gnome-objc source code.
 
> I see two problems perhaps with this TOM-only subclassing:
> -) gtk code sees the wrong class. Not really pleasing to me personally.
> -) Don't know if I can override signal slots that some super class has
>    overriden by a C function (as in gnome-hello-7-mdi).
As far as subclassing GnomeMDIChild is concerned, I explained above what
was the ONLY reason I decided to subclass it. adding a pointer to
GnomeMDIChild to point to document data or gtk_object_set_data()ing this
data would work perfectly as well.
I don't really understand the last one: in case of GnomeMDIChild, you'd
simply gtk_signal_connect() the signals to your newly created
GnomeMDIChild. The default handlers are non-existant anyway.

regards,
	jaKa

-- 
email: jaka.mocnik@kiss.uni-lj.si
w3:    http://www.kiss.uni-lj.si/~k4fe0026



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