Next: , Previous: Introduction, Up: GObject Reference


4.2 GType designator

GObject is an object system based on GType type system. Types in it are identified by an integer value of type GType. In cl-gtk2-gobject, types are identified by GType designator structures. GType designator is a structure identifying a particular GType; it contains its name and integer value.

GType designators are singleton structures meaning that for every GType, there may be only one GType designator structure for it; this means that two GType designators are equal (with respect to the COMMON-LISP:EQ function) if and only if their corresponding GTypes are the same.

GType designators remain the same (with respect to the COMMON-LISP:EQ function) even after dumping and restarting Lisp memory image.

GType designators are obtained with gtype function, and corresponding numeric and string values are accessed via gtype-id and gtype-name functions (you must not access gtype structure directly). If an attempt is made to obtain an invalid GType, then a warning is signalled but GType designator is still returned (which may become valid at some later time due to e.g. library being initialized).

Some of the types are fundamental and have constant integer values. They are identified by constants (strings in parentheses are corresponding type names):

     (gtype "GObject") => #S(GTYPE :NAME "GObject" :%ID 80)
     (gtype-id (gtype "GObject")) => 80
     (gtype-name (gtype "GObject")) => "GObject"
     (gtype "GtkWidget") => #S(GTYPE :NAME "GtkWidget" :%ID 6963568)