Re: Replacing GTypeInterface instances.



On Thu, 2001-11-01 at 23:28, Havoc Pennington wrote:
> 
> murrayc t-online de (Murray Cumming) writes: 
> > *** Similar stuff needed for Interfaces:
> > 
> > We need to be able to replace the GTypeInterface-derived struct (e.g.
> > GtkTreeModelIFace) that was registered in the implementing type (e.g. in
> > gtk_tree_store_get_type()) with a derived GTypeInterface instance, or at
> > least a different instance of the GTypeInterface struct.
> > 
> > We will still need to have access to a copy of the original
> > GTypeInterface so that we can call the original functions if our C++
> > hooks have not been used to override them.
> > 
> > I'm hoping that you can tell me how this might be done.
> 
> It's going to suck. Owen and I discussed it extensively. Unfortunately
> we didn't write any of it down. ;-)
> 
> IIRC the best solution that was reasonably transparent to C++ users
> involved dynamically generating proxy classes for C++ classes based on
> RTTI on the C++ class.

It would be nice to know why this might be necessary. I think that I can
see a way to do it just by replacing the vfunc table (the
GTypeInterface-derived struct instance) with our own.

 i.e. you keep a hash from list of interfaces
> implemented to proxy class, and you yank the right proxy out of your
> hash on object construction. Or something.

Which would also require replacement of the GTypeInterface instance.
That's what I need to know how to do.

 I never actually tried to
> implement it...
> 
> You might be better off just requiring C++ users to put in some funky
> boilerplate, instead of trying to do it magically.

I don't think that it will be possible to make a C++ class implement a
C++/Glib interface just by inheritance. C++ coders will also need to
call
implements_interface(TreeModel::get_sometypething());
in the constructors of their C++ interface-implementing classes.

-- 
Murray Cumming
murrayc usa net
www.murrayc.com




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