Move foreign library loading to gobject.init.lisp; separated gobject.type-info packag...
[cl-gtk2.git] / glib / gobject.structs.lisp
1 (in-package :gobject)
2
3 (defcstruct g-type-interface
4   (type g-type)
5   (instance-type g-type))
6
7 (defcstruct g-type-class
8   (type g-type))
9
10 (defcstruct g-type-instance
11   (class (:pointer g-type-class)))
12
13 (defcstruct g-type-info
14   (class-size :uint16)
15   (base-init-fn :pointer)
16   (base-finalize-fn :pointer)
17   (class-init-fn :pointer)
18   (class-finalize-fn :pointer)
19   (class-data :pointer)
20   (instance-size :uint16)
21   (n-preallocs :uint16)
22   (instance-init-fn :pointer)
23   (value-table :pointer))
24
25 (defcstruct g-type-query
26   (type g-type)
27   (type-name (:string :free-from-foreign nil))
28   (class-size :uint)
29   (instance-size :uint))
30
31 (defbitfield g-type-fundamental-flags
32   :classed
33   :instantiatable
34   :derivable
35   :deep-derivable)
36
37 (defcstruct g-type-fundamental-info
38   (type-flags g-type-fundamental-flags))
39
40 (defcstruct g-interface-info
41   (interface-init :pointer)
42   (interface-finalize :pointer)
43   (interface-data :pointer))
44
45 (defcstruct g-type-value-table
46   (value-init :pointer)
47   (value-free :pointer)
48   (value-copy :pointer)
49   (value-peek-pointer :pointer)
50   (collect-format (:string :free-from-foreign nil :free-to-foreign nil))
51   (collect-value :pointer)
52   (lcopy-format (:string :free-from-foreign nil :free-to-foreign nil))
53   (lcopy-value :pointer))
54
55 (defbitfield g-type-flags
56   (:abstract #. (ash 1 4))
57   :value-abstract)
58
59 (defcstruct %g-object
60   (type-instance g-type-instance)
61   (ref-count :uint)
62   (data :pointer))
63
64 (defctype %g-initially-unowned %g-object)
65
66 (defcstruct g-object-class
67   (type-class g-type-class)
68   (construct-properties :pointer)
69   (constructor :pointer)
70   (set-property :pointer)
71   (get-property :pointer)
72   (dispose :pointer)
73   (finalize :pointer)
74   (dispatch-properties-changed :pointer)
75   (notify :pointer)
76   (constructed :pointer)
77   (pdummy :pointer :count 7))
78
79 (defbitfield g-param-flags
80   :readable
81   :writable
82   :construct
83   :construct-only
84   :lax-validation
85   :static-name
86   :nick
87   :blurb)
88
89 (defcstruct g-param-spec
90   (type-instance g-type-instance)
91   (name (:string :free-from-foreign nil :free-to-foreign nil))
92   (flags g-param-flags)
93   (value-type g-type)
94   (owner-type g-type))
95
96 (defcunion g-value-data
97   (int :int)
98   (uint :uint)
99   (long :long)
100   (ulong :ulong)
101   (int64 :int64)
102   (uint64 :uint64)
103   (float :float)
104   (double :double)
105   (pointer :pointer))
106
107 (defcstruct g-value
108   (type g-type)
109   (data g-value-data :count 2))
110
111 (defcstruct g-object-construct-param
112   (param-spec (:pointer g-param-spec))
113   (value (:pointer g-value)))
114
115 (defcstruct g-parameter
116   (name (:string :free-from-foreign nil :free-to-foreign nil))
117   (value g-value))
118
119 (defcstruct g-enum-value
120   (value :int)
121   (name (:string :free-from-foreign nil :free-to-foreign nil))
122   (nick (:string :free-from-foreign nil :free-to-foreign nil)))
123
124 (defcstruct g-enum-class
125   (type-class g-type-class)
126   (minimum :int)
127   (maximum :int)
128   (n-values :uint)
129   (values (:pointer g-enum-value)))
130
131 (defcstruct g-flags-value
132   (value :uint)
133   (name (:string :free-from-foreign nil :free-to-foreign nil))
134   (nick (:string :free-from-foreign nil :free-to-foreign nil)))
135
136 (defcstruct g-flags-class
137   (type-class g-type-class)
138   (mask :uint)
139   (n-values :uint)
140   (values (:pointer g-flags-value)))
141
142 (defcstruct g-param-spec-boolean
143   (parent-instance g-param-spec)
144   (default-value :boolean))
145
146 (defcstruct g-param-spec-char
147   (parent-instance g-param-spec)
148   (minimum :int8)
149   (maximum :int8)
150   (default-value :int8))
151
152 (defcstruct g-param-spec-uchar
153   (parent-instance g-param-spec)
154   (minimum :uint8)
155   (maximum :uint8)
156   (default-value :uint8))
157
158 (defcstruct g-param-spec-int
159   (parent-instance g-param-spec)
160   (minimum :int)
161   (maximum :int)
162   (default-value :int))
163
164 (defcstruct g-param-spec-uint
165   (parent-instance g-param-spec)
166   (minimum :uint)
167   (maximum :uint)
168   (default-value :uint))
169
170 (defcstruct g-param-spec-long
171   (parent-instance g-param-spec)
172   (minimum :long)
173   (maximum :long)
174   (default-value :ulong))
175
176 (defcstruct g-param-spec-ulong
177   (parent-instance g-param-spec)
178   (minimum :ulong)
179   (maximum :ulong)
180   (default-value :ulong))
181
182 (defcstruct g-param-spec-int64
183   (parent-instance g-param-spec)
184   (minimum :uint64)
185   (maximum :uint64)
186   (default-value :uint64))
187
188 (defcstruct g-param-spec-uint64
189   (parent-instance g-param-spec)
190   (minimum :uint64)
191   (maximum :uint64)
192   (default-value :uint64))
193
194 (defcstruct g-param-spec-float
195   (parent-instance g-param-spec)
196   (minimum :float)
197   (maximum :float)
198   (default-value :float)
199   (epsilon :float))
200
201 (defcstruct g-param-spec-double
202   (parent-instance g-param-spec)
203   (minimum :double)
204   (maximum :double)
205   (default-value :double)
206   (epsilon :double))
207
208 (defcstruct g-param-spec-enum
209   (parent-instance g-param-spec)
210   (enum-class (:pointer g-enum-class))
211   (default-value :int))
212
213 (defcstruct g-param-spec-flags
214   (parent-instance g-param-spec)
215   (flags-class (:pointer g-flags-class))
216   (default-value :uint))
217
218 (defcstruct g-param-spec-string
219   (parent-instance g-param-spec)
220   (default-value (:string :free-to-foreign nil :free-from-foreign nil))
221   (cset-first (:string :free-to-foreign nil :free-from-foreign nil))
222   (cset-nth (:string :free-to-foreign nil :free-from-foreign nil))
223   (substitutor :char)
224   (flags-for-null :uint))
225
226 (defcstruct g-param-spec-param
227   (parent-instance g-param-spec))
228
229 (defcstruct g-param-spec-boxed
230   (parent-instance g-param-spec))
231
232 (defcstruct g-param-spec-pointer
233   (parent-instance g-param-spec))
234
235 (defcstruct g-param-spec-object
236   (parent-instance g-param-spec))
237
238 (defcstruct g-param-spec-value-array
239   (parent-instance g-param-spec)
240   (element-spec (:pointer g-param-spec))
241   (fixed-n-elements :uint))
242
243 (defcstruct g-param-spec-g-type
244   (parent-instance g-param-spec)
245   (types-root g-type))
246
247 (defcstruct g-param-spec-class
248   (type-class g-type-class)
249   (value-type g-type)
250   (finalize :pointer)
251   (value-set-default :pointer)
252   (value-validate :pointer)
253   (values-cmp :pointer))
254
255 (defcstruct g-closure
256   (private-data :uint32)
257   (marshal :pointer)
258   (data :pointer)
259   (notifiers :pointer))
260
261 (defcfun g-type-class-ref (:pointer g-type-class)
262   (type g-type-designator))
263
264 (defcfun g-type-class-unref :void
265   (class (:pointer g-type-class)))
266
267 (defcfun g-type-class-add-private :void
268   (class (:pointer g-type-class))
269   (private-size gsize))
270
271 (defcfun g-type-register-static g-type-designator
272   (parent-type g-type-designator)
273   (type-name :string)
274   (info (:pointer g-type-info))
275   (flags g-type-flags))
276
277 (defcfun g-type-register-static-simple g-type-designator
278   (parent-type g-type-designator)
279   (type-name :string)
280   (class-size :uint)
281   (class-init :pointer)
282   (instance-size :uint)
283   (instance-init :pointer)
284   (flags g-type-flags))
285
286 (defcfun g-type-add-interface-static :void
287   (instance-type g-type-designator)
288   (interface-type g-type-designator)
289   (info (:pointer g-interface-info)))
290
291 (defcfun g-type-interface-add-prerequisite :void
292   (interface-type g-type-designator)
293   (prerequisite-type g-type-designator))
294
295 (defun g-type-from-object (object)
296   "Returns the GType of an @code{object}
297
298 @arg[object]{C pointer to an object}
299 @return{GType designator (see @class{g-type-designator})}"
300   (g-type-from-instance object))
301
302 (defun g-type-from-class (g-class)
303   (g-type-name (foreign-slot-value g-class 'g-type-class 'type)))
304
305 (defun g-type-from-instance (type-instance)
306   (g-type-from-class (foreign-slot-value type-instance 'g-type-instance 'class)))
307
308 (defun g-type-from-interface (type-interface)
309   (g-type-name (foreign-slot-value type-interface 'g-type-interface 'type)))
310
311 (defcfun g-type-query :void
312   (type g-type-designator)
313   (query (:pointer g-type-query)))
314
315 (defcfun g-type-default-interface-ref :pointer
316   (type g-type-designator))
317
318 (defcfun g-type-default-interface-unref :void
319   (interface :pointer))