Re: [gob-list] Non-built-in GTK_TYPE as argument type?

From: George <jirka_at_5z.com>
Date: Sat, 5 May 2001 15:50:01 -0400

On Thu, Apr 26, 2001 at 11:44:19AM -0400, Christopher Lee wrote:
> [please cc: me since I'm not on this list - Thanks!]

Well, yours was the only gob relevant message on this list the past year I
think, so sorry about not responding right away.

> I'm using gob and also the GtkObject-system for the first time, and I'm
> trying to use them to write a system for representing OpenGL drawings as
> trees of GtkObjects. I want the objects to be able to save themselves
> to and load themselves from an XML file, and I'm doing this by having
> member functions in the parent class scan through the objects arguments
> and saving/loading them according to the argument type. Because
> floating-point vectors are a common type data-type I need to deal with,
> I wrote a XD:Vec GtkObject (XD stands for xml-draw), and would like to
> use this as an argument for objects such as GL:DrawObj:Line.
>
> My problem is that gob doesn't seem to want to let me do this because
> XD:Vec is an 'unknown Gtk+ type'. Is there a way to use a non built-in
> GtkType as an argument in gob? It seems it should be possible to do it
> in the GtkObject system in general (but I've never tried it myself).
> I'd just use GtkObject as the type of argument and do a cast to XD:Vec
> in the settter-function, but then I lose information about what kind of
> object is expected when I load the argument from the XML file.

Yes you have to use the object type. Then use the standard gtk typechecking
cast in the get/setter

> pps. I tried to build my own object system and preprocessor once, and
> got totally bogged down (e.g., it had a built-in real-time garbage
> collector....). I'm really happy to see someone else has done such an
> excellent job!

:)

George
Received on Sat May 05 2001 - 15:50:01 CDT

This archive was generated by hypermail 2.2.0 : Sun Apr 17 2011 - 21:05:02 CDT