Typo.
[cl-gtk2.git] / glib / gobject.type-info.lisp
1 (in-package :gobject)
2
3 (defctype g-type gsize)
4
5 (eval-when (:compile-toplevel :load-toplevel :execute)
6   (defun gtype-make-fundamental-type (x)
7     (ash x 2)))
8
9 (defconstant +g-type-invalid+ (gtype-make-fundamental-type 0) "An invalid GType used as error return value in some functions which return a GType.")
10 (defconstant +g-type-void+ (gtype-make-fundamental-type 1) "A fundamental type which is used as a replacement for the C @code{void} return type.")
11 (defconstant +g-type-interface+ (gtype-make-fundamental-type 2) "The fundamental type from which all interfaces are derived.")
12 (defconstant +g-type-char+ (gtype-make-fundamental-type 3) "The fundamental type corresponding to gchar. The type designated by @variable{+g-type-char+} is unconditionally an 8-bit signed integer. This may or may not be the same type a the C type @code{gchar}.")
13 (defconstant +g-type-uchar+ (gtype-make-fundamental-type 4) "The fundamental type corresponding to @code{guchar}.")
14 (defconstant +g-type-boolean+ (gtype-make-fundamental-type 5) "The fundamental type corresponding to @code{gboolean}.")
15 (defconstant +g-type-int+ (gtype-make-fundamental-type 6) "The fundamental type corresponding to @code{gint}.")
16 (defconstant +g-type-uint+ (gtype-make-fundamental-type 7) "The fundamental type corresponding to @code{guint}.")
17 (defconstant +g-type-long+ (gtype-make-fundamental-type 8) "The fundamental type corresponding to @code{glong}.")
18 (defconstant +g-type-ulong+ (gtype-make-fundamental-type 9) "The fundamental type corresponding to @code{gulong}.")
19 (defconstant +g-type-int64+ (gtype-make-fundamental-type 10) "The fundamental type corresponding to @code{gint64}.")
20 (defconstant +g-type-uint64+ (gtype-make-fundamental-type 11) "The fundamental type corresponding to @code{guint64}.")
21 (defconstant +g-type-enum+ (gtype-make-fundamental-type 12) "The fundamental type from which all enumeration types are derived.")
22 (defconstant +g-type-flags+ (gtype-make-fundamental-type 13) "The fundamental type from which all flags types are derived.")
23 (defconstant +g-type-float+ (gtype-make-fundamental-type 14) "The fundamental type corresponding to @code{gfloat}.")
24 (defconstant +g-type-double+ (gtype-make-fundamental-type 15) "The fundamental type corresponding to @code{gdouble}.")
25 (defconstant +g-type-string+ (gtype-make-fundamental-type 16) "The fundamental type corresponding to null-terminated C strings.")
26 (defconstant +g-type-pointer+ (gtype-make-fundamental-type 17) "The fundamental type corresponding to @code{gpointer}.")
27 (defconstant +g-type-boxed+ (gtype-make-fundamental-type 18) "The fundamental type from which all boxed types are derived.")
28 (defconstant +g-type-param+ (gtype-make-fundamental-type 19) "The fundamental type from which all GParamSpec types are derived.")
29 (defconstant +g-type-object+ (gtype-make-fundamental-type 20) "The fundamental type for GObject.")
30
31 (defun g-type-children (g-type)
32   "Returns the list of types inherited from @code{g-type}.@see{g-type-parent}
33
34 Example:
35 @pre{
36 \(g-type-children \"GtkObject\")
37 => (\"GtkWidget\" \"GtkAdjustment\" \"GtkTreeViewColumn\" \"GtkCellRenderer\"
38     \"GtkFileFilter\" \"GtkRecentFilter\" \"GtkTooltips\")
39 }
40 @arg[g-type]{GType designator (see @class{g-type-designator})}
41 @return{list of GType designators}"
42   (with-foreign-object (n-children :uint)
43     (let ((g-types-ptr (%g-type-children g-type n-children)))
44       (prog1
45           (loop
46              for i from 0 below (mem-ref n-children :uint)
47              collect (mem-aref g-types-ptr 'g-type-designator i))
48         (g-free g-types-ptr)))))
49
50 (defun g-type-interfaces (g-type)
51   "Returns the list of interfaces the @code{g-type} conforms to.
52
53 Example:
54 @pre{
55 \(g-type-interfaces \"GtkButton\")
56 => (\"AtkImplementorIface\" \"GtkBuildable\" \"GtkActivatable\")
57 }
58 @arg[g-type]{GType designator (see @class{g-type-designator})}
59 @return{list of GType designators}"
60   (with-foreign-object (n-interfaces :uint)
61     (let ((g-types-ptr (%g-type-interfaces g-type n-interfaces)))
62       (prog1
63           (loop
64              for i from 0 below (mem-ref n-interfaces :uint)
65              collect (mem-aref g-types-ptr 'g-type-designator i))
66         (g-free g-types-ptr)))))
67
68 (defun g-type-interface-prerequisites (g-type)
69   "Returns the prerequisites of an interface type. Prerequisite is a type that must be a superclass of an implementing class or an interface that the object must also implement.
70
71 Example:
72 @pre{
73 \(g-type-interface-prerequisites \"GtkTreeModel\")
74 => (\"GObject\")
75 }
76 @arg[g-type]{GType designator (see @class{g-type-designator})}
77 @return{list of GType designators}"
78   (with-foreign-object (n-interface-prerequisites :uint)
79     (let ((g-types-ptr (%g-type-interface-prerequisites g-type n-interface-prerequisites)))
80       (prog1
81           (loop
82              for i from 0 below (mem-ref n-interface-prerequisites :uint)
83              collect (mem-aref g-types-ptr 'g-type-designator i))
84         (g-free g-types-ptr)))))
85