b8c1638ea065c4a325a9db2c668e0fdc44e5b5cb
[cl-gtk2.git] / glib / gobject.type.lisp
1 (in-package :gobject)
2
3 (defcfun (g-type-fundamental "g_type_fundamental") g-type
4   (type-id g-type))
5
6 (defcfun (%g-type-init "g_type_init") :void)
7
8 (%g-type-init)
9
10 (defcfun (g-type-name "g_type_name") :string
11   (type g-type))
12
13 (defcfun (g-type-from-name "g_type_from_name") g-type
14   (name :string))
15
16 (defcfun g-type-parent g-type
17   (type g-type))
18
19 (defcfun g-type-depth :uint
20   (type g-type))
21
22 (defcfun g-type-next-base g-type
23   (leaf-type g-type)
24   (root-type g-type))
25
26 (defcfun g-type-is-a :boolean
27   (type g-type)
28   (is-a-type g-type))
29
30 (defcfun g-type-class-ref (:pointer g-type-class)
31   (type g-type))
32
33 (defcfun g-type-class-unref :void
34   (class (:pointer g-type-class)))
35
36 (defcfun g-type-class-add-private :void
37   (class (:pointer g-type-class))
38   (private-size gsize))
39
40 (defcfun g-type-default-interface-ref :pointer
41   (type g-type))
42
43 (defcfun g-type-default-interface-unref :void
44   (interface :pointer))
45
46 (defcfun (%g-type-children "g_type_children") (:pointer g-type)
47   (type g-type)
48   (n-children (:pointer :uint)))
49
50 (defun g-type-children (g-type)
51   (with-foreign-object (n-children :uint)
52     (let ((g-types-ptr (%g-type-children g-type n-children)))
53       (prog1
54           (loop
55              for i from 0 below (mem-ref n-children :uint)
56              collect (mem-aref g-types-ptr 'g-type i))
57         (g-free g-types-ptr)))))
58
59 (defcfun (%g-type-interfaces "g_type_interfaces") (:pointer g-type)
60   (type g-type)
61   (n-interfaces (:pointer :uint)))
62
63 (defun g-type-interfaces (g-type)
64   (setf g-type (ensure-g-type g-type))
65   (with-foreign-object (n-interfaces :uint)
66     (let ((g-types-ptr (%g-type-interfaces g-type n-interfaces)))
67       (prog1
68           (loop
69              for i from 0 below (mem-ref n-interfaces :uint)
70              collect (mem-aref g-types-ptr 'g-type i))
71         (g-free g-types-ptr)))))
72
73 (defcfun (%g-type-interface-prerequisites "g_type_interface_prerequisites") (:pointer g-type)
74   (type g-type)
75   (n-interface-prerequisites (:pointer :uint)))
76
77 (defun g-type-interface-prerequisites (g-type)
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 i))
84         (g-free g-types-ptr)))))
85
86 (defcfun g-type-register-static g-type
87   (parent-type g-type)
88   (type-name :string)
89   (info (:pointer g-type-info))
90   (flags g-type-flags))
91
92 (defcfun g-type-register-static-simple g-type
93   (parent-type g-type)
94   (type-name :string)
95   (class-size :uint)
96   (class-init :pointer)
97   (instance-size :uint)
98   (instance-init :pointer)
99   (flags g-type-flags))
100
101 (defcfun g-type-add-interface-static :void
102   (instance-type g-type)
103   (interface-type g-type)
104   (info (:pointer g-interface-info)))
105
106 (defcfun g-type-interface-add-prerequisite :void
107   (interface-type g-type)
108   (prerequisite-type g-type))
109
110 (defun g-type-from-object (object)
111   (g-type-from-instance object))
112
113 (defun g-type-from-class (g-class)
114   (foreign-slot-value g-class 'g-type-class 'type))
115
116 (defun g-type-from-instance (type-instance)
117   (g-type-from-class (foreign-slot-value type-instance 'g-type-instance 'class)))
118
119 (defun g-type-from-interface (type-interface)
120   (foreign-slot-value type-interface 'g-type-interface 'type))
121
122 (defcfun g-strv-get-type g-type)
123
124 (g-strv-get-type)
125
126 (defcfun g-closure-get-type g-type)
127
128 (g-closure-get-type)
129
130 (defcfun g-type-query :void
131   (type g-type)
132   (query (:pointer g-type-query)))