Update. Clutter now working.
[girtod.git] / gtk2 / gobject2.d
blobf578a8b640cd61772123868f37ae3463b1d8c749
1 // *** DO NOT EDIT ***
2 // Automatically generated from "/usr/share/gir-1.0/GObject-2.0.gir"
4 module GObject2;
5 public import gtk2.glib2;
6 alias gtk2.glib2 GLib2;
8 // package: "gobject-2.0";
9 // C header: "glib-object.h";
11 // c:symbol-prefixes: ["g"]
12 // c:identifier-prefixes: ["G"]
14 // module GObject2;
17 // This is the signature of marshaller functions, required to marshall
18 // arrays of parameter values to signal emissions into C language callback
19 // invocations. It is merely an alias to #GClosureMarshal since the #GClosure
20 // mechanism takes over responsibility of actual function invocation for the
21 // signal system.
22 alias ClosureMarshal SignalCMarshaller;
24 // alias "Type" removed: Defined in glib
27 // A callback function used by the type system to finalize those portions
28 // of a derived types class structure that were setup from the corresponding
29 // GBaseInitFunc() function. Class finalization basically works the inverse
30 // way in which class intialization is performed.
31 // See GClassInitFunc() for a discussion of the class intialization process.
32 // <g_class>: The #GTypeClass structure to finalize.
33 extern (C) alias void function (void* g_class) BaseFinalizeFunc;
36 // A callback function used by the type system to do base initialization
37 // of the class structures of derived types. It is called as part of the
38 // initialization process of all derived classes and should reallocate
39 // or reset all dynamic class members copied over from the parent class.
40 // For example, class members (such as strings) that are not sufficiently
41 // handled by a plain memory copy of the parent class into the derived class
42 // have to be altered. See GClassInitFunc() for a discussion of the class
43 // intialization process.
44 // <g_class>: The #GTypeClass structure to initialize.
45 extern (C) alias void function (void* g_class) BaseInitFunc;
48 // #GBinding is the representation of a binding between a property on a
49 // #GObject instance (or source) and another property on another #GObject
50 // instance (or target). Whenever the source property changes, the same
51 // value is applied to the target property; for instance, the following
52 // binding:
53 //
54 // |[
55 // g_object_bind_property (object1, "property-a",
56 // object2, "property-b",
57 // G_BINDING_DEFAULT);
58 // ]|
59 //
60 // will cause <emphasis>object2:property-b</emphasis> to be updated every
61 // time g_object_set() or the specific accessor changes the value of
62 // <emphasis>object1:property-a</emphasis>.
63 //
64 // It is possible to create a bidirectional binding between two properties
65 // of two #GObject instances, so that if either property changes, the
66 // other is updated as well, for instance:
67 //
68 // |[
69 // g_object_bind_property (object1, "property-a",
70 // object2, "property-b",
71 // G_BINDING_BIDIRECTIONAL);
72 // ]|
73 //
74 // will keep the two properties in sync.
75 //
76 // It is also possible to set a custom transformation function (in both
77 // directions, in case of a bidirectional binding) to apply a custom
78 // transformation from the source value to the target value before
79 // applying it; for instance, the following binding:
80 //
81 // |[
82 // g_object_bind_property_full (adjustment1, "value",
83 // adjustment2, "value",
84 // G_BINDING_BIDIRECTIONAL,
85 // celsius_to_fahrenheit,
86 // fahrenheit_to_celsius,
87 // NULL, NULL);
88 // ]|
89 //
90 // will keep the <emphasis>value</emphasis> property of the two adjustments
91 // in sync; the <function>celsius_to_fahrenheit</function> function will be
92 // called whenever the <emphasis>adjustment1:value</emphasis> property changes
93 // and will transform the current value of the property before applying it
94 // to the <emphasis>adjustment2:value</emphasis> property; vice versa, the
95 // <function>fahrenheit_to_celsius</function> function will be called whenever
96 // the <emphasis>adjustment2:value</emphasis> property changes, and will
97 // transform the current value of the property before applying it to the
98 // <emphasis>adjustment1:value</emphasis>.
99 //
100 // Note that #GBinding does not resolve cycles by itself; a cycle like
102 // |[
103 // object1:propertyA -> object2:propertyB
104 // object2:propertyB -> object3:propertyC
105 // object3:propertyC -> object1:propertyA
106 // ]|
108 // might lead to an infinite loop. The loop, in this particular case,
109 // can be avoided if the objects emit the #GObject::notify signal only
110 // if the value has effectively been changed. A binding is implemented
111 // using the #GObject::notify signal, so it is susceptible to all the
112 // various ways of blocking a signal emission, like g_signal_stop_emission()
113 // or g_signal_handler_block().
115 // A binding will be severed, and the resources it allocates freed, whenever
116 // either one of the #GObject instances it refers to are finalized, or when
117 // the #GBinding instance loses its last reference.
119 // #GBinding is available since GObject 2.26
120 struct Binding /* : Object */ /* Version 2.26 */ {
121 alias method_parent this;
122 alias method_parent super_;
123 alias method_parent object;
124 Object method_parent;
127 // Retrieves the flags passed when constructing the #GBinding
128 // RETURNS: the #GBindingFlags used by the #GBinding
129 BindingFlags get_flags() {
130 return g_binding_get_flags(&this);
133 // Retrieves the #GObject instance used as the source of the binding
134 // RETURNS: the source #GObject
135 Object* get_source() {
136 return g_binding_get_source(&this);
139 // Retrieves the name of the property of #GBinding:source used as the source
140 // of the binding
141 // RETURNS: the name of the source property
142 char* get_source_property() {
143 return g_binding_get_source_property(&this);
146 // Retrieves the #GObject instance used as the target of the binding
147 // RETURNS: the target #GObject
148 Object* get_target() {
149 return g_binding_get_target(&this);
152 // Retrieves the name of the property of #GBinding:target used as the target
153 // of the binding
154 // RETURNS: the name of the target property
155 char* get_target_property() {
156 return g_binding_get_target_property(&this);
161 // Flags to be passed to g_object_bind_property() or
162 // g_object_bind_property_full().
164 // This enumeration can be extended at later date.
165 enum BindingFlags /* Version 2.26 */ {
166 DEFAULT = 0,
167 BIDIRECTIONAL = 1,
168 SYNC_CREATE = 2,
169 INVERT_BOOLEAN = 4
172 // A function to be called to transform the source property of @source
173 // from @source_value into the target property of @target
174 // using @target_value.
176 // otherwise
177 // RETURNS: %TRUE if the transformation was successful, and %FALSE
178 // <binding>: a #GBinding
179 // <source_value>: the value of the source property
180 // <target_value>: the value of the target property
181 // <user_data>: data passed to the transform function
182 extern (C) alias int function (Binding* binding, Value* source_value, Value* target_value, void* user_data) BindingTransformFunc;
185 // Unintrospectable callback: BoxedCopyFunc() / ()
186 // This function is provided by the user and should produce a copy
187 // of the passed in boxed structure.
188 // RETURNS: The newly created copy of the boxed structure.
189 // <boxed>: The boxed structure to be copied.
190 extern (C) alias void* function (void* boxed) BoxedCopyFunc;
193 // This function is provided by the user and should free the boxed
194 // structure passed.
195 // <boxed>: The boxed structure to be freed.
196 extern (C) alias void function (void* boxed) BoxedFreeFunc;
198 // A #GCClosure is a specialization of #GClosure for C function callbacks.
199 struct CClosure {
200 Closure closure;
201 void* callback;
203 static void marshal_BOOLEAN__BOXED_BOXED(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
204 g_cclosure_marshal_BOOLEAN__BOXED_BOXED(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
207 // A marshaller for a #GCClosure with a callback of type
208 // <literal>gboolean (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal> where the #gint parameter
209 // denotes a flags type.
210 // <closure>: the #GClosure to which the marshaller belongs
211 // <return_value>: a #GValue which can store the returned #gboolean
212 // <n_param_values>: 2
213 // <param_values>: a #GValue array holding instance and arg1
214 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
215 // <marshal_data>: additional data specified when registering the marshaller
216 static void marshal_BOOLEAN__FLAGS(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
217 g_cclosure_marshal_BOOLEAN__FLAGS(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
220 // A marshaller for a #GCClosure with a callback of type
221 // <literal>gchar* (*callback) (gpointer instance, GObject *arg1, gpointer arg2, gpointer user_data)</literal>.
222 // <closure>: the #GClosure to which the marshaller belongs
223 // <return_value>: a #GValue, which can store the returned string
224 // <n_param_values>: 3
225 // <param_values>: a #GValue array holding instance, arg1 and arg2
226 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
227 // <marshal_data>: additional data specified when registering the marshaller
228 static void marshal_STRING__OBJECT_POINTER(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
229 g_cclosure_marshal_STRING__OBJECT_POINTER(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
232 // A marshaller for a #GCClosure with a callback of type
233 // <literal>void (*callback) (gpointer instance, gboolean arg1, gpointer user_data)</literal>.
234 // <closure>: the #GClosure to which the marshaller belongs
235 // <return_value>: ignored
236 // <n_param_values>: 2
237 // <param_values>: a #GValue array holding the instance and the #gboolean parameter
238 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
239 // <marshal_data>: additional data specified when registering the marshaller
240 static void marshal_VOID__BOOLEAN(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
241 g_cclosure_marshal_VOID__BOOLEAN(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
244 // A marshaller for a #GCClosure with a callback of type
245 // <literal>void (*callback) (gpointer instance, GBoxed *arg1, gpointer user_data)</literal>.
246 // <closure>: the #GClosure to which the marshaller belongs
247 // <return_value>: ignored
248 // <n_param_values>: 2
249 // <param_values>: a #GValue array holding the instance and the #GBoxed* parameter
250 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
251 // <marshal_data>: additional data specified when registering the marshaller
252 static void marshal_VOID__BOXED(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
253 g_cclosure_marshal_VOID__BOXED(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
256 // A marshaller for a #GCClosure with a callback of type
257 // <literal>void (*callback) (gpointer instance, gchar arg1, gpointer user_data)</literal>.
258 // <closure>: the #GClosure to which the marshaller belongs
259 // <return_value>: ignored
260 // <n_param_values>: 2
261 // <param_values>: a #GValue array holding the instance and the #gchar parameter
262 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
263 // <marshal_data>: additional data specified when registering the marshaller
264 static void marshal_VOID__CHAR(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
265 g_cclosure_marshal_VOID__CHAR(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
268 // A marshaller for a #GCClosure with a callback of type
269 // <literal>void (*callback) (gpointer instance, gdouble arg1, gpointer user_data)</literal>.
270 // <closure>: the #GClosure to which the marshaller belongs
271 // <return_value>: ignored
272 // <n_param_values>: 2
273 // <param_values>: a #GValue array holding the instance and the #gdouble parameter
274 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
275 // <marshal_data>: additional data specified when registering the marshaller
276 static void marshal_VOID__DOUBLE(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
277 g_cclosure_marshal_VOID__DOUBLE(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
280 // A marshaller for a #GCClosure with a callback of type
281 // <literal>void (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal> where the #gint parameter denotes an enumeration type..
282 // <closure>: the #GClosure to which the marshaller belongs
283 // <return_value>: ignored
284 // <n_param_values>: 2
285 // <param_values>: a #GValue array holding the instance and the enumeration parameter
286 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
287 // <marshal_data>: additional data specified when registering the marshaller
288 static void marshal_VOID__ENUM(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
289 g_cclosure_marshal_VOID__ENUM(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
292 // A marshaller for a #GCClosure with a callback of type
293 // <literal>void (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal> where the #gint parameter denotes a flags type.
294 // <closure>: the #GClosure to which the marshaller belongs
295 // <return_value>: ignored
296 // <n_param_values>: 2
297 // <param_values>: a #GValue array holding the instance and the flags parameter
298 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
299 // <marshal_data>: additional data specified when registering the marshaller
300 static void marshal_VOID__FLAGS(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
301 g_cclosure_marshal_VOID__FLAGS(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
304 // A marshaller for a #GCClosure with a callback of type
305 // <literal>void (*callback) (gpointer instance, gfloat arg1, gpointer user_data)</literal>.
306 // <closure>: the #GClosure to which the marshaller belongs
307 // <return_value>: ignored
308 // <n_param_values>: 2
309 // <param_values>: a #GValue array holding the instance and the #gfloat parameter
310 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
311 // <marshal_data>: additional data specified when registering the marshaller
312 static void marshal_VOID__FLOAT(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
313 g_cclosure_marshal_VOID__FLOAT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
316 // A marshaller for a #GCClosure with a callback of type
317 // <literal>void (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal>.
318 // <closure>: the #GClosure to which the marshaller belongs
319 // <return_value>: ignored
320 // <n_param_values>: 2
321 // <param_values>: a #GValue array holding the instance and the #gint parameter
322 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
323 // <marshal_data>: additional data specified when registering the marshaller
324 static void marshal_VOID__INT(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
325 g_cclosure_marshal_VOID__INT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
328 // A marshaller for a #GCClosure with a callback of type
329 // <literal>void (*callback) (gpointer instance, glong arg1, gpointer user_data)</literal>.
330 // <closure>: the #GClosure to which the marshaller belongs
331 // <return_value>: ignored
332 // <n_param_values>: 2
333 // <param_values>: a #GValue array holding the instance and the #glong parameter
334 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
335 // <marshal_data>: additional data specified when registering the marshaller
336 static void marshal_VOID__LONG(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
337 g_cclosure_marshal_VOID__LONG(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
340 // A marshaller for a #GCClosure with a callback of type
341 // <literal>void (*callback) (gpointer instance, GObject *arg1, gpointer user_data)</literal>.
342 // <closure>: the #GClosure to which the marshaller belongs
343 // <return_value>: ignored
344 // <n_param_values>: 2
345 // <param_values>: a #GValue array holding the instance and the #GObject* parameter
346 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
347 // <marshal_data>: additional data specified when registering the marshaller
348 static void marshal_VOID__OBJECT(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
349 g_cclosure_marshal_VOID__OBJECT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
352 // A marshaller for a #GCClosure with a callback of type
353 // <literal>void (*callback) (gpointer instance, GParamSpec *arg1, gpointer user_data)</literal>.
354 // <closure>: the #GClosure to which the marshaller belongs
355 // <return_value>: ignored
356 // <n_param_values>: 2
357 // <param_values>: a #GValue array holding the instance and the #GParamSpec* parameter
358 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
359 // <marshal_data>: additional data specified when registering the marshaller
360 static void marshal_VOID__PARAM(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
361 g_cclosure_marshal_VOID__PARAM(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
364 // A marshaller for a #GCClosure with a callback of type
365 // <literal>void (*callback) (gpointer instance, gpointer arg1, gpointer user_data)</literal>.
366 // <closure>: the #GClosure to which the marshaller belongs
367 // <return_value>: ignored
368 // <n_param_values>: 2
369 // <param_values>: a #GValue array holding the instance and the #gpointer parameter
370 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
371 // <marshal_data>: additional data specified when registering the marshaller
372 static void marshal_VOID__POINTER(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
373 g_cclosure_marshal_VOID__POINTER(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
376 // A marshaller for a #GCClosure with a callback of type
377 // <literal>void (*callback) (gpointer instance, const gchar *arg1, gpointer user_data)</literal>.
378 // <closure>: the #GClosure to which the marshaller belongs
379 // <return_value>: ignored
380 // <n_param_values>: 2
381 // <param_values>: a #GValue array holding the instance and the #gchar* parameter
382 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
383 // <marshal_data>: additional data specified when registering the marshaller
384 static void marshal_VOID__STRING(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
385 g_cclosure_marshal_VOID__STRING(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
388 // A marshaller for a #GCClosure with a callback of type
389 // <literal>void (*callback) (gpointer instance, guchar arg1, gpointer user_data)</literal>.
390 // <closure>: the #GClosure to which the marshaller belongs
391 // <return_value>: ignored
392 // <n_param_values>: 2
393 // <param_values>: a #GValue array holding the instance and the #guchar parameter
394 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
395 // <marshal_data>: additional data specified when registering the marshaller
396 static void marshal_VOID__UCHAR(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
397 g_cclosure_marshal_VOID__UCHAR(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
400 // A marshaller for a #GCClosure with a callback of type
401 // <literal>void (*callback) (gpointer instance, guint arg1, gpointer user_data)</literal>.
402 // <closure>: the #GClosure to which the marshaller belongs
403 // <return_value>: ignored
404 // <n_param_values>: 2
405 // <param_values>: a #GValue array holding the instance and the #guint parameter
406 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
407 // <marshal_data>: additional data specified when registering the marshaller
408 static void marshal_VOID__UINT(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
409 g_cclosure_marshal_VOID__UINT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
412 // A marshaller for a #GCClosure with a callback of type
413 // <literal>void (*callback) (gpointer instance, guint arg1, gpointer arg2, gpointer user_data)</literal>.
414 // <closure>: the #GClosure to which the marshaller belongs
415 // <return_value>: ignored
416 // <n_param_values>: 3
417 // <param_values>: a #GValue array holding instance, arg1 and arg2
418 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
419 // <marshal_data>: additional data specified when registering the marshaller
420 static void marshal_VOID__UINT_POINTER(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
421 g_cclosure_marshal_VOID__UINT_POINTER(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
424 // A marshaller for a #GCClosure with a callback of type
425 // <literal>void (*callback) (gpointer instance, gulong arg1, gpointer user_data)</literal>.
426 // <closure>: the #GClosure to which the marshaller belongs
427 // <return_value>: ignored
428 // <n_param_values>: 2
429 // <param_values>: a #GValue array holding the instance and the #gulong parameter
430 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
431 // <marshal_data>: additional data specified when registering the marshaller
432 static void marshal_VOID__ULONG(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
433 g_cclosure_marshal_VOID__ULONG(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
436 // A marshaller for a #GCClosure with a callback of type
437 // <literal>void (*callback) (gpointer instance, GVariant *arg1, gpointer user_data)</literal>.
438 // <closure>: the #GClosure to which the marshaller belongs
439 // <return_value>: ignored
440 // <n_param_values>: 2
441 // <param_values>: a #GValue array holding the instance and the #GVariant* parameter
442 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
443 // <marshal_data>: additional data specified when registering the marshaller
444 static void marshal_VOID__VARIANT(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
445 g_cclosure_marshal_VOID__VARIANT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
448 // A marshaller for a #GCClosure with a callback of type
449 // <literal>void (*callback) (gpointer instance, gpointer user_data)</literal>.
450 // <closure>: the #GClosure to which the marshaller belongs
451 // <return_value>: ignored
452 // <n_param_values>: 1
453 // <param_values>: a #GValue array holding only the instance
454 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
455 // <marshal_data>: additional data specified when registering the marshaller
456 static void marshal_VOID__VOID(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
457 g_cclosure_marshal_VOID__VOID(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
460 // A generic marshaller function implemented via <ulink
461 // url="http://sourceware.org/libffi/">libffi</ulink>.
462 // <closure>: A #GClosure.
463 // <return_gvalue>: A #GValue to store the return value. May be %NULL if the callback of closure doesn't return a value.
464 // <n_param_values>: The length of the @param_values array.
465 // <param_values>: An array of #GValue<!-- -->s holding the arguments on which to invoke the callback of closure.
466 // <invocation_hint>: The invocation hint given as the last argument to g_closure_invoke().
467 // <marshal_data>: Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
468 static void marshal_generic(Closure* closure, Value* return_gvalue, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
469 g_cclosure_marshal_generic(closure, return_gvalue, n_param_values, param_values, invocation_hint, marshal_data);
472 // Unintrospectable function: new() / g_cclosure_new()
473 // Creates a new closure which invokes @callback_func with @user_data as
474 // the last parameter.
475 // RETURNS: a new #GCClosure
476 // <callback_func>: the function to invoke
477 // <user_data>: user data to pass to @callback_func
478 // <destroy_data>: destroy notify to be called when @user_data is no longer used
479 static Closure* /*new*/ new_(Callback callback_func, void* user_data, ClosureNotify destroy_data) {
480 return g_cclosure_new(callback_func, user_data, destroy_data);
483 // Unintrospectable function: new_object() / g_cclosure_new_object()
484 // A variant of g_cclosure_new() which uses @object as @user_data and
485 // calls g_object_watch_closure() on @object and the created
486 // closure. This function is useful when you have a callback closely
487 // associated with a #GObject, and want the callback to no longer run
488 // after the object is is freed.
489 // RETURNS: a new #GCClosure
490 // <callback_func>: the function to invoke
491 // <object>: a #GObject pointer to pass to @callback_func
492 static Closure* /*new*/ new_object(Callback callback_func, Object* object) {
493 return g_cclosure_new_object(callback_func, object);
496 // Unintrospectable function: new_object_swap() / g_cclosure_new_object_swap()
497 // A variant of g_cclosure_new_swap() which uses @object as @user_data
498 // and calls g_object_watch_closure() on @object and the created
499 // closure. This function is useful when you have a callback closely
500 // associated with a #GObject, and want the callback to no longer run
501 // after the object is is freed.
502 // RETURNS: a new #GCClosure
503 // <callback_func>: the function to invoke
504 // <object>: a #GObject pointer to pass to @callback_func
505 static Closure* /*new*/ new_object_swap(Callback callback_func, Object* object) {
506 return g_cclosure_new_object_swap(callback_func, object);
509 // Unintrospectable function: new_swap() / g_cclosure_new_swap()
510 // Creates a new closure which invokes @callback_func with @user_data as
511 // the first parameter.
512 // RETURNS: a new #GCClosure
513 // <callback_func>: the function to invoke
514 // <user_data>: user data to pass to @callback_func
515 // <destroy_data>: destroy notify to be called when @user_data is no longer used
516 static Closure* /*new*/ new_swap(Callback callback_func, void* user_data, ClosureNotify destroy_data) {
517 return g_cclosure_new_swap(callback_func, user_data, destroy_data);
522 // The type used for callback functions in structure definitions and function
523 // signatures. This doesn't mean that all callback functions must take no
524 // parameters and return void. The required signature of a callback function
525 // is determined by the context in which is used (e.g. the signal to which it
526 // is connected). Use G_CALLBACK() to cast the callback function to a #GCallback.
527 extern (C) alias void function () Callback;
530 // A callback function used by the type system to finalize a class.
531 // This function is rarely needed, as dynamically allocated class resources
532 // should be handled by GBaseInitFunc() and GBaseFinalizeFunc().
533 // Also, specification of a GClassFinalizeFunc() in the #GTypeInfo
534 // structure of a static type is invalid, because classes of static types
535 // will never be finalized (they are artificially kept alive when their
536 // reference count drops to zero).
537 // <g_class>: The #GTypeClass structure to finalize.
538 // <class_data>: The @class_data member supplied via the #GTypeInfo structure.
539 extern (C) alias void function (void* g_class, void* class_data) ClassFinalizeFunc;
542 // A callback function used by the type system to initialize the class
543 // of a specific type. This function should initialize all static class
544 // members.
545 // The initialization process of a class involves:
546 // <itemizedlist>
547 // <listitem><para>
548 // 1 - Copying common members from the parent class over to the
549 // derived class structure.
550 // </para></listitem>
551 // <listitem><para>
552 // 2 - Zero initialization of the remaining members not copied
553 // over from the parent class.
554 // </para></listitem>
555 // <listitem><para>
556 // 3 - Invocation of the GBaseInitFunc() initializers of all parent
557 // types and the class' type.
558 // </para></listitem>
559 // <listitem><para>
560 // 4 - Invocation of the class' GClassInitFunc() initializer.
561 // </para></listitem>
562 // </itemizedlist>
563 // Since derived classes are partially initialized through a memory copy
564 // of the parent class, the general rule is that GBaseInitFunc() and
565 // GBaseFinalizeFunc() should take care of necessary reinitialization
566 // and release of those class members that were introduced by the type
567 // that specified these GBaseInitFunc()/GBaseFinalizeFunc().
568 // GClassInitFunc() should only care about initializing static
569 // class members, while dynamic class members (such as allocated strings
570 // or reference counted resources) are better handled by a GBaseInitFunc()
571 // for this type, so proper initialization of the dynamic class members
572 // is performed for class initialization of derived types as well.
573 // An example may help to correspond the intend of the different class
574 // initializers:
576 // |[
577 // typedef struct {
578 // GObjectClass parent_class;
579 // gint static_integer;
580 // gchar *dynamic_string;
581 // } TypeAClass;
582 // static void
583 // type_a_base_class_init (TypeAClass *class)
584 // {
585 // class->dynamic_string = g_strdup ("some string");
586 // }
587 // static void
588 // type_a_base_class_finalize (TypeAClass *class)
589 // {
590 // g_free (class->dynamic_string);
591 // }
592 // static void
593 // type_a_class_init (TypeAClass *class)
594 // {
595 // class->static_integer = 42;
596 // }
598 // typedef struct {
599 // TypeAClass parent_class;
600 // gfloat static_float;
601 // GString *dynamic_gstring;
602 // } TypeBClass;
603 // static void
604 // type_b_base_class_init (TypeBClass *class)
605 // {
606 // class->dynamic_gstring = g_string_new ("some other string");
607 // }
608 // static void
609 // type_b_base_class_finalize (TypeBClass *class)
610 // {
611 // g_string_free (class->dynamic_gstring);
612 // }
613 // static void
614 // type_b_class_init (TypeBClass *class)
615 // {
616 // class->static_float = 3.14159265358979323846;
617 // }
618 // ]|
619 // Initialization of TypeBClass will first cause initialization of
620 // TypeAClass (derived classes reference their parent classes, see
621 // g_type_class_ref() on this).
622 // Initialization of TypeAClass roughly involves zero-initializing its fields,
623 // then calling its GBaseInitFunc() type_a_base_class_init() to allocate
624 // its dynamic members (dynamic_string), and finally calling its GClassInitFunc()
625 // type_a_class_init() to initialize its static members (static_integer).
626 // The first step in the initialization process of TypeBClass is then
627 // a plain memory copy of the contents of TypeAClass into TypeBClass and
628 // zero-initialization of the remaining fields in TypeBClass.
629 // The dynamic members of TypeAClass within TypeBClass now need
630 // reinitialization which is performed by calling type_a_base_class_init()
631 // with an argument of TypeBClass.
632 // After that, the GBaseInitFunc() of TypeBClass, type_b_base_class_init()
633 // is called to allocate the dynamic members of TypeBClass (dynamic_gstring),
634 // and finally the GClassInitFunc() of TypeBClass, type_b_class_init(),
635 // is called to complete the initialization process with the static members
636 // (static_float).
637 // Corresponding finalization counter parts to the GBaseInitFunc() functions
638 // have to be provided to release allocated resources at class finalization
639 // time.
640 // <g_class>: The #GTypeClass structure to initialize.
641 // <class_data>: The @class_data member supplied via the #GTypeInfo structure.
642 extern (C) alias void function (void* g_class, void* class_data) ClassInitFunc;
645 // A #GClosure represents a callback supplied by the programmer. It
646 // will generally comprise a function of some kind and a marshaller
647 // used to call it. It is the reponsibility of the marshaller to
648 // convert the arguments for the invocation from #GValue<!-- -->s into
649 // a suitable form, perform the callback on the converted arguments,
650 // and transform the return value back into a #GValue.
652 // In the case of C programs, a closure usually just holds a pointer
653 // to a function and maybe a data argument, and the marshaller
654 // converts between #GValue<!-- --> and native C types. The GObject
655 // library provides the #GCClosure type for this purpose. Bindings for
656 // other languages need marshallers which convert between #GValue<!--
657 // -->s and suitable representations in the runtime of the language in
658 // order to use functions written in that languages as callbacks.
660 // Within GObject, closures play an important role in the
661 // implementation of signals. When a signal is registered, the
662 // @c_marshaller argument to g_signal_new() specifies the default C
663 // marshaller for any closure which is connected to this
664 // signal. GObject provides a number of C marshallers for this
665 // purpose, see the g_cclosure_marshal_*() functions. Additional C
666 // marshallers can be generated with the <link
667 // linkend="glib-genmarshal">glib-genmarshal</link> utility. Closures
668 // can be explicitly connected to signals with
669 // g_signal_connect_closure(), but it usually more convenient to let
670 // GObject create a closure automatically by using one of the
671 // g_signal_connect_*() functions which take a callback function/user
672 // data pair.
674 // Using closures has a number of important advantages over a simple
675 // callback function/data pointer combination:
676 // <itemizedlist>
677 // <listitem><para>
678 // Closures allow the callee to get the types of the callback parameters,
679 // which means that language bindings don't have to write individual glue
680 // for each callback type.
681 // </para></listitem>
682 // <listitem><para>
683 // The reference counting of #GClosure makes it easy to handle reentrancy
684 // right; if a callback is removed while it is being invoked, the closure
685 // and its parameters won't be freed until the invocation finishes.
686 // </para></listitem>
687 // <listitem><para>
688 // g_closure_invalidate() and invalidation notifiers allow callbacks to be
689 // automatically removed when the objects they point to go away.
690 // </para></listitem>
691 // </itemizedlist>
692 struct Closure {
693 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
694 uint, "ref_count", 15,
695 uint, "meta_marshal", 1,
696 uint, "n_guards", 1,
697 uint, "n_fnotifiers", 2,
698 uint, "n_inotifiers", 8,
699 uint, "in_inotify", 1,
700 uint, "floating", 1,
701 uint, "derivative_flag", 1,
702 uint, "in_marshal", 1,
703 uint, "is_invalid", 1));
704 extern (C) void function (Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) marshal;
705 private void* data;
706 private ClosureNotifyData* notifiers;
709 // A variant of g_closure_new_simple() which stores @object in the
710 // @data field of the closure and calls g_object_watch_closure() on
711 // @object and the created closure. This function is mainly useful
712 // when implementing new types of closures.
713 // RETURNS: a newly allocated #GClosure
714 // <sizeof_closure>: the size of the structure to allocate, must be at least <literal>sizeof (GClosure)</literal>
715 // <object>: a #GObject pointer to store in the @data field of the newly allocated #GClosure
716 static Closure* /*new*/ new_object(uint sizeof_closure, Object* object) {
717 return g_closure_new_object(sizeof_closure, object);
720 // Allocates a struct of the given size and initializes the initial
721 // part as a #GClosure. This function is mainly useful when
722 // implementing new types of closures.
724 // |[
725 // typedef struct _MyClosure MyClosure;
726 // struct _MyClosure
727 // {
728 // GClosure closure;
729 // // extra data goes here
730 // };
732 // static void
733 // my_closure_finalize (gpointer notify_data,
734 // GClosure *closure)
735 // {
736 // MyClosure *my_closure = (MyClosure *)closure;
738 // // free extra data here
739 // }
741 // MyClosure *my_closure_new (gpointer data)
742 // {
743 // GClosure *closure;
744 // MyClosure *my_closure;
746 // closure = g_closure_new_simple (sizeof (MyClosure), data);
747 // my_closure = (MyClosure *) closure;
749 // // initialize extra data here
751 // g_closure_add_finalize_notifier (closure, notify_data,
752 // my_closure_finalize);
753 // return my_closure;
754 // }
755 // ]|
756 // RETURNS: a newly allocated #GClosure
757 // <sizeof_closure>: the size of the structure to allocate, must be at least <literal>sizeof (GClosure)</literal>
758 // <data>: data to store in the @data field of the newly allocated #GClosure
759 static Closure* /*new*/ new_simple(uint sizeof_closure, void* data) {
760 return g_closure_new_simple(sizeof_closure, data);
763 // Unintrospectable method: add_finalize_notifier() / g_closure_add_finalize_notifier()
764 // Registers a finalization notifier which will be called when the
765 // reference count of @closure goes down to 0. Multiple finalization
766 // notifiers on a single closure are invoked in unspecified order. If
767 // a single call to g_closure_unref() results in the closure being
768 // both invalidated and finalized, then the invalidate notifiers will
769 // be run before the finalize notifiers.
770 // <notify_data>: data to pass to @notify_func
771 // <notify_func>: the callback function to register
772 void add_finalize_notifier(void* notify_data, ClosureNotify notify_func) {
773 g_closure_add_finalize_notifier(&this, notify_data, notify_func);
776 // Unintrospectable method: add_invalidate_notifier() / g_closure_add_invalidate_notifier()
777 // Registers an invalidation notifier which will be called when the
778 // @closure is invalidated with g_closure_invalidate(). Invalidation
779 // notifiers are invoked before finalization notifiers, in an
780 // unspecified order.
781 // <notify_data>: data to pass to @notify_func
782 // <notify_func>: the callback function to register
783 void add_invalidate_notifier(void* notify_data, ClosureNotify notify_func) {
784 g_closure_add_invalidate_notifier(&this, notify_data, notify_func);
787 // Unintrospectable method: add_marshal_guards() / g_closure_add_marshal_guards()
788 // Adds a pair of notifiers which get invoked before and after the
789 // closure callback, respectively. This is typically used to protect
790 // the extra arguments for the duration of the callback. See
791 // g_object_watch_closure() for an example of marshal guards.
792 // <pre_marshal_data>: data to pass to @pre_marshal_notify
793 // <pre_marshal_notify>: a function to call before the closure callback
794 // <post_marshal_data>: data to pass to @post_marshal_notify
795 // <post_marshal_notify>: a function to call after the closure callback
796 void add_marshal_guards(void* pre_marshal_data, ClosureNotify pre_marshal_notify, void* post_marshal_data, ClosureNotify post_marshal_notify) {
797 g_closure_add_marshal_guards(&this, pre_marshal_data, pre_marshal_notify, post_marshal_data, post_marshal_notify);
800 // Sets a flag on the closure to indicate that its calling
801 // environment has become invalid, and thus causes any future
802 // invocations of g_closure_invoke() on this @closure to be
803 // ignored. Also, invalidation notifiers installed on the closure will
804 // be called at this point. Note that unless you are holding a
805 // reference to the closure yourself, the invalidation notifiers may
806 // unref the closure and cause it to be destroyed, so if you need to
807 // access the closure after calling g_closure_invalidate(), make sure
808 // that you've previously called g_closure_ref().
810 // Note that g_closure_invalidate() will also be called when the
811 // reference count of a closure drops to zero (unless it has already
812 // been invalidated before).
813 void invalidate() {
814 g_closure_invalidate(&this);
817 // Invokes the closure, i.e. executes the callback represented by the @closure.
818 // <return_value>: a #GValue to store the return value. May be %NULL if the callback of @closure doesn't return a value.
819 // <n_param_values>: the length of the @param_values array
820 // <param_values>: an array of #GValue<!-- -->s holding the arguments on which to invoke the callback of @closure
821 // <invocation_hint>: a context-dependent invocation hint
822 void invoke(Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint=null) {
823 g_closure_invoke(&this, return_value, n_param_values, param_values, invocation_hint);
826 // Increments the reference count on a closure to force it staying
827 // alive while the caller holds a pointer to it.
828 // RETURNS: The @closure passed in, for convenience
829 Closure* ref_() {
830 return g_closure_ref(&this);
833 // Unintrospectable method: remove_finalize_notifier() / g_closure_remove_finalize_notifier()
834 // Removes a finalization notifier.
836 // Notice that notifiers are automatically removed after they are run.
837 // <notify_data>: data which was passed to g_closure_add_finalize_notifier() when registering @notify_func
838 // <notify_func>: the callback function to remove
839 void remove_finalize_notifier(void* notify_data, ClosureNotify notify_func) {
840 g_closure_remove_finalize_notifier(&this, notify_data, notify_func);
843 // Unintrospectable method: remove_invalidate_notifier() / g_closure_remove_invalidate_notifier()
844 // Removes an invalidation notifier.
846 // Notice that notifiers are automatically removed after they are run.
847 // <notify_data>: data which was passed to g_closure_add_invalidate_notifier() when registering @notify_func
848 // <notify_func>: the callback function to remove
849 void remove_invalidate_notifier(void* notify_data, ClosureNotify notify_func) {
850 g_closure_remove_invalidate_notifier(&this, notify_data, notify_func);
853 // Unintrospectable method: set_marshal() / g_closure_set_marshal()
854 // Sets the marshaller of @closure. The <literal>marshal_data</literal>
855 // of @marshal provides a way for a meta marshaller to provide additional
856 // information to the marshaller. (See g_closure_set_meta_marshal().) For
857 // GObject's C predefined marshallers (the g_cclosure_marshal_*()
858 // functions), what it provides is a callback function to use instead of
859 // @closure->callback.
860 // <marshal>: a #GClosureMarshal function
861 void set_marshal(ClosureMarshal marshal) {
862 g_closure_set_marshal(&this, marshal);
865 // Unintrospectable method: set_meta_marshal() / g_closure_set_meta_marshal()
866 // Sets the meta marshaller of @closure. A meta marshaller wraps
867 // @closure->marshal and modifies the way it is called in some
868 // fashion. The most common use of this facility is for C callbacks.
869 // The same marshallers (generated by <link
870 // linkend="glib-genmarshal">glib-genmarshal</link>) are used
871 // everywhere, but the way that we get the callback function
872 // differs. In most cases we want to use @closure->callback, but in
873 // other cases we want to use some different technique to retrieve the
874 // callback function.
876 // For example, class closures for signals (see
877 // g_signal_type_cclosure_new()) retrieve the callback function from a
878 // fixed offset in the class structure. The meta marshaller retrieves
879 // the right callback and passes it to the marshaller as the
880 // @marshal_data argument.
881 // <marshal_data>: context-dependent data to pass to @meta_marshal
882 // <meta_marshal>: a #GClosureMarshal function
883 void set_meta_marshal(void* marshal_data, ClosureMarshal meta_marshal) {
884 g_closure_set_meta_marshal(&this, marshal_data, meta_marshal);
887 // Takes over the initial ownership of a closure. Each closure is
888 // initially created in a <firstterm>floating</firstterm> state, which
889 // means that the initial reference count is not owned by any caller.
890 // g_closure_sink() checks to see if the object is still floating, and
891 // if so, unsets the floating state and decreases the reference
892 // count. If the closure is not floating, g_closure_sink() does
893 // nothing. The reason for the existence of the floating state is to
894 // prevent cumbersome code sequences like:
895 // |[
896 // closure = g_cclosure_new (cb_func, cb_data);
897 // g_source_set_closure (source, closure);
898 // g_closure_unref (closure); // XXX GObject doesn't really need this
899 // ]|
900 // Because g_source_set_closure() (and similar functions) take ownership of the
901 // initial reference count, if it is unowned, we instead can write:
902 // |[
903 // g_source_set_closure (source, g_cclosure_new (cb_func, cb_data));
904 // ]|
906 // Generally, this function is used together with g_closure_ref(). Ane example
907 // of storing a closure for later notification looks like:
908 // |[
909 // static GClosure *notify_closure = NULL;
910 // void
911 // foo_notify_set_closure (GClosure *closure)
912 // {
913 // if (notify_closure)
914 // g_closure_unref (notify_closure);
915 // notify_closure = closure;
916 // if (notify_closure)
917 // {
918 // g_closure_ref (notify_closure);
919 // g_closure_sink (notify_closure);
920 // }
921 // }
922 // ]|
924 // Because g_closure_sink() may decrement the reference count of a closure
925 // (if it hasn't been called on @closure yet) just like g_closure_unref(),
926 // g_closure_ref() should be called prior to this function.
927 void sink() {
928 g_closure_sink(&this);
931 // Decrements the reference count of a closure after it was previously
932 // incremented by the same caller. If no other callers are using the
933 // closure, then the closure will be destroyed and freed.
934 void unref() {
935 g_closure_unref(&this);
940 // The type used for marshaller functions.
941 // <closure>: the #GClosure to which the marshaller belongs
942 // <return_value>: a #GValue to store the return value. May be %NULL if the callback of @closure doesn't return a value.
943 // <n_param_values>: the length of the @param_values array
944 // <param_values>: an array of #GValue<!-- -->s holding the arguments on which to invoke the callback of @closure
945 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
946 // <marshal_data>: additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
947 extern (C) alias void function (Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint=null, void* marshal_data=null) ClosureMarshal;
950 // The type used for the various notification callbacks which can be registered
951 // on closures.
952 // <data>: data specified when registering the notification callback
953 // <closure>: the #GClosure on which the notification is emitted
954 extern (C) alias void function (void* data, Closure* closure) ClosureNotify;
956 struct ClosureNotifyData {
957 void* data;
958 ClosureNotify notify;
962 // The connection flags are used to specify the behaviour of a signal's
963 // connection.
964 enum ConnectFlags {
965 AFTER = 1,
966 SWAPPED = 2
969 // The class of an enumeration type holds information about its
970 // possible values.
971 struct EnumClass {
972 TypeClass g_type_class;
973 int minimum, maximum;
974 uint n_values;
975 EnumValue* values;
979 // A structure which contains a single enum value, its name, and its
980 // nickname.
981 struct EnumValue {
982 int value;
983 char* value_name, value_nick;
987 // The class of a flags type holds information about its
988 // possible values.
989 struct FlagsClass {
990 TypeClass g_type_class;
991 uint mask, n_values;
992 FlagsValue* values;
996 // A structure which contains a single flags value, its name, and its
997 // nickname.
998 struct FlagsValue {
999 uint value;
1000 char* value_name, value_nick;
1004 // All the fields in the <structname>GInitiallyUnowned</structname> structure
1005 // are private to the #GInitiallyUnowned implementation and should never be
1006 // accessed directly.
1007 struct InitiallyUnowned /* : Object */ {
1008 TypeInstance g_type_instance;
1009 private uint ref_count;
1010 private GLib2.Data* qdata;
1013 // The class structure for the <structname>GInitiallyUnowned</structname> type.
1014 struct InitiallyUnownedClass {
1015 TypeClass g_type_class;
1016 private GLib2.SList* construct_properties;
1017 // Unintrospectable functionp: constructor() / ()
1018 extern (C) Object* function (Type type, uint n_construct_properties, ObjectConstructParam* construct_properties) constructor;
1019 extern (C) void function (Object* object, uint property_id, Value* value, ParamSpec* pspec) set_property;
1020 extern (C) void function (Object* object, uint property_id, Value* value, ParamSpec* pspec) get_property;
1021 extern (C) void function (Object* object) dispose;
1022 extern (C) void function (Object* object) finalize;
1023 extern (C) void function (Object* object, uint n_pspecs, ParamSpec** pspecs) dispatch_properties_changed;
1024 extern (C) void function (Object* object, ParamSpec* pspec) notify;
1025 extern (C) void function (Object* object) constructed;
1026 private size_t flags;
1027 private void*[6] pdummy;
1031 // A callback function used by the type system to initialize a new
1032 // instance of a type. This function initializes all instance members and
1033 // allocates any resources required by it.
1034 // Initialization of a derived instance involves calling all its parent
1035 // types instance initializers, so the class member of the instance
1036 // is altered during its initialization to always point to the class that
1037 // belongs to the type the current initializer was introduced for.
1038 // <instance>: The instance to initialize.
1039 // <g_class>: The class of the type the instance is created for.
1040 extern (C) alias void function (TypeInstance* instance, void* g_class) InstanceInitFunc;
1043 // A callback function used by the type system to finalize an interface.
1044 // This function should destroy any internal data and release any resources
1045 // allocated by the corresponding GInterfaceInitFunc() function.
1046 // <g_iface>: The interface structure to finalize.
1047 // <iface_data>: The @interface_data supplied via the #GInterfaceInfo structure.
1048 extern (C) alias void function (void* g_iface, void* iface_data) InterfaceFinalizeFunc;
1051 // A structure that provides information to the type system which is
1052 // used specifically for managing interface types.
1053 struct InterfaceInfo {
1054 InterfaceInitFunc interface_init;
1055 InterfaceFinalizeFunc interface_finalize;
1056 void* interface_data;
1060 // A callback function used by the type system to initialize a new
1061 // interface. This function should initialize all internal data and
1062 // allocate any resources required by the interface.
1063 // <g_iface>: The interface structure to initialize.
1064 // <iface_data>: The @interface_data supplied via the #GInterfaceInfo structure.
1065 extern (C) alias void function (void* g_iface, void* iface_data) InterfaceInitFunc;
1068 // All the fields in the <structname>GObject</structname> structure are private
1069 // to the #GObject implementation and should never be accessed directly.
1070 struct Object {
1071 TypeInstance g_type_instance;
1072 private uint ref_count;
1073 private GLib2.Data* qdata;
1076 // Unintrospectable constructor: new_valist() / g_object_new_valist()
1077 // Creates a new instance of a #GObject subtype and sets its properties.
1079 // Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY)
1080 // which are not explicitly specified are set to their default values.
1081 // RETURNS: a new instance of @object_type
1082 // <object_type>: the type id of the #GObject subtype to instantiate
1083 // <first_property_name>: the name of the first property
1084 // <var_args>: the value of the first property, followed optionally by more name/value pairs, followed by %NULL
1085 static Object* /*new*/ new_valist(Type object_type, char* first_property_name, va_list var_args) {
1086 return g_object_new_valist(object_type, first_property_name, var_args);
1089 // Creates a new instance of a #GObject subtype and sets its properties.
1091 // Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY)
1092 // which are not explicitly specified are set to their default values.
1094 // @object_type
1095 // RETURNS: a new instance of
1096 // <object_type>: the type id of the #GObject subtype to instantiate
1097 // <n_parameters>: the length of the @parameters array
1098 // <parameters>: an array of #GParameter
1099 static Object* /*new*/ newv(Type object_type, uint n_parameters, Parameter* parameters) {
1100 return g_object_newv(object_type, n_parameters, parameters);
1103 // Creates a binding between @source_property on @source and @target_property
1104 // on @target. Whenever the @source_property is changed the @target_property is
1105 // updated using the same value. For instance:
1107 // |[
1108 // g_object_bind_property (action, "active", widget, "sensitive", 0);
1109 // ]|
1111 // Will result in the "sensitive" property of the widget #GObject instance to be
1112 // updated with the same value of the "active" property of the action #GObject
1113 // instance.
1115 // If @flags contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
1116 // if @target_property on @target changes then the @source_property on @source
1117 // will be updated as well.
1119 // The binding will automatically be removed when either the @source or the
1120 // @target instances are finalized. To remove the binding without affecting the
1121 // @source and the @target you can just call g_object_unref() on the returned
1122 // #GBinding instance.
1124 // A #GObject can have multiple bindings.
1126 // binding between the two #GObject instances. The binding is released
1127 // whenever the #GBinding reference count reaches zero.
1128 // RETURNS: the #GBinding instance representing the
1129 // <source>: the source #GObject
1130 // <source_property>: the property on @source to bind
1131 // <target>: the target #GObject
1132 // <target_property>: the property on @target to bind
1133 // <flags>: flags to pass to #GBinding
1134 static Binding* bind_property(void* source, char* source_property, void* target, char* target_property, BindingFlags flags) {
1135 return g_object_bind_property(source, source_property, target, target_property, flags);
1138 // Complete version of g_object_bind_property().
1140 // Creates a binding between @source_property on @source and @target_property
1141 // on @target, allowing you to set the transformation functions to be used by
1142 // the binding.
1144 // If @flags contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
1145 // if @target_property on @target changes then the @source_property on @source
1146 // will be updated as well. The @transform_from function is only used in case
1147 // of bidirectional bindings, otherwise it will be ignored
1149 // The binding will automatically be removed when either the @source or the
1150 // @target instances are finalized. To remove the binding without affecting the
1151 // @source and the @target you can just call g_object_unref() on the returned
1152 // #GBinding instance.
1154 // A #GObject can have multiple bindings.
1156 // <note>The same @user_data parameter will be used for both @transform_to
1157 // and @transform_from transformation functions; the @notify function will
1158 // be called once, when the binding is removed. If you need different data
1159 // for each transformation function, please use
1160 // g_object_bind_property_with_closures() instead.</note>
1162 // binding between the two #GObject instances. The binding is released
1163 // whenever the #GBinding reference count reaches zero.
1164 // RETURNS: the #GBinding instance representing the
1165 // <source>: the source #GObject
1166 // <source_property>: the property on @source to bind
1167 // <target>: the target #GObject
1168 // <target_property>: the property on @target to bind
1169 // <flags>: flags to pass to #GBinding
1170 // <transform_to>: the transformation function from the @source to the @target, or %NULL to use the default
1171 // <transform_from>: the transformation function from the @target to the @source, or %NULL to use the default
1172 // <user_data>: custom data to be passed to the transformation functions, or %NULL
1173 // <notify>: function to be called when disposing the binding, to free the resources used by the transformation functions
1174 static Binding* bind_property_full(void* source, char* source_property, void* target, char* target_property, BindingFlags flags, BindingTransformFunc transform_to, BindingTransformFunc transform_from, void* user_data, GLib2.DestroyNotify notify) {
1175 return g_object_bind_property_full(source, source_property, target, target_property, flags, transform_to, transform_from, user_data, notify);
1178 // Creates a binding between @source_property on @source and @target_property
1179 // on @target, allowing you to set the transformation functions to be used by
1180 // the binding.
1182 // This function is the language bindings friendly version of
1183 // g_object_bind_property_full(), using #GClosure<!-- -->s instead of
1184 // function pointers.
1187 // binding between the two #GObject instances. The binding is released
1188 // whenever the #GBinding reference count reaches zero.
1189 // RETURNS: the #GBinding instance representing the
1190 // <source>: the source #GObject
1191 // <source_property>: the property on @source to bind
1192 // <target>: the target #GObject
1193 // <target_property>: the property on @target to bind
1194 // <flags>: flags to pass to #GBinding
1195 // <transform_to>: a #GClosure wrapping the transformation function from the @source to the @target, or %NULL to use the default
1196 // <transform_from>: a #GClosure wrapping the transformation function from the @target to the @source, or %NULL to use the default
1197 static Binding* bind_property_with_closures(void* source, char* source_property, void* target, char* target_property, BindingFlags flags, Closure* transform_to, Closure* transform_from) {
1198 return g_object_bind_property_with_closures(source, source_property, target, target_property, flags, transform_to, transform_from);
1200 static size_t compat_control(size_t what, void* data) {
1201 return g_object_compat_control(what, data);
1204 // Unintrospectable function: connect() / g_object_connect()
1205 // A convenience function to connect multiple signals at once.
1207 // The signal specs expected by this function have the form
1208 // "modifier::signal_name", where modifier can be one of the following:
1209 // <variablelist>
1210 // <varlistentry>
1211 // <term>signal</term>
1212 // <listitem><para>
1213 // equivalent to <literal>g_signal_connect_data (..., NULL, 0)</literal>
1214 // </para></listitem>
1215 // </varlistentry>
1216 // <varlistentry>
1217 // <term>object_signal</term>
1218 // <term>object-signal</term>
1219 // <listitem><para>
1220 // equivalent to <literal>g_signal_connect_object (..., 0)</literal>
1221 // </para></listitem>
1222 // </varlistentry>
1223 // <varlistentry>
1224 // <term>swapped_signal</term>
1225 // <term>swapped-signal</term>
1226 // <listitem><para>
1227 // equivalent to <literal>g_signal_connect_data (..., NULL, G_CONNECT_SWAPPED)</literal>
1228 // </para></listitem>
1229 // </varlistentry>
1230 // <varlistentry>
1231 // <term>swapped_object_signal</term>
1232 // <term>swapped-object-signal</term>
1233 // <listitem><para>
1234 // equivalent to <literal>g_signal_connect_object (..., G_CONNECT_SWAPPED)</literal>
1235 // </para></listitem>
1236 // </varlistentry>
1237 // <varlistentry>
1238 // <term>signal_after</term>
1239 // <term>signal-after</term>
1240 // <listitem><para>
1241 // equivalent to <literal>g_signal_connect_data (..., NULL, G_CONNECT_AFTER)</literal>
1242 // </para></listitem>
1243 // </varlistentry>
1244 // <varlistentry>
1245 // <term>object_signal_after</term>
1246 // <term>object-signal-after</term>
1247 // <listitem><para>
1248 // equivalent to <literal>g_signal_connect_object (..., G_CONNECT_AFTER)</literal>
1249 // </para></listitem>
1250 // </varlistentry>
1251 // <varlistentry>
1252 // <term>swapped_signal_after</term>
1253 // <term>swapped-signal-after</term>
1254 // <listitem><para>
1255 // equivalent to <literal>g_signal_connect_data (..., NULL, G_CONNECT_SWAPPED | G_CONNECT_AFTER)</literal>
1256 // </para></listitem>
1257 // </varlistentry>
1258 // <varlistentry>
1259 // <term>swapped_object_signal_after</term>
1260 // <term>swapped-object-signal-after</term>
1261 // <listitem><para>
1262 // equivalent to <literal>g_signal_connect_object (..., G_CONNECT_SWAPPED | G_CONNECT_AFTER)</literal>
1263 // </para></listitem>
1264 // </varlistentry>
1265 // </variablelist>
1267 // |[
1268 // menu->toplevel = g_object_connect (g_object_new (GTK_TYPE_WINDOW,
1269 // "type", GTK_WINDOW_POPUP,
1270 // "child", menu,
1271 // NULL),
1272 // "signal::event", gtk_menu_window_event, menu,
1273 // "signal::size_request", gtk_menu_window_size_request, menu,
1274 // "signal::destroy", gtk_widget_destroyed, &amp;menu-&gt;toplevel,
1275 // NULL);
1276 // ]|
1277 // RETURNS: @object
1278 // <object>: a #GObject
1279 // <signal_spec>: the spec for the first signal
1280 alias g_object_connect connect; // Variadic
1282 // Unintrospectable function: disconnect() / g_object_disconnect()
1283 // A convenience function to disconnect multiple signals at once.
1285 // The signal specs expected by this function have the form
1286 // "any_signal", which means to disconnect any signal with matching
1287 // callback and data, or "any_signal::signal_name", which only
1288 // disconnects the signal named "signal_name".
1289 // <object>: a #GObject
1290 // <signal_spec>: the spec for the first signal
1291 alias g_object_disconnect disconnect; // Variadic
1293 // Unintrospectable function: get() / g_object_get()
1294 // Gets properties of an object.
1296 // In general, a copy is made of the property contents and the caller
1297 // is responsible for freeing the memory in the appropriate manner for
1298 // the type, for instance by calling g_free() or g_object_unref().
1300 // <example>
1301 // <title>Using g_object_get(<!-- -->)</title>
1302 // An example of using g_object_get() to get the contents
1303 // of three properties - one of type #G_TYPE_INT,
1304 // one of type #G_TYPE_STRING, and one of type #G_TYPE_OBJECT:
1305 // <programlisting>
1306 // gint intval;
1307 // gchar *strval;
1308 // GObject *objval;
1310 // g_object_get (my_object,
1311 // "int-property", &intval,
1312 // "str-property", &strval,
1313 // "obj-property", &objval,
1314 // NULL);
1316 // // Do something with intval, strval, objval
1318 // g_free (strval);
1319 // g_object_unref (objval);
1320 // </programlisting>
1321 // </example>
1322 // <object>: a #GObject
1323 // <first_property_name>: name of the first property to get
1324 alias g_object_get get; // Variadic
1326 // Find the #GParamSpec with the given name for an
1327 // interface. Generally, the interface vtable passed in as @g_iface
1328 // will be the default vtable from g_type_default_interface_ref(), or,
1329 // if you know the interface has already been loaded,
1330 // g_type_default_interface_peek().
1333 // interface with the name @property_name, or %NULL if no
1334 // such property exists.
1335 // RETURNS: the #GParamSpec for the property of the
1336 // <g_iface>: any interface vtable for the interface, or the default vtable for the interface
1337 // <property_name>: name of a property to lookup.
1338 static ParamSpec* interface_find_property(void* g_iface, char* property_name) {
1339 return g_object_interface_find_property(g_iface, property_name);
1342 // Add a property to an interface; this is only useful for interfaces
1343 // that are added to GObject-derived types. Adding a property to an
1344 // interface forces all objects classes with that interface to have a
1345 // compatible property. The compatible property could be a newly
1346 // created #GParamSpec, but normally
1347 // g_object_class_override_property() will be used so that the object
1348 // class only needs to provide an implementation and inherits the
1349 // property description, default value, bounds, and so forth from the
1350 // interface property.
1352 // This function is meant to be called from the interface's default
1353 // vtable initialization function (the @class_init member of
1354 // #GTypeInfo.) It must not be called after after @class_init has
1355 // been called for any object types implementing this interface.
1356 // <g_iface>: any interface vtable for the interface, or the default vtable for the interface.
1357 // <pspec>: the #GParamSpec for the new property
1358 static void interface_install_property(void* g_iface, ParamSpec* pspec) {
1359 g_object_interface_install_property(g_iface, pspec);
1362 // Lists the properties of an interface.Generally, the interface
1363 // vtable passed in as @g_iface will be the default vtable from
1364 // g_type_default_interface_ref(), or, if you know the interface has
1365 // already been loaded, g_type_default_interface_peek().
1368 // pointer to an array of pointers to #GParamSpec
1369 // structures. The paramspecs are owned by GLib, but the
1370 // array should be freed with g_free() when you are done with
1371 // it.
1372 // RETURNS: a
1373 // <g_iface>: any interface vtable for the interface, or the default vtable for the interface
1374 // <n_properties_p>: location to store number of properties returned.
1375 static ParamSpec** /*new container*/ interface_list_properties(void* g_iface, /*out*/ uint* n_properties_p) {
1376 return g_object_interface_list_properties(g_iface, n_properties_p);
1379 // Unintrospectable function: new() / g_object_new()
1380 // Creates a new instance of a #GObject subtype and sets its properties.
1382 // Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY)
1383 // which are not explicitly specified are set to their default values.
1384 // RETURNS: a new instance of @object_type
1385 // <object_type>: the type id of the #GObject subtype to instantiate
1386 // <first_property_name>: the name of the first property
1387 alias g_object_new new_; // Variadic
1389 // Unintrospectable function: set() / g_object_set()
1390 // Sets properties on an object.
1391 // <object>: a #GObject
1392 // <first_property_name>: name of the first property to set
1393 alias g_object_set set; // Variadic
1395 // Unintrospectable method: add_toggle_ref() / g_object_add_toggle_ref()
1396 // Increases the reference count of the object by one and sets a
1397 // callback to be called when all other references to the object are
1398 // dropped, or when this is already the last reference to the object
1399 // and another reference is established.
1401 // This functionality is intended for binding @object to a proxy
1402 // object managed by another memory manager. This is done with two
1403 // paired references: the strong reference added by
1404 // g_object_add_toggle_ref() and a reverse reference to the proxy
1405 // object which is either a strong reference or weak reference.
1407 // The setup is that when there are no other references to @object,
1408 // only a weak reference is held in the reverse direction from @object
1409 // to the proxy object, but when there are other references held to
1410 // @object, a strong reference is held. The @notify callback is called
1411 // when the reference from @object to the proxy object should be
1412 // <firstterm>toggled</firstterm> from strong to weak (@is_last_ref
1413 // true) or weak to strong (@is_last_ref false).
1415 // Since a (normal) reference must be held to the object before
1416 // calling g_object_toggle_ref(), the initial state of the reverse
1417 // link is always strong.
1419 // Multiple toggle references may be added to the same gobject,
1420 // however if there are multiple toggle references to an object, none
1421 // of them will ever be notified until all but one are removed. For
1422 // this reason, you should only ever use a toggle reference if there
1423 // is important state in the proxy object.
1424 // <notify>: a function to call when this reference is the last reference to the object, or is no longer the last reference.
1425 // <data>: data to pass to @notify
1426 void add_toggle_ref(ToggleNotify notify, void* data) {
1427 g_object_add_toggle_ref(&this, notify, data);
1430 // Unintrospectable method: add_weak_pointer() / g_object_add_weak_pointer()
1431 // Adds a weak reference from weak_pointer to @object to indicate that
1432 // the pointer located at @weak_pointer_location is only valid during
1433 // the lifetime of @object. When the @object is finalized,
1434 // @weak_pointer will be set to %NULL.
1435 // <weak_pointer_location>: The memory address of a pointer.
1436 void add_weak_pointer(/*inout*/ void** weak_pointer_location) {
1437 g_object_add_weak_pointer(&this, weak_pointer_location);
1440 // This function is intended for #GObject implementations to re-enforce a
1441 // <link linkend="floating-ref">floating</link> object reference.
1442 // Doing this is seldom required: all
1443 // #GInitiallyUnowned<!-- -->s are created with a floating reference which
1444 // usually just needs to be sunken by calling g_object_ref_sink().
1445 void force_floating() {
1446 g_object_force_floating(&this);
1449 // Increases the freeze count on @object. If the freeze count is
1450 // non-zero, the emission of "notify" signals on @object is
1451 // stopped. The signals are queued until the freeze count is decreased
1452 // to zero.
1454 // This is necessary for accessors that modify multiple properties to prevent
1455 // premature notification while the object is still being modified.
1456 void freeze_notify() {
1457 g_object_freeze_notify(&this);
1460 // Gets a named field from the objects table of associations (see g_object_set_data()).
1461 // RETURNS: the data if found, or %NULL if no such data exists.
1462 // <key>: name of the key for that association
1463 void* get_data(char* key) {
1464 return g_object_get_data(&this, key);
1467 // Gets a property of an object. @value must have been initialized to the
1468 // expected type of the property (or a type to which the expected type can be
1469 // transformed) using g_value_init().
1471 // In general, a copy is made of the property contents and the caller is
1472 // responsible for freeing the memory by calling g_value_unset().
1474 // Note that g_object_get_property() is really intended for language
1475 // bindings, g_object_get() is much more convenient for C programming.
1476 // <property_name>: the name of the property to get
1477 // <value>: return location for the property value
1478 void get_property(char* property_name, Value* value) {
1479 g_object_get_property(&this, property_name, value);
1482 // This function gets back user data pointers stored via
1483 // g_object_set_qdata().
1484 // RETURNS: The user data pointer set, or %NULL
1485 // <quark>: A #GQuark, naming the user data pointer
1486 void* get_qdata(GLib2.Quark quark) {
1487 return g_object_get_qdata(&this, quark);
1490 // Unintrospectable method: get_valist() / g_object_get_valist()
1491 // Gets properties of an object.
1493 // In general, a copy is made of the property contents and the caller
1494 // is responsible for freeing the memory in the appropriate manner for
1495 // the type, for instance by calling g_free() or g_object_unref().
1497 // See g_object_get().
1498 // <first_property_name>: name of the first property to get
1499 // <var_args>: return location for the first property, followed optionally by more name/return location pairs, followed by %NULL
1500 void get_valist(char* first_property_name, va_list var_args) {
1501 g_object_get_valist(&this, first_property_name, var_args);
1504 // Checks whether @object has a <link linkend="floating-ref">floating</link>
1505 // reference.
1506 // RETURNS: %TRUE if @object has a floating reference
1507 int is_floating() {
1508 return g_object_is_floating(&this);
1511 // Emits a "notify" signal for the property @property_name on @object.
1513 // When possible, eg. when signaling a property change from within the class
1514 // that registered the property, you should use g_object_notify_by_pspec()
1515 // instead.
1516 // <property_name>: the name of a property installed on the class of @object.
1517 void notify(char* property_name) {
1518 g_object_notify(&this, property_name);
1521 // Emits a "notify" signal for the property specified by @pspec on @object.
1523 // This function omits the property name lookup, hence it is faster than
1524 // g_object_notify().
1526 // One way to avoid using g_object_notify() from within the
1527 // class that registered the properties, and using g_object_notify_by_pspec()
1528 // instead, is to store the GParamSpec used with
1529 // g_object_class_install_property() inside a static array, e.g.:
1531 // |[
1532 // enum
1533 // {
1534 // PROP_0,
1535 // PROP_FOO,
1536 // PROP_LAST
1537 // };
1539 // static GParamSpec *properties[PROP_LAST];
1541 // static void
1542 // my_object_class_init (MyObjectClass *klass)
1543 // {
1544 // properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
1545 // 0, 100,
1546 // 50,
1547 // G_PARAM_READWRITE);
1548 // g_object_class_install_property (gobject_class,
1549 // PROP_FOO,
1550 // properties[PROP_FOO]);
1551 // }
1552 // ]|
1554 // and then notify a change on the "foo" property with:
1556 // |[
1557 // g_object_notify_by_pspec (self, properties[PROP_FOO]);
1558 // ]|
1559 // <pspec>: the #GParamSpec of a property installed on the class of @object.
1560 void notify_by_pspec(ParamSpec* pspec) {
1561 g_object_notify_by_pspec(&this, pspec);
1564 // Increases the reference count of @object.
1565 // RETURNS: the same @object
1566 Object* ref_() {
1567 return g_object_ref(&this);
1570 // Increase the reference count of @object, and possibly remove the
1571 // <link linkend="floating-ref">floating</link> reference, if @object
1572 // has a floating reference.
1574 // In other words, if the object is floating, then this call "assumes
1575 // ownership" of the floating reference, converting it to a normal
1576 // reference by clearing the floating flag while leaving the reference
1577 // count unchanged. If the object is not floating, then this call
1578 // adds a new normal reference increasing the reference count by one.
1579 // RETURNS: @object
1580 Object* ref_sink() {
1581 return g_object_ref_sink(&this);
1584 // Unintrospectable method: remove_toggle_ref() / g_object_remove_toggle_ref()
1585 // Removes a reference added with g_object_add_toggle_ref(). The
1586 // reference count of the object is decreased by one.
1587 // <notify>: a function to call when this reference is the last reference to the object, or is no longer the last reference.
1588 // <data>: data to pass to @notify
1589 void remove_toggle_ref(ToggleNotify notify, void* data) {
1590 g_object_remove_toggle_ref(&this, notify, data);
1593 // Unintrospectable method: remove_weak_pointer() / g_object_remove_weak_pointer()
1594 // Removes a weak reference from @object that was previously added
1595 // using g_object_add_weak_pointer(). The @weak_pointer_location has
1596 // to match the one used with g_object_add_weak_pointer().
1597 // <weak_pointer_location>: The memory address of a pointer.
1598 void remove_weak_pointer(/*inout*/ void** weak_pointer_location) {
1599 g_object_remove_weak_pointer(&this, weak_pointer_location);
1602 // Releases all references to other objects. This can be used to break
1603 // reference cycles.
1605 // This functions should only be called from object system implementations.
1606 void run_dispose() {
1607 g_object_run_dispose(&this);
1610 // Each object carries around a table of associations from
1611 // strings to pointers. This function lets you set an association.
1613 // If the object already had an association with that name,
1614 // the old association will be destroyed.
1615 // <key>: name of the key
1616 // <data>: data to associate with that key
1617 void set_data(char* key, void* data) {
1618 g_object_set_data(&this, key, data);
1621 // Unintrospectable method: set_data_full() / g_object_set_data_full()
1622 // Like g_object_set_data() except it adds notification
1623 // for when the association is destroyed, either by setting it
1624 // to a different value or when the object is destroyed.
1626 // Note that the @destroy callback is not called if @data is %NULL.
1627 // <key>: name of the key
1628 // <data>: data to associate with that key
1629 // <destroy>: function to call when the association is destroyed
1630 void set_data_full(char* key, void* data, GLib2.DestroyNotify destroy) {
1631 g_object_set_data_full(&this, key, data, destroy);
1634 // Sets a property on an object.
1635 // <property_name>: the name of the property to set
1636 // <value>: the value
1637 void set_property(char* property_name, Value* value) {
1638 g_object_set_property(&this, property_name, value);
1641 // Unintrospectable method: set_qdata() / g_object_set_qdata()
1642 // This sets an opaque, named pointer on an object.
1643 // The name is specified through a #GQuark (retrived e.g. via
1644 // g_quark_from_static_string()), and the pointer
1645 // can be gotten back from the @object with g_object_get_qdata()
1646 // until the @object is finalized.
1647 // Setting a previously set user data pointer, overrides (frees)
1648 // the old pointer set, using #NULL as pointer essentially
1649 // removes the data stored.
1650 // <quark>: A #GQuark, naming the user data pointer
1651 // <data>: An opaque user data pointer
1652 void set_qdata(GLib2.Quark quark, void* data) {
1653 g_object_set_qdata(&this, quark, data);
1656 // Unintrospectable method: set_qdata_full() / g_object_set_qdata_full()
1657 // This function works like g_object_set_qdata(), but in addition,
1658 // a void (*destroy) (gpointer) function may be specified which is
1659 // called with @data as argument when the @object is finalized, or
1660 // the data is being overwritten by a call to g_object_set_qdata()
1661 // with the same @quark.
1662 // <quark>: A #GQuark, naming the user data pointer
1663 // <data>: An opaque user data pointer
1664 // <destroy>: Function to invoke with @data as argument, when @data needs to be freed
1665 void set_qdata_full(GLib2.Quark quark, void* data, GLib2.DestroyNotify destroy) {
1666 g_object_set_qdata_full(&this, quark, data, destroy);
1669 // Unintrospectable method: set_valist() / g_object_set_valist()
1670 // Sets properties on an object.
1671 // <first_property_name>: name of the first property to set
1672 // <var_args>: value for the first property, followed optionally by more name/value pairs, followed by %NULL
1673 void set_valist(char* first_property_name, va_list var_args) {
1674 g_object_set_valist(&this, first_property_name, var_args);
1677 // Remove a specified datum from the object's data associations,
1678 // without invoking the association's destroy handler.
1679 // RETURNS: the data if found, or %NULL if no such data exists.
1680 // <key>: name of the key
1681 void* /*new*/ steal_data(char* key) {
1682 return g_object_steal_data(&this, key);
1685 // This function gets back user data pointers stored via
1686 // g_object_set_qdata() and removes the @data from object
1687 // without invoking its destroy() function (if any was
1688 // set).
1689 // Usually, calling this function is only required to update
1690 // user data pointers with a destroy notifier, for example:
1691 // |[
1692 // void
1693 // object_add_to_user_list (GObject *object,
1694 // const gchar *new_string)
1695 // {
1696 // // the quark, naming the object data
1697 // GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
1698 // // retrive the old string list
1699 // GList *list = g_object_steal_qdata (object, quark_string_list);
1701 // // prepend new string
1702 // list = g_list_prepend (list, g_strdup (new_string));
1703 // // this changed 'list', so we need to set it again
1704 // g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
1705 // }
1706 // static void
1707 // free_string_list (gpointer data)
1708 // {
1709 // GList *node, *list = data;
1711 // for (node = list; node; node = node->next)
1712 // g_free (node->data);
1713 // g_list_free (list);
1714 // }
1715 // ]|
1716 // Using g_object_get_qdata() in the above example, instead of
1717 // g_object_steal_qdata() would have left the destroy function set,
1718 // and thus the partial string list would have been freed upon
1719 // g_object_set_qdata_full().
1720 // RETURNS: The user data pointer set, or %NULL
1721 // <quark>: A #GQuark, naming the user data pointer
1722 void* /*new*/ steal_qdata(GLib2.Quark quark) {
1723 return g_object_steal_qdata(&this, quark);
1726 // Reverts the effect of a previous call to
1727 // g_object_freeze_notify(). The freeze count is decreased on @object
1728 // and when it reaches zero, all queued "notify" signals are emitted.
1730 // It is an error to call this function when the freeze count is zero.
1731 void thaw_notify() {
1732 g_object_thaw_notify(&this);
1735 // Decreases the reference count of @object. When its reference count
1736 // drops to 0, the object is finalized (i.e. its memory is freed).
1737 void unref() {
1738 g_object_unref(&this);
1741 // This function essentially limits the life time of the @closure to
1742 // the life time of the object. That is, when the object is finalized,
1743 // the @closure is invalidated by calling g_closure_invalidate() on
1744 // it, in order to prevent invocations of the closure with a finalized
1745 // (nonexisting) object. Also, g_object_ref() and g_object_unref() are
1746 // added as marshal guards to the @closure, to ensure that an extra
1747 // reference count is held on @object during invocation of the
1748 // @closure. Usually, this function will be called on closures that
1749 // use this @object as closure data.
1750 // <closure>: GClosure to watch
1751 void watch_closure(Closure* closure) {
1752 g_object_watch_closure(&this, closure);
1755 // Unintrospectable method: weak_ref() / g_object_weak_ref()
1756 // Adds a weak reference callback to an object. Weak references are
1757 // used for notification when an object is finalized. They are called
1758 // "weak references" because they allow you to safely hold a pointer
1759 // to an object without calling g_object_ref() (g_object_ref() adds a
1760 // strong reference, that is, forces the object to stay alive).
1761 // <notify>: callback to invoke before the object is freed
1762 // <data>: extra data to pass to notify
1763 void weak_ref(WeakNotify notify, void* data) {
1764 g_object_weak_ref(&this, notify, data);
1767 // Unintrospectable method: weak_unref() / g_object_weak_unref()
1768 // Removes a weak reference callback to an object.
1769 // <notify>: callback to search for
1770 // <data>: data to search for
1771 void weak_unref(WeakNotify notify, void* data) {
1772 g_object_weak_unref(&this, notify, data);
1775 // The notify signal is emitted on an object when one of its
1776 // properties has been changed. Note that getting this signal
1777 // doesn't guarantee that the value of the property has actually
1778 // changed, it may also be emitted when the setter for the property
1779 // is called to reinstate the previous value.
1781 // This signal is typically used to obtain change notification for a
1782 // single property, by specifying the property name as a detail in the
1783 // g_signal_connect() call, like this:
1784 // |[
1785 // g_signal_connect (text_view->buffer, "notify::paste-target-list",
1786 // G_CALLBACK (gtk_text_view_target_list_notify),
1787 // text_view)
1788 // ]|
1789 // It is important to note that you must use
1790 // <link linkend="canonical-parameter-name">canonical</link> parameter names as
1791 // detail strings for the notify signal.
1792 // <pspec>: the #GParamSpec of the property which changed.
1793 extern (C) alias static void function (Object* this_, ParamSpec* pspec, void* user_data=null) signal_notify;
1795 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
1796 return super_.signal_connect!name(cb, data, cf);
1799 ulong signal_connect(string name:"notify", CB/*:signal_notify*/)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
1800 return signal_connect_data(&this, cast(char*)"notify",
1801 cast(GObject2.Callback)cb, data, null, cf);
1806 // The class structure for the <structname>GObject</structname> type.
1808 // <example>
1809 // <title>Implementing singletons using a constructor</title>
1810 // <programlisting>
1811 // static MySingleton *the_singleton = NULL;
1813 // static GObject*
1814 // my_singleton_constructor (GType type,
1815 // guint n_construct_params,
1816 // GObjectConstructParam *construct_params)
1817 // {
1818 // GObject *object;
1820 // if (!the_singleton)
1821 // {
1822 // object = G_OBJECT_CLASS (parent_class)->constructor (type,
1823 // n_construct_params,
1824 // construct_params);
1825 // the_singleton = MY_SINGLETON (object);
1826 // }
1827 // else
1828 // object = g_object_ref (G_OBJECT (the_singleton));
1830 // return object;
1831 // }
1832 // </programlisting></example>
1833 struct ObjectClass {
1834 TypeClass g_type_class;
1835 private GLib2.SList* construct_properties;
1836 // Unintrospectable functionp: constructor() / ()
1837 extern (C) Object* function (Type type, uint n_construct_properties, ObjectConstructParam* construct_properties) constructor;
1838 extern (C) void function (Object* object, uint property_id, Value* value, ParamSpec* pspec) set_property;
1839 extern (C) void function (Object* object, uint property_id, Value* value, ParamSpec* pspec) get_property;
1840 extern (C) void function (Object* object) dispose;
1841 extern (C) void function (Object* object) finalize;
1842 extern (C) void function (Object* object, uint n_pspecs, ParamSpec** pspecs) dispatch_properties_changed;
1843 extern (C) void function (Object* object, ParamSpec* pspec) notify;
1844 extern (C) void function (Object* object) constructed;
1845 private size_t flags;
1846 private void*[6] pdummy;
1849 // Looks up the #GParamSpec for a property of a class.
1851 // %NULL if the class doesn't have a property of that name
1852 // RETURNS: the #GParamSpec for the property, or
1853 // <property_name>: the name of the property to look up
1854 ParamSpec* find_property(char* property_name) {
1855 return g_object_class_find_property(&this, property_name);
1858 // Installs new properties from an array of #GParamSpec<!-- -->s. This is
1859 // usually done in the class initializer.
1861 // The property id of each property is the index of each #GParamSpec in
1862 // the @pspecs array.
1864 // The property id of 0 is treated specially by #GObject and it should not
1865 // be used to store a #GParamSpec.
1867 // This function should be used if you plan to use a static array of
1868 // #GParamSpec<!-- -->s and g_object_notify_by_pspec(). For instance, this
1869 // class initialization:
1871 // |[
1872 // enum {
1873 // PROP_0, PROP_FOO, PROP_BAR, N_PROPERTIES
1874 // };
1876 // static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, };
1878 // static void
1879 // my_object_class_init (MyObjectClass *klass)
1880 // {
1881 // GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
1883 // obj_properties[PROP_FOO] =
1884 // g_param_spec_int ("foo", "Foo", "Foo",
1885 // -1, G_MAXINT,
1886 // 0,
1887 // G_PARAM_READWRITE);
1889 // obj_properties[PROP_BAR] =
1890 // g_param_spec_string ("bar", "Bar", "Bar",
1891 // NULL,
1892 // G_PARAM_READWRITE);
1894 // gobject_class->set_property = my_object_set_property;
1895 // gobject_class->get_property = my_object_get_property;
1896 // g_object_class_install_properties (gobject_class,
1897 // N_PROPERTIES,
1898 // obj_properties);
1899 // }
1900 // ]|
1902 // allows calling g_object_notify_by_pspec() to notify of property changes:
1904 // |[
1905 // void
1906 // my_object_set_foo (MyObject *self, gint foo)
1907 // {
1908 // if (self->foo != foo)
1909 // {
1910 // self->foo = foo;
1911 // g_object_notify_by_pspec (G_OBJECT (self), obj_properties[PROP_FOO]);
1912 // }
1913 // }
1914 // ]|
1915 // <n_pspecs>: the length of the #GParamSpec<!-- -->s array
1916 // <pspecs>: the #GParamSpec<!-- -->s array defining the new properties
1917 void install_properties(uint n_pspecs, ParamSpec** pspecs) {
1918 g_object_class_install_properties(&this, n_pspecs, pspecs);
1921 // Installs a new property. This is usually done in the class initializer.
1923 // Note that it is possible to redefine a property in a derived class,
1924 // by installing a property with the same name. This can be useful at times,
1925 // e.g. to change the range of allowed values or the default value.
1926 // <property_id>: the id for the new property
1927 // <pspec>: the #GParamSpec for the new property
1928 void install_property(uint property_id, ParamSpec* pspec) {
1929 g_object_class_install_property(&this, property_id, pspec);
1932 // Get an array of #GParamSpec* for all properties of a class.
1934 // #GParamSpec* which should be freed after use
1935 // RETURNS: an array of
1936 // <n_properties>: return location for the length of the returned array
1937 ParamSpec** /*new container*/ list_properties(/*out*/ uint* n_properties) {
1938 return g_object_class_list_properties(&this, n_properties);
1941 // Registers @property_id as referring to a property with the
1942 // name @name in a parent class or in an interface implemented
1943 // by @oclass. This allows this class to <firstterm>override</firstterm>
1944 // a property implementation in a parent class or to provide
1945 // the implementation of a property from an interface.
1947 // <note>
1948 // Internally, overriding is implemented by creating a property of type
1949 // #GParamSpecOverride; generally operations that query the properties of
1950 // the object class, such as g_object_class_find_property() or
1951 // g_object_class_list_properties() will return the overridden
1952 // property. However, in one case, the @construct_properties argument of
1953 // the @constructor virtual function, the #GParamSpecOverride is passed
1954 // instead, so that the @param_id field of the #GParamSpec will be
1955 // correct. For virtually all uses, this makes no difference. If you
1956 // need to get the overridden property, you can call
1957 // g_param_spec_get_redirect_target().
1958 // </note>
1959 // <property_id>: the new property ID
1960 // <name>: the name of a property registered in a parent class or in an interface of this class.
1961 void override_property(uint property_id, char* name) {
1962 g_object_class_override_property(&this, property_id, name);
1967 // The <structname>GObjectConstructParam</structname> struct is an auxiliary
1968 // structure used to hand #GParamSpec/#GValue pairs to the @constructor of
1969 // a #GObjectClass.
1970 struct ObjectConstructParam {
1971 ParamSpec* pspec;
1972 Value* value;
1976 // The type of the @finalize function of #GObjectClass.
1977 // <object>: the #GObject being finalized
1978 extern (C) alias void function (Object* object) ObjectFinalizeFunc;
1981 // The type of the @get_property function of #GObjectClass.
1982 // <object>: a #GObject
1983 // <property_id>: the numeric id under which the property was registered with g_object_class_install_property().
1984 // <value>: a #GValue to return the property value in
1985 // <pspec>: the #GParamSpec describing the property
1986 extern (C) alias void function (Object* object, uint property_id, Value* value, ParamSpec* pspec) ObjectGetPropertyFunc;
1989 // The type of the @set_property function of #GObjectClass.
1990 // <object>: a #GObject
1991 // <property_id>: the numeric id under which the property was registered with g_object_class_install_property().
1992 // <value>: the new value for the property
1993 // <pspec>: the #GParamSpec describing the property
1994 extern (C) alias void function (Object* object, uint property_id, Value* value, ParamSpec* pspec) ObjectSetPropertyFunc;
1996 enum int PARAM_MASK = 255;
1997 enum int PARAM_READWRITE = 0;
1998 enum int PARAM_STATIC_STRINGS = 0;
1999 enum int PARAM_USER_SHIFT = 8;
2001 // Through the #GParamFlags flag values, certain aspects of parameters
2002 // can be configured.
2003 enum ParamFlags {
2004 READABLE = 1,
2005 WRITABLE = 2,
2006 CONSTRUCT = 4,
2007 CONSTRUCT_ONLY = 8,
2008 LAX_VALIDATION = 16,
2009 STATIC_NAME = 32,
2010 PRIVATE = 32,
2011 STATIC_NICK = 64,
2012 STATIC_BLURB = 128,
2013 DEPRECATED = cast(uint)2147483648
2016 // #GParamSpec is an object structure that encapsulates the metadata
2017 // required to specify parameters, such as e.g. #GObject properties.
2019 // <para id="canonical-parameter-name">
2020 // Parameter names need to start with a letter (a-z or A-Z). Subsequent
2021 // characters can be letters, numbers or a '-'.
2022 // All other characters are replaced by a '-' during construction.
2023 // The result of this replacement is called the canonical name of the
2024 // parameter.
2025 // </para>
2026 struct ParamSpec {
2027 TypeInstance g_type_instance;
2028 char* name;
2029 ParamFlags flags;
2030 Type value_type, owner_type;
2031 private char* _nick, _blurb;
2032 private GLib2.Data* qdata;
2033 private uint ref_count, param_id;
2036 // Unintrospectable function: internal() / g_param_spec_internal()
2037 // Creates a new #GParamSpec instance.
2039 // A property name consists of segments consisting of ASCII letters and
2040 // digits, separated by either the '-' or '_' character. The first
2041 // character of a property name must be a letter. Names which violate these
2042 // rules lead to undefined behaviour.
2044 // When creating and looking up a #GParamSpec, either separator can be
2045 // used, but they cannot be mixed. Using '-' is considerably more
2046 // efficient and in fact required when using property names as detail
2047 // strings for signals.
2049 // Beyond the name, #GParamSpec<!-- -->s have two more descriptive
2050 // strings associated with them, the @nick, which should be suitable
2051 // for use as a label for the property in a property editor, and the
2052 // @blurb, which should be a somewhat longer description, suitable for
2053 // e.g. a tooltip. The @nick and @blurb should ideally be localized.
2054 // RETURNS: a newly allocated #GParamSpec instance
2055 // <param_type>: the #GType for the property; must be derived from #G_TYPE_PARAM
2056 // <name>: the canonical name of the property
2057 // <nick>: the nickname of the property
2058 // <blurb>: a short description of the property
2059 // <flags>: a combination of #GParamFlags
2060 static void* internal(Type param_type, char* name, char* nick, char* blurb, ParamFlags flags) {
2061 return g_param_spec_internal(param_type, name, nick, blurb, flags);
2064 // Get the short description of a #GParamSpec.
2065 // RETURNS: the short description of @pspec.
2066 char* get_blurb() {
2067 return g_param_spec_get_blurb(&this);
2070 // Get the name of a #GParamSpec.
2072 // The name is always an "interned" string (as per g_intern_string()).
2073 // This allows for pointer-value comparisons.
2074 // RETURNS: the name of @pspec.
2075 char* get_name() {
2076 return g_param_spec_get_name(&this);
2079 // Get the nickname of a #GParamSpec.
2080 // RETURNS: the nickname of @pspec.
2081 char* get_nick() {
2082 return g_param_spec_get_nick(&this);
2085 // Gets back user data pointers stored via g_param_spec_set_qdata().
2086 // RETURNS: the user data pointer set, or %NULL
2087 // <quark>: a #GQuark, naming the user data pointer
2088 void* get_qdata(GLib2.Quark quark) {
2089 return g_param_spec_get_qdata(&this, quark);
2092 // If the paramspec redirects operations to another paramspec,
2093 // returns that paramspec. Redirect is used typically for
2094 // providing a new implementation of a property in a derived
2095 // type while preserving all the properties from the parent
2096 // type. Redirection is established by creating a property
2097 // of type #GParamSpecOverride. See g_object_class_override_property()
2098 // for an example of the use of this capability.
2101 // paramspec should be redirected, or %NULL if none.
2102 // RETURNS: paramspec to which requests on this
2103 ParamSpec* get_redirect_target() {
2104 return g_param_spec_get_redirect_target(&this);
2107 // Unintrospectable method: ref() / g_param_spec_ref()
2108 // Increments the reference count of @pspec.
2109 // RETURNS: the #GParamSpec that was passed into this function
2110 ParamSpec* ref_() {
2111 return g_param_spec_ref(&this);
2114 // Unintrospectable method: ref_sink() / g_param_spec_ref_sink()
2115 // Convenience function to ref and sink a #GParamSpec.
2116 // RETURNS: the #GParamSpec that was passed into this function
2117 ParamSpec* ref_sink() {
2118 return g_param_spec_ref_sink(&this);
2121 // Sets an opaque, named pointer on a #GParamSpec. The name is
2122 // specified through a #GQuark (retrieved e.g. via
2123 // g_quark_from_static_string()), and the pointer can be gotten back
2124 // from the @pspec with g_param_spec_get_qdata(). Setting a
2125 // previously set user data pointer, overrides (frees) the old pointer
2126 // set, using %NULL as pointer essentially removes the data stored.
2127 // <quark>: a #GQuark, naming the user data pointer
2128 // <data>: an opaque user data pointer
2129 void set_qdata(GLib2.Quark quark, void* data) {
2130 g_param_spec_set_qdata(&this, quark, data);
2133 // Unintrospectable method: set_qdata_full() / g_param_spec_set_qdata_full()
2134 // This function works like g_param_spec_set_qdata(), but in addition,
2135 // a <literal>void (*destroy) (gpointer)</literal> function may be
2136 // specified which is called with @data as argument when the @pspec is
2137 // finalized, or the data is being overwritten by a call to
2138 // g_param_spec_set_qdata() with the same @quark.
2139 // <quark>: a #GQuark, naming the user data pointer
2140 // <data>: an opaque user data pointer
2141 // <destroy>: function to invoke with @data as argument, when @data needs to be freed
2142 void set_qdata_full(GLib2.Quark quark, void* data, GLib2.DestroyNotify destroy) {
2143 g_param_spec_set_qdata_full(&this, quark, data, destroy);
2146 // The initial reference count of a newly created #GParamSpec is 1,
2147 // even though no one has explicitly called g_param_spec_ref() on it
2148 // yet. So the initial reference count is flagged as "floating", until
2149 // someone calls <literal>g_param_spec_ref (pspec); g_param_spec_sink
2150 // (pspec);</literal> in sequence on it, taking over the initial
2151 // reference count (thus ending up with a @pspec that has a reference
2152 // count of 1 still, but is not flagged "floating" anymore).
2153 void sink() {
2154 g_param_spec_sink(&this);
2157 // Gets back user data pointers stored via g_param_spec_set_qdata()
2158 // and removes the @data from @pspec without invoking its destroy()
2159 // function (if any was set). Usually, calling this function is only
2160 // required to update user data pointers with a destroy notifier.
2161 // RETURNS: the user data pointer set, or %NULL
2162 // <quark>: a #GQuark, naming the user data pointer
2163 void* steal_qdata(GLib2.Quark quark) {
2164 return g_param_spec_steal_qdata(&this, quark);
2167 // Unintrospectable method: unref() / g_param_spec_unref()
2168 // Decrements the reference count of a @pspec.
2169 void unref() {
2170 g_param_spec_unref(&this);
2174 // A #GParamSpec derived structure that contains the meta data for boolean properties.
2175 struct ParamSpecBoolean /* : ParamSpec */ {
2176 alias parent_instance this;
2177 alias parent_instance super_;
2178 alias parent_instance paramspec;
2179 ParamSpec parent_instance;
2180 int default_value;
2183 // A #GParamSpec derived structure that contains the meta data for boxed properties.
2184 struct ParamSpecBoxed /* : ParamSpec */ {
2185 alias parent_instance this;
2186 alias parent_instance super_;
2187 alias parent_instance paramspec;
2188 ParamSpec parent_instance;
2191 // A #GParamSpec derived structure that contains the meta data for character properties.
2192 struct ParamSpecChar /* : ParamSpec */ {
2193 alias parent_instance this;
2194 alias parent_instance super_;
2195 alias parent_instance paramspec;
2196 ParamSpec parent_instance;
2197 byte minimum, maximum, default_value;
2201 // The class structure for the <structname>GParamSpec</structname> type.
2202 // Normally, <structname>GParamSpec</structname> classes are filled by
2203 // g_param_type_register_static().
2204 struct ParamSpecClass {
2205 TypeClass g_type_class;
2206 Type value_type;
2207 extern (C) void function (ParamSpec* pspec) finalize;
2208 extern (C) void function (ParamSpec* pspec, Value* value) value_set_default;
2209 extern (C) int function (ParamSpec* pspec, Value* value) value_validate;
2210 extern (C) int function (ParamSpec* pspec, Value* value1, Value* value2) values_cmp;
2211 private void*[4] dummy;
2214 // A #GParamSpec derived structure that contains the meta data for double properties.
2215 struct ParamSpecDouble /* : ParamSpec */ {
2216 alias parent_instance this;
2217 alias parent_instance super_;
2218 alias parent_instance paramspec;
2219 ParamSpec parent_instance;
2220 double minimum, maximum, default_value, epsilon;
2224 // A #GParamSpec derived structure that contains the meta data for enum
2225 // properties.
2226 struct ParamSpecEnum /* : ParamSpec */ {
2227 alias parent_instance this;
2228 alias parent_instance super_;
2229 alias parent_instance paramspec;
2230 ParamSpec parent_instance;
2231 EnumClass* enum_class;
2232 int default_value;
2236 // A #GParamSpec derived structure that contains the meta data for flags
2237 // properties.
2238 struct ParamSpecFlags /* : ParamSpec */ {
2239 alias parent_instance this;
2240 alias parent_instance super_;
2241 alias parent_instance paramspec;
2242 ParamSpec parent_instance;
2243 FlagsClass* flags_class;
2244 uint default_value;
2247 // A #GParamSpec derived structure that contains the meta data for float properties.
2248 struct ParamSpecFloat /* : ParamSpec */ {
2249 alias parent_instance this;
2250 alias parent_instance super_;
2251 alias parent_instance paramspec;
2252 ParamSpec parent_instance;
2253 float minimum, maximum, default_value, epsilon;
2256 // A #GParamSpec derived structure that contains the meta data for #GType properties.
2257 struct ParamSpecGType /* : ParamSpec */ /* Version 2.10 */ {
2258 alias parent_instance this;
2259 alias parent_instance super_;
2260 alias parent_instance paramspec;
2261 ParamSpec parent_instance;
2262 Type is_a_type;
2265 // A #GParamSpec derived structure that contains the meta data for integer properties.
2266 struct ParamSpecInt /* : ParamSpec */ {
2267 alias parent_instance this;
2268 alias parent_instance super_;
2269 alias parent_instance paramspec;
2270 ParamSpec parent_instance;
2271 int minimum, maximum, default_value;
2274 // A #GParamSpec derived structure that contains the meta data for 64bit integer properties.
2275 struct ParamSpecInt64 /* : ParamSpec */ {
2276 alias parent_instance this;
2277 alias parent_instance super_;
2278 alias parent_instance paramspec;
2279 ParamSpec parent_instance;
2280 long minimum, maximum, default_value;
2283 // A #GParamSpec derived structure that contains the meta data for long integer properties.
2284 struct ParamSpecLong /* : ParamSpec */ {
2285 alias parent_instance this;
2286 alias parent_instance super_;
2287 alias parent_instance paramspec;
2288 ParamSpec parent_instance;
2289 c_long minimum, maximum, default_value;
2292 // A #GParamSpec derived structure that contains the meta data for object properties.
2293 struct ParamSpecObject /* : ParamSpec */ {
2294 alias parent_instance this;
2295 alias parent_instance super_;
2296 alias parent_instance paramspec;
2297 ParamSpec parent_instance;
2301 // This is a type of #GParamSpec type that simply redirects operations to
2302 // another paramspec. All operations other than getting or
2303 // setting the value are redirected, including accessing the nick and
2304 // blurb, validating a value, and so forth. See
2305 // g_param_spec_get_redirect_target() for retrieving the overidden
2306 // property. #GParamSpecOverride is used in implementing
2307 // g_object_class_override_property(), and will not be directly useful
2308 // unless you are implementing a new base type similar to GObject.
2309 struct ParamSpecOverride /* : ParamSpec */ /* Version 2.4 */ {
2310 alias parent_instance this;
2311 alias parent_instance super_;
2312 alias parent_instance paramspec;
2313 ParamSpec parent_instance;
2314 private ParamSpec* overridden;
2318 // A #GParamSpec derived structure that contains the meta data for %G_TYPE_PARAM
2319 // properties.
2320 struct ParamSpecParam /* : ParamSpec */ {
2321 alias parent_instance this;
2322 alias parent_instance super_;
2323 alias parent_instance paramspec;
2324 ParamSpec parent_instance;
2327 // A #GParamSpec derived structure that contains the meta data for pointer properties.
2328 struct ParamSpecPointer /* : ParamSpec */ {
2329 alias parent_instance this;
2330 alias parent_instance super_;
2331 alias parent_instance paramspec;
2332 ParamSpec parent_instance;
2336 // A #GParamSpecPool maintains a collection of #GParamSpec<!-- -->s which can be
2337 // quickly accessed by owner and name. The implementation of the #GObject property
2338 // system uses such a pool to store the #GParamSpecs of the properties all object
2339 // types.
2340 struct ParamSpecPool {
2342 // Inserts a #GParamSpec in the pool.
2343 // <pspec>: the #GParamSpec to insert
2344 // <owner_type>: a #GType identifying the owner of @pspec
2345 void insert(ParamSpec* pspec, Type owner_type) {
2346 g_param_spec_pool_insert(&this, pspec, owner_type);
2349 // Gets an array of all #GParamSpec<!-- -->s owned by @owner_type in
2350 // the pool.
2352 // allocated array containing pointers to all #GParamSpecs
2353 // owned by @owner_type in the pool
2354 // RETURNS: a newly
2355 // <owner_type>: the owner to look for
2356 // <n_pspecs_p>: return location for the length of the returned array
2357 ParamSpec** /*new container*/ list(Type owner_type, /*out*/ uint* n_pspecs_p) {
2358 return g_param_spec_pool_list(&this, owner_type, n_pspecs_p);
2361 // Gets an #GList of all #GParamSpec<!-- -->s owned by @owner_type in
2362 // the pool.
2364 // #GList of all #GParamSpec<!-- -->s owned by @owner_type in
2365 // the pool#GParamSpec<!-- -->s.
2366 // RETURNS: a
2367 // <owner_type>: the owner to look for
2368 GLib2.List* /*new container*/ list_owned(Type owner_type) {
2369 return g_param_spec_pool_list_owned(&this, owner_type);
2372 // Looks up a #GParamSpec in the pool.
2374 // matching #GParamSpec was found.
2375 // RETURNS: The found #GParamSpec, or %NULL if no
2376 // <param_name>: the name to look for
2377 // <owner_type>: the owner to look for
2378 // <walk_ancestors>: If %TRUE, also try to find a #GParamSpec with @param_name owned by an ancestor of @owner_type.
2379 ParamSpec* lookup(char* param_name, Type owner_type, int walk_ancestors) {
2380 return g_param_spec_pool_lookup(&this, param_name, owner_type, walk_ancestors);
2383 // Removes a #GParamSpec from the pool.
2384 // <pspec>: the #GParamSpec to remove
2385 void remove(ParamSpec* pspec) {
2386 g_param_spec_pool_remove(&this, pspec);
2389 // Creates a new #GParamSpecPool.
2391 // If @type_prefixing is %TRUE, lookups in the newly created pool will
2392 // allow to specify the owner as a colon-separated prefix of the
2393 // property name, like "GtkContainer:border-width". This feature is
2394 // deprecated, so you should always set @type_prefixing to %FALSE.
2395 // RETURNS: a newly allocated #GParamSpecPool.
2396 // <type_prefixing>: Whether the pool will support type-prefixed property names.
2397 static ParamSpecPool* new_(int type_prefixing) {
2398 return g_param_spec_pool_new(type_prefixing);
2403 // A #GParamSpec derived structure that contains the meta data for string
2404 // properties.
2405 struct ParamSpecString /* : ParamSpec */ {
2406 alias parent_instance this;
2407 alias parent_instance super_;
2408 alias parent_instance paramspec;
2409 ParamSpec parent_instance;
2410 char* default_value, cset_first, cset_nth;
2411 char substitutor;
2412 static import std.bitmanip; mixin(std.bitmanip.bitfields!(
2413 uint, "null_fold_if_empty", 1,
2414 uint, "ensure_non_null", 1,
2415 uint, "__dummy32A", 30));
2419 // This structure is used to provide the type system with the information
2420 // required to initialize and destruct (finalize) a parameter's class and
2421 // instances thereof.
2422 // The initialized structure is passed to the g_param_type_register_static()
2423 // The type system will perform a deep copy of this structure, so its memory
2424 // does not need to be persistent across invocation of
2425 // g_param_type_register_static().
2426 struct ParamSpecTypeInfo {
2427 ushort instance_size, n_preallocs;
2428 extern (C) void function (ParamSpec* pspec) instance_init;
2429 Type value_type;
2430 extern (C) void function (ParamSpec* pspec) finalize;
2431 extern (C) void function (ParamSpec* pspec, Value* value) value_set_default;
2432 extern (C) int function (ParamSpec* pspec, Value* value) value_validate;
2433 extern (C) int function (ParamSpec* pspec, Value* value1, Value* value2) values_cmp;
2436 // A #GParamSpec derived structure that contains the meta data for unsigned character properties.
2437 struct ParamSpecUChar /* : ParamSpec */ {
2438 alias parent_instance this;
2439 alias parent_instance super_;
2440 alias parent_instance paramspec;
2441 ParamSpec parent_instance;
2442 ubyte minimum, maximum, default_value;
2445 // A #GParamSpec derived structure that contains the meta data for unsigned integer properties.
2446 struct ParamSpecUInt /* : ParamSpec */ {
2447 alias parent_instance this;
2448 alias parent_instance super_;
2449 alias parent_instance paramspec;
2450 ParamSpec parent_instance;
2451 uint minimum, maximum, default_value;
2454 // A #GParamSpec derived structure that contains the meta data for unsigned 64bit integer properties.
2455 struct ParamSpecUInt64 /* : ParamSpec */ {
2456 alias parent_instance this;
2457 alias parent_instance super_;
2458 alias parent_instance paramspec;
2459 ParamSpec parent_instance;
2460 ulong minimum, maximum, default_value;
2463 // A #GParamSpec derived structure that contains the meta data for unsigned long integer properties.
2464 struct ParamSpecULong /* : ParamSpec */ {
2465 alias parent_instance this;
2466 alias parent_instance super_;
2467 alias parent_instance paramspec;
2468 ParamSpec parent_instance;
2469 c_ulong minimum, maximum, default_value;
2472 // A #GParamSpec derived structure that contains the meta data for unichar (unsigned integer) properties.
2473 struct ParamSpecUnichar /* : ParamSpec */ {
2474 alias parent_instance this;
2475 alias parent_instance super_;
2476 alias parent_instance paramspec;
2477 ParamSpec parent_instance;
2478 dchar default_value;
2481 // A #GParamSpec derived structure that contains the meta data for #GValueArray properties.
2482 struct ParamSpecValueArray /* : ParamSpec */ {
2483 alias parent_instance this;
2484 alias parent_instance super_;
2485 alias parent_instance paramspec;
2486 ParamSpec parent_instance;
2487 ParamSpec* element_spec;
2488 uint fixed_n_elements;
2491 // A #GParamSpec derived structure that contains the meta data for #GVariant properties.
2492 struct ParamSpecVariant /* : ParamSpec */ /* Version 2.26 */ {
2493 alias parent_instance this;
2494 alias parent_instance super_;
2495 alias parent_instance paramspec;
2496 ParamSpec parent_instance;
2497 GLib2.VariantType* type;
2498 GLib2.Variant* default_value;
2499 private void*[4] padding;
2503 // The <structname>GParameter</structname> struct is an auxiliary structure used
2504 // to hand parameter name/value pairs to g_object_newv().
2505 struct Parameter {
2506 char* name;
2507 Value value;
2510 enum int SIGNAL_FLAGS_MASK = 255;
2511 enum int SIGNAL_MATCH_MASK = 63;
2513 // The signal accumulator is a special callback function that can be used
2514 // to collect return values of the various callbacks that are called
2515 // during a signal emission. The signal accumulator is specified at signal
2516 // creation time, if it is left %NULL, no accumulation of callback return
2517 // values is performed. The return value of signal emissions is then the
2518 // value returned by the last callback.
2520 // should be aborted. Returning %FALSE means to abort the
2521 // current emission and %TRUE is returned for continuation.
2522 // RETURNS: The accumulator function returns whether the signal emission
2523 // <ihint>: Signal invocation hint, see #GSignalInvocationHint.
2524 // <return_accu>: Accumulator to collect callback return values in, this is the return value of the current signal emission.
2525 // <handler_return>: A #GValue holding the return value of the signal handler.
2526 // <data>: Callback data that was specified when creating the signal.
2527 extern (C) alias int function (SignalInvocationHint* ihint, Value* return_accu, Value* handler_return, void* data) SignalAccumulator;
2530 // A simple function pointer to get invoked when the signal is emitted. This
2531 // allows you to tie a hook to the signal type, so that it will trap all
2532 // emissions of that signal, from any object.
2534 // You may not attach these to signals created with the #G_SIGNAL_NO_HOOKS flag.
2536 // hook is disconnected (and destroyed).
2537 // RETURNS: whether it wants to stay connected. If it returns %FALSE, the signal
2538 // <ihint>: Signal invocation hint, see #GSignalInvocationHint.
2539 // <n_param_values>: the number of parameters to the function, including the instance on which the signal was emitted.
2540 // <param_values>: the instance on which the signal was emitted, followed by the parameters of the emission.
2541 // <data>: user data associated with the hook.
2542 extern (C) alias int function (SignalInvocationHint* ihint, uint n_param_values, Value* param_values, void* data) SignalEmissionHook;
2545 // The signal flags are used to specify a signal's behaviour, the overall
2546 // signal description outlines how especially the RUN flags control the
2547 // stages of a signal emission.
2548 enum SignalFlags {
2549 RUN_FIRST = 1,
2550 RUN_LAST = 2,
2551 RUN_CLEANUP = 4,
2552 NO_RECURSE = 8,
2553 DETAILED = 16,
2554 ACTION = 32,
2555 NO_HOOKS = 64,
2556 MUST_COLLECT = 128
2559 // The #GSignalInvocationHint structure is used to pass on additional information
2560 // to callbacks during a signal emission.
2561 struct SignalInvocationHint {
2562 uint signal_id;
2563 GLib2.Quark detail;
2564 SignalFlags run_type;
2568 // The match types specify what g_signal_handlers_block_matched(),
2569 // g_signal_handlers_unblock_matched() and g_signal_handlers_disconnect_matched()
2570 // match signals by.
2571 enum SignalMatchType {
2572 ID = 1,
2573 DETAIL = 2,
2574 CLOSURE = 4,
2575 FUNC = 8,
2576 DATA = 16,
2577 UNBLOCKED = 32
2580 // A structure holding in-depth information for a specific signal. It is
2581 // filled in by the g_signal_query() function.
2582 struct SignalQuery {
2583 uint signal_id;
2584 char* signal_name;
2585 Type itype;
2586 SignalFlags signal_flags;
2587 Type return_type;
2588 uint n_params;
2589 Type* param_types;
2592 enum int TYPE_FUNDAMENTAL_MAX = 255;
2593 enum int TYPE_FUNDAMENTAL_SHIFT = 2;
2594 enum int TYPE_RESERVED_BSE_FIRST = 32;
2595 enum int TYPE_RESERVED_BSE_LAST = 48;
2596 enum int TYPE_RESERVED_GLIB_FIRST = 22;
2597 enum int TYPE_RESERVED_GLIB_LAST = 31;
2598 enum int TYPE_RESERVED_USER_FIRST = 49;
2600 // A callback function used for notification when the state
2601 // of a toggle reference changes. See g_object_add_toggle_ref().
2602 // <data>: Callback data passed to g_object_add_toggle_ref()
2603 // <object>: The object on which g_object_add_toggle_ref() was called.
2604 // <is_last_ref>: %TRUE if the toggle reference is now the last reference to the object. %FALSE if the toggle reference was the last reference and there are now other references.
2605 extern (C) alias void function (void* data, Object* object, int is_last_ref) ToggleNotify;
2607 // A union holding one collected value.
2608 union TypeCValue {
2609 int v_int;
2610 c_long v_long;
2611 long v_int64;
2612 double v_double;
2613 void* v_pointer;
2616 // An opaque structure used as the base of all classes.
2617 struct TypeClass {
2618 private Type g_type;
2620 // Unintrospectable method: get_private() / g_type_class_get_private()
2621 void* get_private(Type private_type) {
2622 return g_type_class_get_private(&this, private_type);
2625 // This is a convenience function often needed in class initializers.
2626 // It returns the class structure of the immediate parent type of the
2627 // class passed in. Since derived classes hold a reference count on
2628 // their parent classes as long as they are instantiated, the returned
2629 // class will always exist. This function is essentially equivalent
2630 // to:
2632 // <programlisting>
2633 // g_type_class_peek (g_type_parent (G_TYPE_FROM_CLASS (g_class)));
2634 // </programlisting>
2636 // of @g_class.
2637 // RETURNS: The parent class
2638 TypeClass* peek_parent() {
2639 return g_type_class_peek_parent(&this);
2642 // Decrements the reference count of the class structure being passed in.
2643 // Once the last reference count of a class has been released, classes
2644 // may be finalized by the type system, so further dereferencing of a
2645 // class pointer after g_type_class_unref() are invalid.
2646 void unref() {
2647 g_type_class_unref(&this);
2650 // Unintrospectable method: unref_uncached() / g_type_class_unref_uncached()
2651 // A variant of g_type_class_unref() for use in #GTypeClassCacheFunc
2652 // implementations. It unreferences a class without consulting the chain
2653 // of #GTypeClassCacheFunc<!-- -->s, avoiding the recursion which would occur
2654 // otherwise.
2655 void unref_uncached() {
2656 g_type_class_unref_uncached(&this);
2659 // Registers a private structure for an instantiatable type.
2661 // When an object is allocated, the private structures for
2662 // the type and all of its parent types are allocated
2663 // sequentially in the same memory block as the public
2664 // structures.
2666 // Note that the accumulated size of the private structures of
2667 // a type and all its parent types cannot excced 64kB.
2669 // This function should be called in the type's class_init() function.
2670 // The private structure can be retrieved using the
2671 // G_TYPE_INSTANCE_GET_PRIVATE() macro.
2673 // The following example shows attaching a private structure
2674 // <structname>MyObjectPrivate</structname> to an object
2675 // <structname>MyObject</structname> defined in the standard GObject
2676 // fashion.
2677 // type's class_init() function.
2679 // |[
2680 // typedef struct _MyObject MyObject;
2681 // typedef struct _MyObjectPrivate MyObjectPrivate;
2683 // struct _MyObject {
2684 // GObject parent;
2686 // MyObjectPrivate *priv;
2687 // };
2689 // struct _MyObjectPrivate {
2690 // int some_field;
2691 // };
2693 // static void
2694 // my_object_class_init (MyObjectClass *klass)
2695 // {
2696 // g_type_class_add_private (klass, sizeof (MyObjectPrivate));
2697 // }
2699 // static void
2700 // my_object_init (MyObject *my_object)
2701 // {
2702 // my_object->priv = G_TYPE_INSTANCE_GET_PRIVATE (my_object,
2703 // MY_TYPE_OBJECT,
2704 // MyObjectPrivate);
2705 // }
2707 // static int
2708 // my_object_get_some_field (MyObject *my_object)
2709 // {
2710 // MyObjectPrivate *priv = my_object->priv;
2712 // return priv->some_field;
2713 // }
2714 // ]|
2715 // <g_class>: class structure for an instantiatable type
2716 // <private_size>: size of private structure.
2717 static void add_private(void* g_class, size_t private_size) {
2718 g_type_class_add_private(g_class, private_size);
2721 // This function is essentially the same as g_type_class_ref(), except that
2722 // the classes reference count isn't incremented. As a consequence, this function
2723 // may return %NULL if the class of the type passed in does not currently
2724 // exist (hasn't been referenced before).
2726 // structure for the given type ID or %NULL if the class does not
2727 // currently exist.
2728 // RETURNS: The #GTypeClass
2729 // <type>: Type ID of a classed type.
2730 static TypeClass* peek(Type type) {
2731 return g_type_class_peek(type);
2734 // A more efficient version of g_type_class_peek() which works only for
2735 // static types.
2737 // structure for the given type ID or %NULL if the class does not
2738 // currently exist or is dynamically loaded.
2739 // RETURNS: The #GTypeClass
2740 // <type>: Type ID of a classed type.
2741 static TypeClass* peek_static(Type type) {
2742 return g_type_class_peek_static(type);
2745 // Increments the reference count of the class structure belonging to
2746 // @type. This function will demand-create the class if it doesn't
2747 // exist already.
2749 // structure for the given type ID.
2750 // RETURNS: The #GTypeClass
2751 // <type>: Type ID of a classed type.
2752 static TypeClass* ref_(Type type) {
2753 return g_type_class_ref(type);
2758 // A callback function which is called when the reference count of a class
2759 // drops to zero. It may use g_type_class_ref() to prevent the class from
2760 // being freed. You should not call g_type_class_unref() from a
2761 // #GTypeClassCacheFunc function to prevent infinite recursion, use
2762 // g_type_class_unref_uncached() instead.
2764 // The functions have to check the class id passed in to figure
2765 // whether they actually want to cache the class of this type, since all
2766 // classes are routed through the same #GTypeClassCacheFunc chain.
2768 // called, %FALSE to continue.
2769 // RETURNS: %TRUE to stop further #GTypeClassCacheFunc<!-- -->s from being
2770 // <cache_data>: data that was given to the g_type_add_class_cache_func() call
2771 // <g_class>: The #GTypeClass structure which is unreferenced
2772 extern (C) alias int function (void* cache_data, TypeClass* g_class) TypeClassCacheFunc;
2775 // The <type>GTypeDebugFlags</type> enumeration values can be passed to
2776 // g_type_init_with_debug_flags() to trigger debugging messages during runtime.
2777 // Note that the messages can also be triggered by setting the
2778 // <envar>GOBJECT_DEBUG</envar> environment variable to a ':'-separated list of
2779 // "objects" and "signals".
2780 enum TypeDebugFlags {
2781 NONE = 0,
2782 OBJECTS = 1,
2783 SIGNALS = 2,
2784 MASK = 3
2786 // Bit masks used to check or determine characteristics of a type.
2787 enum TypeFlags {
2788 ABSTRACT = 16,
2789 VALUE_ABSTRACT = 32
2792 // Bit masks used to check or determine specific characteristics of a
2793 // fundamental type.
2794 enum TypeFundamentalFlags {
2795 CLASSED = 1,
2796 INSTANTIATABLE = 2,
2797 DERIVABLE = 4,
2798 DEEP_DERIVABLE = 8
2801 // A structure that provides information to the type system which is
2802 // used specifically for managing fundamental types.
2803 struct TypeFundamentalInfo {
2804 TypeFundamentalFlags type_flags;
2808 // This structure is used to provide the type system with the information
2809 // required to initialize and destruct (finalize) a type's class and
2810 // its instances.
2811 // The initialized structure is passed to the g_type_register_static() function
2812 // (or is copied into the provided #GTypeInfo structure in the
2813 // g_type_plugin_complete_type_info()). The type system will perform a deep
2814 // copy of this structure, so its memory does not need to be persistent
2815 // across invocation of g_type_register_static().
2816 struct TypeInfo {
2817 ushort class_size;
2818 BaseInitFunc base_init;
2819 BaseFinalizeFunc base_finalize;
2820 ClassInitFunc class_init;
2821 ClassFinalizeFunc class_finalize;
2822 const(void)* class_data;
2823 ushort instance_size, n_preallocs;
2824 InstanceInitFunc instance_init;
2825 TypeValueTable* value_table;
2828 // An opaque structure used as the base of all type instances.
2829 struct TypeInstance {
2830 private TypeClass* g_class;
2832 // Unintrospectable method: get_private() / g_type_instance_get_private()
2833 void* get_private(Type private_type) {
2834 return g_type_instance_get_private(&this, private_type);
2838 // An opaque structure used as the base of all interface types.
2839 struct TypeInterface {
2840 private Type g_type, g_instance_type;
2843 // Returns the corresponding #GTypeInterface structure of the parent type
2844 // of the instance type to which @g_iface belongs. This is useful when
2845 // deriving the implementation of an interface from the parent type and
2846 // then possibly overriding some methods.
2848 // corresponding #GTypeInterface structure of the parent type of the
2849 // instance type to which @g_iface belongs, or %NULL if the parent
2850 // type doesn't conform to the interface.
2851 // RETURNS: The
2852 TypeInterface* peek_parent() {
2853 return g_type_interface_peek_parent(&this);
2856 // Adds @prerequisite_type to the list of prerequisites of @interface_type.
2857 // This means that any type implementing @interface_type must also implement
2858 // @prerequisite_type. Prerequisites can be thought of as an alternative to
2859 // interface derivation (which GType doesn't support). An interface can have
2860 // at most one instantiatable prerequisite type.
2861 // <interface_type>: #GType value of an interface type.
2862 // <prerequisite_type>: #GType value of an interface or instantiatable type.
2863 static void add_prerequisite(Type interface_type, Type prerequisite_type) {
2864 g_type_interface_add_prerequisite(interface_type, prerequisite_type);
2867 // Returns the #GTypePlugin structure for the dynamic interface
2868 // @interface_type which has been added to @instance_type, or %NULL if
2869 // @interface_type has not been added to @instance_type or does not
2870 // have a #GTypePlugin structure. See g_type_add_interface_dynamic().
2872 // interface @interface_type of @instance_type.
2873 // RETURNS: the #GTypePlugin for the dynamic
2874 // <instance_type>: the #GType value of an instantiatable type.
2875 // <interface_type>: the #GType value of an interface type.
2876 static TypePlugin* get_plugin(Type instance_type, Type interface_type) {
2877 return g_type_interface_get_plugin(instance_type, interface_type);
2880 // Returns the #GTypeInterface structure of an interface to which the
2881 // passed in class conforms.
2883 // structure of iface_type if implemented by @instance_class, %NULL
2884 // otherwise
2885 // RETURNS: The GTypeInterface
2886 // <instance_class>: A #GTypeClass structure.
2887 // <iface_type>: An interface ID which this class conforms to.
2888 static TypeInterface* peek(TypeClass* instance_class, Type iface_type) {
2889 return g_type_interface_peek(instance_class, iface_type);
2892 // Returns the prerequisites of an interfaces type.
2895 // newly-allocated zero-terminated array of #GType containing
2896 // the prerequisites of @interface_type
2897 // RETURNS: a
2898 // <interface_type>: an interface type
2899 // <n_prerequisites>: location to return the number of prerequisites, or %NULL
2900 static Type* /*new*/ prerequisites(Type interface_type, /*out*/ uint* n_prerequisites=null) {
2901 return g_type_interface_prerequisites(interface_type, n_prerequisites);
2906 // A callback called after an interface vtable is initialized.
2907 // See g_type_add_interface_check().
2908 // <check_data>: data passed to g_type_add_interface_check().
2909 // <g_iface>: the interface that has been initialized
2910 extern (C) alias void function (void* check_data, void* g_iface) TypeInterfaceCheckFunc;
2913 // #GTypeModule provides a simple implementation of the #GTypePlugin
2914 // interface. The model of #GTypeModule is a dynamically loaded module
2915 // which implements some number of types and interface
2916 // implementations. When the module is loaded, it registers its types
2917 // and interfaces using g_type_module_register_type() and
2918 // g_type_module_add_interface(). As long as any instances of these
2919 // types and interface implementations are in use, the module is kept
2920 // loaded. When the types and interfaces are gone, the module may be
2921 // unloaded. If the types and interfaces become used again, the module
2922 // will be reloaded. Note that the last unref cannot happen in module
2923 // code, since that would lead to the caller's code being unloaded before
2924 // g_object_unref() returns to it.
2926 // Keeping track of whether the module should be loaded or not is done by
2927 // using a use count - it starts at zero, and whenever it is greater than
2928 // zero, the module is loaded. The use count is maintained internally by
2929 // the type system, but also can be explicitly controlled by
2930 // g_type_module_use() and g_type_module_unuse(). Typically, when loading
2931 // a module for the first type, g_type_module_use() will be used to load
2932 // it so that it can initialize its types. At some later point, when the
2933 // module no longer needs to be loaded except for the type
2934 // implementations it contains, g_type_module_unuse() is called.
2936 // #GTypeModule does not actually provide any implementation of module
2937 // loading and unloading. To create a particular module type you must
2938 // derive from #GTypeModule and implement the load and unload functions
2939 // in #GTypeModuleClass.
2940 struct TypeModule /* : Object */ {
2941 alias parent_instance this;
2942 alias parent_instance super_;
2943 alias parent_instance object;
2944 Object parent_instance;
2945 uint use_count;
2946 GLib2.SList* type_infos, interface_infos;
2947 char* name;
2950 // Registers an additional interface for a type, whose interface lives
2951 // in the given type plugin. If the interface was already registered
2952 // for the type in this plugin, nothing will be done.
2954 // As long as any instances of the type exist, the type plugin will
2955 // not be unloaded.
2956 // <instance_type>: type to which to add the interface.
2957 // <interface_type>: interface type to add
2958 // <interface_info>: type information structure
2959 void add_interface(Type instance_type, Type interface_type, InterfaceInfo* interface_info) {
2960 g_type_module_add_interface(&this, instance_type, interface_type, interface_info);
2963 // Looks up or registers an enumeration that is implemented with a particular
2964 // type plugin. If a type with name @type_name was previously registered,
2965 // the #GType identifier for the type is returned, otherwise the type
2966 // is newly registered, and the resulting #GType identifier returned.
2968 // As long as any instances of the type exist, the type plugin will
2969 // not be unloaded.
2970 // RETURNS: the new or existing type ID
2971 // <name>: name for the type
2972 // <const_static_values>: an array of #GEnumValue structs for the possible enumeration values. The array is terminated by a struct with all members being 0.
2973 Type register_enum(char* name, EnumValue* const_static_values) {
2974 return g_type_module_register_enum(&this, name, const_static_values);
2977 // Looks up or registers a flags type that is implemented with a particular
2978 // type plugin. If a type with name @type_name was previously registered,
2979 // the #GType identifier for the type is returned, otherwise the type
2980 // is newly registered, and the resulting #GType identifier returned.
2982 // As long as any instances of the type exist, the type plugin will
2983 // not be unloaded.
2984 // RETURNS: the new or existing type ID
2985 // <name>: name for the type
2986 // <const_static_values>: an array of #GFlagsValue structs for the possible flags values. The array is terminated by a struct with all members being 0.
2987 Type register_flags(char* name, FlagsValue* const_static_values) {
2988 return g_type_module_register_flags(&this, name, const_static_values);
2991 // Looks up or registers a type that is implemented with a particular
2992 // type plugin. If a type with name @type_name was previously registered,
2993 // the #GType identifier for the type is returned, otherwise the type
2994 // is newly registered, and the resulting #GType identifier returned.
2996 // When reregistering a type (typically because a module is unloaded
2997 // then reloaded, and reinitialized), @module and @parent_type must
2998 // be the same as they were previously.
3000 // As long as any instances of the type exist, the type plugin will
3001 // not be unloaded.
3002 // RETURNS: the new or existing type ID
3003 // <parent_type>: the type for the parent class
3004 // <type_name>: name for the type
3005 // <type_info>: type information structure
3006 // <flags>: flags field providing details about the type
3007 Type register_type(Type parent_type, char* type_name, TypeInfo* type_info, TypeFlags flags) {
3008 return g_type_module_register_type(&this, parent_type, type_name, type_info, flags);
3011 // Sets the name for a #GTypeModule
3012 // <name>: a human-readable name to use in error messages.
3013 void set_name(char* name) {
3014 g_type_module_set_name(&this, name);
3017 // Decreases the use count of a #GTypeModule by one. If the
3018 // result is zero, the module will be unloaded. (However, the
3019 // #GTypeModule will not be freed, and types associated with the
3020 // #GTypeModule are not unregistered. Once a #GTypeModule is
3021 // initialized, it must exist forever.)
3022 void unuse() {
3023 g_type_module_unuse(&this);
3026 // Increases the use count of a #GTypeModule by one. If the
3027 // use count was zero before, the plugin will be loaded.
3028 // If loading the plugin fails, the use count is reset to
3029 // its prior value.
3031 // loading the plugin failed.
3032 // RETURNS: %FALSE if the plugin needed to be loaded and
3033 int use() {
3034 return g_type_module_use(&this);
3039 // In order to implement dynamic loading of types based on #GTypeModule,
3040 // the @load and @unload functions in #GTypeModuleClass must be implemented.
3041 struct TypeModuleClass {
3042 ObjectClass parent_class;
3043 extern (C) int function (TypeModule* module_) load;
3044 extern (C) void function (TypeModule* module_) unload;
3045 extern (C) void function () reserved1;
3046 extern (C) void function () reserved2;
3047 extern (C) void function () reserved3;
3048 extern (C) void function () reserved4;
3052 // The GObject type system supports dynamic loading of types. The
3053 // #GTypePlugin interface is used to handle the lifecycle of
3054 // dynamically loaded types. It goes as follows:
3056 // <orderedlist>
3057 // <listitem><para>
3058 // The type is initially introduced (usually upon loading the module
3059 // the first time, or by your main application that knows what modules
3060 // introduces what types), like this:
3061 // |[
3062 // new_type_id = g_type_register_dynamic (parent_type_id,
3063 // "TypeName",
3064 // new_type_plugin,
3065 // type_flags);
3066 // ]|
3067 // where <literal>new_type_plugin</literal> is an implementation of the
3068 // #GTypePlugin interface.
3069 // </para></listitem>
3070 // <listitem><para>
3071 // The type's implementation is referenced, e.g. through
3072 // g_type_class_ref() or through g_type_create_instance() (this is
3073 // being called by g_object_new()) or through one of the above done on
3074 // a type derived from <literal>new_type_id</literal>.
3075 // </para></listitem>
3076 // <listitem><para>
3077 // This causes the type system to load the type's implementation by calling
3078 // g_type_plugin_use() and g_type_plugin_complete_type_info() on
3079 // <literal>new_type_plugin</literal>.
3080 // </para></listitem>
3081 // <listitem><para>
3082 // At some point the type's implementation isn't required anymore, e.g. after
3083 // g_type_class_unref() or g_type_free_instance() (called when the reference
3084 // count of an instance drops to zero).
3085 // </para></listitem>
3086 // <listitem><para>
3087 // This causes the type system to throw away the information retrieved from
3088 // g_type_plugin_complete_type_info() and then it calls
3089 // g_type_plugin_unuse() on <literal>new_type_plugin</literal>.
3090 // </para></listitem>
3091 // <listitem><para>
3092 // Things may repeat from the second step.
3093 // </para></listitem>
3094 // </orderedlist>
3096 // So basically, you need to implement a #GTypePlugin type that
3097 // carries a use_count, once use_count goes from zero to one, you need
3098 // to load the implementation to successfully handle the upcoming
3099 // g_type_plugin_complete_type_info() call. Later, maybe after
3100 // succeeding use/unuse calls, once use_count drops to zero, you can
3101 // unload the implementation again. The type system makes sure to call
3102 // g_type_plugin_use() and g_type_plugin_complete_type_info() again
3103 // when the type is needed again.
3105 // #GTypeModule is an implementation of #GTypePlugin that already
3106 // implements most of this except for the actual module loading and
3107 // unloading. It even handles multiple registered types per module.
3108 struct TypePlugin {
3110 // Calls the @complete_interface_info function from the
3111 // #GTypePluginClass of @plugin. There should be no need to use this
3112 // function outside of the GObject type system itself.
3113 // <instance_type>: the #GType of an instantiable type to which the interface is added
3114 // <interface_type>: the #GType of the interface whose info is completed
3115 // <info>: the #GInterfaceInfo to fill in
3116 void complete_interface_info(Type instance_type, Type interface_type, InterfaceInfo* info) {
3117 g_type_plugin_complete_interface_info(&this, instance_type, interface_type, info);
3120 // Calls the @complete_type_info function from the #GTypePluginClass of @plugin.
3121 // There should be no need to use this function outside of the GObject
3122 // type system itself.
3123 // <g_type>: the #GType whose info is completed
3124 // <info>: the #GTypeInfo struct to fill in
3125 // <value_table>: the #GTypeValueTable to fill in
3126 void complete_type_info(Type g_type, TypeInfo* info, TypeValueTable* value_table) {
3127 g_type_plugin_complete_type_info(&this, g_type, info, value_table);
3130 // Calls the @unuse_plugin function from the #GTypePluginClass of
3131 // @plugin. There should be no need to use this function outside of
3132 // the GObject type system itself.
3133 void unuse() {
3134 g_type_plugin_unuse(&this);
3137 // Calls the @use_plugin function from the #GTypePluginClass of
3138 // @plugin. There should be no need to use this function outside of
3139 // the GObject type system itself.
3140 void use() {
3141 g_type_plugin_use(&this);
3146 // The #GTypePlugin interface is used by the type system in order to handle
3147 // the lifecycle of dynamically loaded types.
3148 struct TypePluginClass {
3149 private TypeInterface base_iface;
3150 TypePluginUse use_plugin;
3151 TypePluginUnuse unuse_plugin;
3152 TypePluginCompleteTypeInfo complete_type_info;
3153 TypePluginCompleteInterfaceInfo complete_interface_info;
3157 // The type of the @complete_interface_info function of #GTypePluginClass.
3158 // <plugin>: the #GTypePlugin
3159 // <instance_type>: the #GType of an instantiable type to which the interface is added
3160 // <interface_type>: the #GType of the interface whose info is completed
3161 // <info>: the #GInterfaceInfo to fill in
3162 extern (C) alias void function (TypePlugin* plugin, Type instance_type, Type interface_type, InterfaceInfo* info) TypePluginCompleteInterfaceInfo;
3165 // The type of the @complete_type_info function of #GTypePluginClass.
3166 // <plugin>: the #GTypePlugin
3167 // <g_type>: the #GType whose info is completed
3168 // <info>: the #GTypeInfo struct to fill in
3169 // <value_table>: the #GTypeValueTable to fill in
3170 extern (C) alias void function (TypePlugin* plugin, Type g_type, TypeInfo* info, TypeValueTable* value_table) TypePluginCompleteTypeInfo;
3173 // The type of the @unuse_plugin function of #GTypePluginClass.
3174 // <plugin>: the #GTypePlugin whose use count should be decreased
3175 extern (C) alias void function (TypePlugin* plugin) TypePluginUnuse;
3178 // The type of the @use_plugin function of #GTypePluginClass, which gets called
3179 // to increase the use count of @plugin.
3180 // <plugin>: the #GTypePlugin whose use count should be increased
3181 extern (C) alias void function (TypePlugin* plugin) TypePluginUse;
3184 // A structure holding information for a specific type. It is
3185 // filled in by the g_type_query() function.
3186 struct TypeQuery {
3187 Type type;
3188 char* type_name;
3189 uint class_size, instance_size;
3193 // The #GTypeValueTable provides the functions required by the #GValue implementation,
3194 // to serve as a container for values of a type.
3195 struct TypeValueTable {
3196 extern (C) void function (Value* value) value_init;
3197 extern (C) void function (Value* value) value_free;
3198 extern (C) void function (Value* src_value, Value* dest_value) value_copy;
3199 // Unintrospectable functionp: value_peek_pointer() / ()
3200 extern (C) void* function (Value* value) value_peek_pointer;
3201 char* collect_format;
3202 extern (C) char* /*new*/ function (Value* value, uint n_collect_values, TypeCValue* collect_values, uint collect_flags) collect_value;
3203 char* lcopy_format;
3204 extern (C) char* /*new*/ function (Value* value, uint n_collect_values, TypeCValue* collect_values, uint collect_flags) lcopy_value;
3207 // Unintrospectable function: peek() / g_type_value_table_peek()
3208 // Returns the location of the #GTypeValueTable associated with @type.
3209 // <emphasis>Note that this function should only be used from source code
3210 // that implements or has internal knowledge of the implementation of
3211 // @type.</emphasis>
3213 // %NULL if there is no #GTypeValueTable associated with @type.
3214 // RETURNS: Location of the #GTypeValueTable associated with @type or
3215 // <type>: A #GType value.
3216 static TypeValueTable* peek(Type type) {
3217 return g_type_value_table_peek(type);
3221 enum int VALUE_COLLECT_FORMAT_MAX_LENGTH = 8;
3222 enum int VALUE_NOCOPY_CONTENTS = 134217728;
3224 // An opaque structure used to hold different types of values.
3225 // The data within the structure has protected scope: it is accessible only
3226 // to functions within a #GTypeValueTable structure, or implementations of
3227 // the g_value_*() API. That is, code portions which implement new fundamental
3228 // types.
3229 // #GValue users cannot make any assumptions about how data is stored
3230 // within the 2 element @data union, and the @g_type member should
3231 // only be accessed through the G_VALUE_TYPE() macro.
3232 struct Value {
3233 private Type g_type;
3234 _Value__data__union[2] data;
3237 // Copies the value of @src_value into @dest_value.
3238 // <dest_value>: An initialized #GValue structure of the same type as @src_value.
3239 void copy(Value* dest_value) {
3240 g_value_copy(&this, dest_value);
3243 // Unintrospectable method: dup_boxed() / g_value_dup_boxed()
3244 // Get the contents of a %G_TYPE_BOXED derived #GValue. Upon getting,
3245 // the boxed value is duplicated and needs to be later freed with
3246 // g_boxed_free(), e.g. like: g_boxed_free (G_VALUE_TYPE (@value),
3247 // return_value);
3248 // RETURNS: boxed contents of @value
3249 void* dup_boxed() {
3250 return g_value_dup_boxed(&this);
3253 // Get the contents of a %G_TYPE_OBJECT derived #GValue, increasing
3254 // its reference count. If the contents of the #GValue are %NULL, then
3255 // %NULL will be returned.
3257 // should be unreferenced when no longer needed.
3258 // RETURNS: object content of @value,
3259 Object* /*new*/ dup_object() {
3260 return g_value_dup_object(&this);
3263 // Unintrospectable method: dup_param() / g_value_dup_param()
3264 // Get the contents of a %G_TYPE_PARAM #GValue, increasing its
3265 // reference count.
3267 // no longer needed.
3268 // RETURNS: #GParamSpec content of @value, should be unreferenced when
3269 ParamSpec* dup_param() {
3270 return g_value_dup_param(&this);
3273 // Get a copy the contents of a %G_TYPE_STRING #GValue.
3274 // RETURNS: a newly allocated copy of the string content of @value
3275 char* /*new*/ dup_string() {
3276 return g_value_dup_string(&this);
3279 // Get the contents of a variant #GValue, increasing its refcount.
3281 // g_variant_unref() when no longer needed
3282 // RETURNS: variant contents of @value, should be unrefed using
3283 GLib2.Variant* /*new*/ dup_variant() {
3284 return g_value_dup_variant(&this);
3287 // Determines if @value will fit inside the size of a pointer value.
3288 // This is an internal function introduced mainly for C marshallers.
3289 // RETURNS: %TRUE if @value will fit inside a pointer value.
3290 int fits_pointer() {
3291 return g_value_fits_pointer(&this);
3294 // Get the contents of a %G_TYPE_BOOLEAN #GValue.
3295 // RETURNS: boolean contents of @value
3296 int get_boolean() {
3297 return g_value_get_boolean(&this);
3300 // Get the contents of a %G_TYPE_BOXED derived #GValue.
3301 // RETURNS: boxed contents of @value
3302 void* get_boxed() {
3303 return g_value_get_boxed(&this);
3306 // Get the contents of a %G_TYPE_CHAR #GValue.
3307 // RETURNS: character contents of @value
3308 char get_char() {
3309 return g_value_get_char(&this);
3312 // Get the contents of a %G_TYPE_DOUBLE #GValue.
3313 // RETURNS: double contents of @value
3314 double get_double() {
3315 return g_value_get_double(&this);
3318 // Get the contents of a %G_TYPE_ENUM #GValue.
3319 // RETURNS: enum contents of @value
3320 int get_enum() {
3321 return g_value_get_enum(&this);
3324 // Get the contents of a %G_TYPE_FLAGS #GValue.
3325 // RETURNS: flags contents of @value
3326 uint get_flags() {
3327 return g_value_get_flags(&this);
3330 // Get the contents of a %G_TYPE_FLOAT #GValue.
3331 // RETURNS: float contents of @value
3332 float get_float() {
3333 return g_value_get_float(&this);
3336 // Get the contents of a %G_TYPE_INT #GValue.
3337 // RETURNS: integer contents of @value
3338 int get_int() {
3339 return g_value_get_int(&this);
3342 // Get the contents of a %G_TYPE_INT64 #GValue.
3343 // RETURNS: 64bit integer contents of @value
3344 long get_int64() {
3345 return g_value_get_int64(&this);
3348 // Get the contents of a %G_TYPE_LONG #GValue.
3349 // RETURNS: long integer contents of @value
3350 c_long get_long() {
3351 return g_value_get_long(&this);
3354 // Get the contents of a %G_TYPE_OBJECT derived #GValue.
3355 // RETURNS: object contents of @value
3356 Object* get_object() {
3357 return g_value_get_object(&this);
3360 // Get the contents of a %G_TYPE_PARAM #GValue.
3361 // RETURNS: #GParamSpec content of @value
3362 ParamSpec* get_param() {
3363 return g_value_get_param(&this);
3366 // Get the contents of a pointer #GValue.
3367 // RETURNS: pointer contents of @value
3368 void* get_pointer() {
3369 return g_value_get_pointer(&this);
3372 // Get the contents of a %G_TYPE_STRING #GValue.
3373 // RETURNS: string content of @value
3374 char* get_string() {
3375 return g_value_get_string(&this);
3378 // Get the contents of a %G_TYPE_UCHAR #GValue.
3379 // RETURNS: unsigned character contents of @value
3380 ubyte get_uchar() {
3381 return g_value_get_uchar(&this);
3384 // Get the contents of a %G_TYPE_UINT #GValue.
3385 // RETURNS: unsigned integer contents of @value
3386 uint get_uint() {
3387 return g_value_get_uint(&this);
3390 // Get the contents of a %G_TYPE_UINT64 #GValue.
3391 // RETURNS: unsigned 64bit integer contents of @value
3392 ulong get_uint64() {
3393 return g_value_get_uint64(&this);
3396 // Get the contents of a %G_TYPE_ULONG #GValue.
3397 // RETURNS: unsigned long integer contents of @value
3398 c_ulong get_ulong() {
3399 return g_value_get_ulong(&this);
3402 // Get the contents of a variant #GValue.
3403 // RETURNS: variant contents of @value
3404 GLib2.Variant* /*new*/ get_variant() {
3405 return g_value_get_variant(&this);
3408 // Initializes @value with the default value of @type.
3409 // RETURNS: the #GValue structure that has been passed in
3410 // <g_type>: Type the #GValue should hold values of.
3411 Value* init(Type g_type) {
3412 return g_value_init(&this, g_type);
3415 // function asserts that g_value_fits_pointer() returned %TRUE for the
3416 // passed in value. This is an internal function introduced mainly
3417 // for C marshallers.
3418 // RETURNS: the value contents as pointer. This
3419 void* peek_pointer() {
3420 return g_value_peek_pointer(&this);
3423 // Clears the current value in @value and resets it to the default value
3424 // (as if the value had just been initialized).
3425 // RETURNS: the #GValue structure that has been passed in
3426 Value* /*new*/ reset() {
3427 return g_value_reset(&this);
3430 // Set the contents of a %G_TYPE_BOOLEAN #GValue to @v_boolean.
3431 // <v_boolean>: boolean value to be set
3432 void set_boolean(int v_boolean) {
3433 g_value_set_boolean(&this, v_boolean);
3436 // Set the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed.
3437 // <v_boxed>: boxed value to be set
3438 void set_boxed(const(void)* v_boxed=null) {
3439 g_value_set_boxed(&this, v_boxed);
3442 // This is an internal function introduced mainly for C marshallers.
3443 // <v_boxed>: duplicated unowned boxed value to be set
3444 void set_boxed_take_ownership(const(void)* v_boxed=null) {
3445 g_value_set_boxed_take_ownership(&this, v_boxed);
3448 // Set the contents of a %G_TYPE_CHAR #GValue to @v_char.
3449 // <v_char>: character value to be set
3450 void set_char(char v_char) {
3451 g_value_set_char(&this, v_char);
3454 // Set the contents of a %G_TYPE_DOUBLE #GValue to @v_double.
3455 // <v_double>: double value to be set
3456 void set_double(double v_double) {
3457 g_value_set_double(&this, v_double);
3460 // Set the contents of a %G_TYPE_ENUM #GValue to @v_enum.
3461 // <v_enum>: enum value to be set
3462 void set_enum(int v_enum) {
3463 g_value_set_enum(&this, v_enum);
3466 // Set the contents of a %G_TYPE_FLAGS #GValue to @v_flags.
3467 // <v_flags>: flags value to be set
3468 void set_flags(uint v_flags) {
3469 g_value_set_flags(&this, v_flags);
3472 // Set the contents of a %G_TYPE_FLOAT #GValue to @v_float.
3473 // <v_float>: float value to be set
3474 void set_float(float v_float) {
3475 g_value_set_float(&this, v_float);
3478 // Set the contents of a %G_TYPE_GTYPE #GValue to @v_gtype.
3479 // <v_gtype>: #GType to be set
3480 void set_gtype(Type v_gtype) {
3481 g_value_set_gtype(&this, v_gtype);
3484 // Sets @value from an instantiatable type via the
3485 // value_table's collect_value() function.
3486 // <instance>: the instance
3487 void set_instance(void* instance=null) {
3488 g_value_set_instance(&this, instance);
3491 // Set the contents of a %G_TYPE_INT #GValue to @v_int.
3492 // <v_int>: integer value to be set
3493 void set_int(int v_int) {
3494 g_value_set_int(&this, v_int);
3497 // Set the contents of a %G_TYPE_INT64 #GValue to @v_int64.
3498 // <v_int64>: 64bit integer value to be set
3499 void set_int64(long v_int64) {
3500 g_value_set_int64(&this, v_int64);
3503 // Set the contents of a %G_TYPE_LONG #GValue to @v_long.
3504 // <v_long>: long integer value to be set
3505 void set_long(c_long v_long) {
3506 g_value_set_long(&this, v_long);
3509 // Set the contents of a %G_TYPE_OBJECT derived #GValue to @v_object.
3511 // g_value_set_object() increases the reference count of @v_object
3512 // (the #GValue holds a reference to @v_object). If you do not wish
3513 // to increase the reference count of the object (i.e. you wish to
3514 // pass your current reference to the #GValue because you no longer
3515 // need it), use g_value_take_object() instead.
3517 // It is important that your #GValue holds a reference to @v_object (either its
3518 // own, or one it has taken) to ensure that the object won't be destroyed while
3519 // the #GValue still exists).
3520 // <v_object>: object value to be set
3521 void set_object(Object* v_object=null) {
3522 g_value_set_object(&this, v_object);
3525 // Unintrospectable method: set_object_take_ownership() / g_value_set_object_take_ownership()
3526 // This is an internal function introduced mainly for C marshallers.
3527 // <v_object>: object value to be set
3528 void set_object_take_ownership(void* v_object=null) {
3529 g_value_set_object_take_ownership(&this, v_object);
3532 // Set the contents of a %G_TYPE_PARAM #GValue to @param.
3533 // <param>: the #GParamSpec to be set
3534 void set_param(ParamSpec* param=null) {
3535 g_value_set_param(&this, param);
3538 // Unintrospectable method: set_param_take_ownership() / g_value_set_param_take_ownership()
3539 // This is an internal function introduced mainly for C marshallers.
3540 // <param>: the #GParamSpec to be set
3541 void set_param_take_ownership(ParamSpec* param=null) {
3542 g_value_set_param_take_ownership(&this, param);
3545 // Set the contents of a pointer #GValue to @v_pointer.
3546 // <v_pointer>: pointer value to be set
3547 void set_pointer(void* v_pointer) {
3548 g_value_set_pointer(&this, v_pointer);
3551 // Set the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed.
3552 // The boxed value is assumed to be static, and is thus not duplicated
3553 // when setting the #GValue.
3554 // <v_boxed>: static boxed value to be set
3555 void set_static_boxed(const(void)* v_boxed=null) {
3556 g_value_set_static_boxed(&this, v_boxed);
3559 // Set the contents of a %G_TYPE_STRING #GValue to @v_string.
3560 // The string is assumed to be static, and is thus not duplicated
3561 // when setting the #GValue.
3562 // <v_string>: static string to be set
3563 void set_static_string(char* v_string=null) {
3564 g_value_set_static_string(&this, v_string);
3567 // Set the contents of a %G_TYPE_STRING #GValue to @v_string.
3568 // <v_string>: caller-owned string to be duplicated for the #GValue
3569 void set_string(char* v_string=null) {
3570 g_value_set_string(&this, v_string);
3573 // This is an internal function introduced mainly for C marshallers.
3574 // <v_string>: duplicated unowned string to be set
3575 void set_string_take_ownership(char* v_string=null) {
3576 g_value_set_string_take_ownership(&this, v_string);
3579 // Set the contents of a %G_TYPE_UCHAR #GValue to @v_uchar.
3580 // <v_uchar>: unsigned character value to be set
3581 void set_uchar(ubyte v_uchar) {
3582 g_value_set_uchar(&this, v_uchar);
3585 // Set the contents of a %G_TYPE_UINT #GValue to @v_uint.
3586 // <v_uint>: unsigned integer value to be set
3587 void set_uint(uint v_uint) {
3588 g_value_set_uint(&this, v_uint);
3591 // Set the contents of a %G_TYPE_UINT64 #GValue to @v_uint64.
3592 // <v_uint64>: unsigned 64bit integer value to be set
3593 void set_uint64(ulong v_uint64) {
3594 g_value_set_uint64(&this, v_uint64);
3597 // Set the contents of a %G_TYPE_ULONG #GValue to @v_ulong.
3598 // <v_ulong>: unsigned long integer value to be set
3599 void set_ulong(c_ulong v_ulong) {
3600 g_value_set_ulong(&this, v_ulong);
3603 // Set the contents of a variant #GValue to @variant.
3604 // If the variant is floating, it is consumed.
3605 // <variant>: a #GVariant, or %NULL
3606 void set_variant(GLib2.Variant* variant=null) {
3607 g_value_set_variant(&this, variant);
3610 // Sets the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed
3611 // and takes over the ownership of the callers reference to @v_boxed;
3612 // the caller doesn't have to unref it any more.
3613 // <v_boxed>: duplicated unowned boxed value to be set
3614 void take_boxed(const(void)* v_boxed=null) {
3615 g_value_take_boxed(&this, v_boxed);
3618 // Unintrospectable method: take_object() / g_value_take_object()
3619 // Sets the contents of a %G_TYPE_OBJECT derived #GValue to @v_object
3620 // and takes over the ownership of the callers reference to @v_object;
3621 // the caller doesn't have to unref it any more (i.e. the reference
3622 // count of the object is not increased).
3624 // If you want the #GValue to hold its own reference to @v_object, use
3625 // g_value_set_object() instead.
3626 // <v_object>: object value to be set
3627 void take_object(void* v_object=null) {
3628 g_value_take_object(&this, v_object);
3631 // Unintrospectable method: take_param() / g_value_take_param()
3632 // Sets the contents of a %G_TYPE_PARAM #GValue to @param and takes
3633 // over the ownership of the callers reference to @param; the caller
3634 // doesn't have to unref it any more.
3635 // <param>: the #GParamSpec to be set
3636 void take_param(ParamSpec* param=null) {
3637 g_value_take_param(&this, param);
3640 // Sets the contents of a %G_TYPE_STRING #GValue to @v_string.
3641 // <v_string>: string to take ownership of
3642 void take_string(char* v_string=null) {
3643 g_value_take_string(&this, v_string);
3646 // Set the contents of a variant #GValue to @variant, and takes over
3647 // the ownership of the caller's reference to @variant;
3648 // the caller doesn't have to unref it any more (i.e. the reference
3649 // count of the variant is not increased).
3651 // If @variant was floating then its floating reference is converted to
3652 // a hard reference.
3654 // If you want the #GValue to hold its own reference to @variant, use
3655 // g_value_set_variant() instead.
3657 // This is an internal function introduced mainly for C marshallers.
3658 // <variant>: a #GVariant, or %NULL
3659 void take_variant(GLib2.Variant* variant=null) {
3660 g_value_take_variant(&this, variant);
3663 // Tries to cast the contents of @src_value into a type appropriate
3664 // to store in @dest_value, e.g. to transform a %G_TYPE_INT value
3665 // into a %G_TYPE_FLOAT value. Performing transformations between
3666 // value types might incur precision lossage. Especially
3667 // transformations into strings might reveal seemingly arbitrary
3668 // results and shouldn't be relied upon for production code (such
3669 // as rcfile value or object property serialization).
3671 // Upon failing transformations, @dest_value is left untouched.
3672 // RETURNS: Whether a transformation rule was found and could be applied.
3673 // <dest_value>: Target value.
3674 int transform(Value* dest_value) {
3675 return g_value_transform(&this, dest_value);
3678 // Clears the current value in @value and "unsets" the type,
3679 // this releases all resources associated with this GValue.
3680 // An unset value is the same as an uninitialized (zero-filled)
3681 // #GValue structure.
3682 void unset() {
3683 g_value_unset(&this);
3686 // Unintrospectable function: register_transform_func() / g_value_register_transform_func()
3687 // Registers a value transformation function for use in g_value_transform().
3688 // A previously registered transformation function for @src_type and @dest_type
3689 // will be replaced.
3690 // <src_type>: Source type.
3691 // <dest_type>: Target type.
3692 // <transform_func>: a function which transforms values of type @src_type into value of type @dest_type
3693 static void register_transform_func(Type src_type, Type dest_type, ValueTransform transform_func) {
3694 g_value_register_transform_func(src_type, dest_type, transform_func);
3697 // Returns whether a #GValue of type @src_type can be copied into
3698 // a #GValue of type @dest_type.
3699 // RETURNS: %TRUE if g_value_copy() is possible with @src_type and @dest_type.
3700 // <src_type>: source type to be copied.
3701 // <dest_type>: destination type for copying.
3702 static int type_compatible(Type src_type, Type dest_type) {
3703 return g_value_type_compatible(src_type, dest_type);
3706 // Check whether g_value_transform() is able to transform values
3707 // of type @src_type into values of type @dest_type.
3708 // RETURNS: %TRUE if the transformation is possible, %FALSE otherwise.
3709 // <src_type>: Source type.
3710 // <dest_type>: Target type.
3711 static int type_transformable(Type src_type, Type dest_type) {
3712 return g_value_type_transformable(src_type, dest_type);
3716 // A #GValueArray contains an array of #GValue elements.
3717 struct ValueArray {
3718 uint n_values;
3719 Value* values;
3720 private uint n_prealloced;
3723 // Allocate and initialize a new #GValueArray, optionally preserve space
3724 // for @n_prealloced elements. New arrays always contain 0 elements,
3725 // regardless of the value of @n_prealloced.
3726 // RETURNS: a newly allocated #GValueArray with 0 values
3727 // <n_prealloced>: number of values to preallocate space for
3728 static ValueArray* /*new*/ new_(uint n_prealloced) {
3729 return g_value_array_new(n_prealloced);
3732 // Insert a copy of @value as last element of @value_array. If @value is
3733 // %NULL, an uninitialized value is appended.
3734 // RETURNS: the #GValueArray passed in as @value_array
3735 // <value>: #GValue to copy into #GValueArray, or %NULL
3736 ValueArray* append(Value* value=null) {
3737 return g_value_array_append(&this, value);
3740 // Construct an exact copy of a #GValueArray by duplicating all its
3741 // contents.
3742 // RETURNS: Newly allocated copy of #GValueArray
3743 ValueArray* /*new*/ copy() {
3744 return g_value_array_copy(&this);
3746 // Free a #GValueArray including its contents.
3747 void free() {
3748 g_value_array_free(&this);
3751 // Return a pointer to the value at @index_ containd in @value_array.
3752 // RETURNS: pointer to a value at @index_ in @value_array
3753 // <index_>: index of the value of interest
3754 Value* get_nth(uint index_) {
3755 return g_value_array_get_nth(&this, index_);
3758 // Insert a copy of @value at specified position into @value_array. If @value
3759 // is %NULL, an uninitialized value is inserted.
3760 // RETURNS: the #GValueArray passed in as @value_array
3761 // <index_>: insertion position, must be &lt;= value_array-&gt;n_values
3762 // <value>: #GValue to copy into #GValueArray, or %NULL
3763 ValueArray* insert(uint index_, Value* value=null) {
3764 return g_value_array_insert(&this, index_, value);
3767 // Insert a copy of @value as first element of @value_array. If @value is
3768 // %NULL, an uninitialized value is prepended.
3769 // RETURNS: the #GValueArray passed in as @value_array
3770 // <value>: #GValue to copy into #GValueArray, or %NULL
3771 ValueArray* prepend(Value* value=null) {
3772 return g_value_array_prepend(&this, value);
3775 // Remove the value at position @index_ from @value_array.
3776 // RETURNS: the #GValueArray passed in as @value_array
3777 // <index_>: position of value to remove, which must be less than <code>value_array-><link linkend="GValueArray.n-values">n_values</link></code>
3778 ValueArray* remove(uint index_) {
3779 return g_value_array_remove(&this, index_);
3782 // Sort @value_array using @compare_func to compare the elements according to
3783 // the semantics of #GCompareFunc.
3785 // The current implementation uses Quick-Sort as sorting algorithm.
3786 // RETURNS: the #GValueArray passed in as @value_array
3787 // <compare_func>: function to compare elements
3788 ValueArray* sort(GLib2.CompareFunc compare_func) {
3789 return g_value_array_sort(&this, compare_func);
3792 // Sort @value_array using @compare_func to compare the elements according
3793 // to the semantics of #GCompareDataFunc.
3795 // The current implementation uses Quick-Sort as sorting algorithm.
3796 // RETURNS: the #GValueArray passed in as @value_array
3797 // <compare_func>: function to compare elements
3798 // <user_data>: extra data argument provided for @compare_func
3799 ValueArray* sort_with_data(GLib2.CompareDataFunc compare_func, void* user_data) {
3800 return g_value_array_sort_with_data(&this, compare_func, user_data);
3805 // The type of value transformation functions which can be registered with
3806 // g_value_register_transform_func().
3807 // <src_value>: Source value.
3808 // <dest_value>: Target value.
3809 extern (C) alias void function (Value* src_value, Value* dest_value) ValueTransform;
3812 // A #GWeakNotify function can be added to an object as a callback that gets
3813 // triggered when the object is finalized. Since the object is already being
3814 // finalized when the #GWeakNotify is called, there's not much you could do
3815 // with the object, apart from e.g. using its address as hash-index or the like.
3816 // <data>: data that was provided when the weak reference was established
3817 // <where_the_object_was>: the object being finalized
3818 extern (C) alias void function (void* data, Object* where_the_object_was) WeakNotify;
3820 union _Value__data__union {
3821 int v_int;
3822 uint v_uint;
3823 c_long v_long;
3824 c_ulong v_ulong;
3825 long v_int64;
3826 ulong v_uint64;
3827 float v_float;
3828 double v_double;
3829 void* v_pointer;
3833 // Unintrospectable function: boxed_copy() / g_boxed_copy()
3834 // Provide a copy of a boxed structure @src_boxed which is of type @boxed_type.
3835 // RETURNS: The newly created copy of the boxed structure.
3836 // <boxed_type>: The type of @src_boxed.
3837 // <src_boxed>: The boxed structure to be copied.
3838 static void* boxed_copy(Type boxed_type, const(void)* src_boxed) {
3839 return g_boxed_copy(boxed_type, src_boxed);
3843 // Free the boxed structure @boxed which is of type @boxed_type.
3844 // <boxed_type>: The type of @boxed.
3845 // <boxed>: The boxed structure to be freed.
3846 static void boxed_free(Type boxed_type, void* boxed) {
3847 g_boxed_free(boxed_type, boxed);
3851 // Unintrospectable function: boxed_type_register_static() / g_boxed_type_register_static()
3852 // This function creates a new %G_TYPE_BOXED derived type id for a new
3853 // boxed type with name @name. Boxed type handling functions have to be
3854 // provided to copy and free opaque boxed structures of this type.
3855 // RETURNS: New %G_TYPE_BOXED derived type id for @name.
3856 // <name>: Name of the new boxed type.
3857 // <boxed_copy>: Boxed structure copy function.
3858 // <boxed_free>: Boxed structure free function.
3859 static Type boxed_type_register_static(char* name, BoxedCopyFunc boxed_copy, BoxedFreeFunc boxed_free) {
3860 return g_boxed_type_register_static(name, boxed_copy, boxed_free);
3863 static void cclosure_marshal_BOOLEAN__BOXED_BOXED(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
3864 g_cclosure_marshal_BOOLEAN__BOXED_BOXED(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
3868 // A marshaller for a #GCClosure with a callback of type
3869 // <literal>gboolean (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal> where the #gint parameter
3870 // denotes a flags type.
3871 // <closure>: the #GClosure to which the marshaller belongs
3872 // <return_value>: a #GValue which can store the returned #gboolean
3873 // <n_param_values>: 2
3874 // <param_values>: a #GValue array holding instance and arg1
3875 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
3876 // <marshal_data>: additional data specified when registering the marshaller
3877 static void cclosure_marshal_BOOLEAN__FLAGS(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
3878 g_cclosure_marshal_BOOLEAN__FLAGS(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
3882 // A marshaller for a #GCClosure with a callback of type
3883 // <literal>gchar* (*callback) (gpointer instance, GObject *arg1, gpointer arg2, gpointer user_data)</literal>.
3884 // <closure>: the #GClosure to which the marshaller belongs
3885 // <return_value>: a #GValue, which can store the returned string
3886 // <n_param_values>: 3
3887 // <param_values>: a #GValue array holding instance, arg1 and arg2
3888 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
3889 // <marshal_data>: additional data specified when registering the marshaller
3890 static void cclosure_marshal_STRING__OBJECT_POINTER(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
3891 g_cclosure_marshal_STRING__OBJECT_POINTER(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
3895 // A marshaller for a #GCClosure with a callback of type
3896 // <literal>void (*callback) (gpointer instance, gboolean arg1, gpointer user_data)</literal>.
3897 // <closure>: the #GClosure to which the marshaller belongs
3898 // <return_value>: ignored
3899 // <n_param_values>: 2
3900 // <param_values>: a #GValue array holding the instance and the #gboolean parameter
3901 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
3902 // <marshal_data>: additional data specified when registering the marshaller
3903 static void cclosure_marshal_VOID__BOOLEAN(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
3904 g_cclosure_marshal_VOID__BOOLEAN(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
3908 // A marshaller for a #GCClosure with a callback of type
3909 // <literal>void (*callback) (gpointer instance, GBoxed *arg1, gpointer user_data)</literal>.
3910 // <closure>: the #GClosure to which the marshaller belongs
3911 // <return_value>: ignored
3912 // <n_param_values>: 2
3913 // <param_values>: a #GValue array holding the instance and the #GBoxed* parameter
3914 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
3915 // <marshal_data>: additional data specified when registering the marshaller
3916 static void cclosure_marshal_VOID__BOXED(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
3917 g_cclosure_marshal_VOID__BOXED(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
3921 // A marshaller for a #GCClosure with a callback of type
3922 // <literal>void (*callback) (gpointer instance, gchar arg1, gpointer user_data)</literal>.
3923 // <closure>: the #GClosure to which the marshaller belongs
3924 // <return_value>: ignored
3925 // <n_param_values>: 2
3926 // <param_values>: a #GValue array holding the instance and the #gchar parameter
3927 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
3928 // <marshal_data>: additional data specified when registering the marshaller
3929 static void cclosure_marshal_VOID__CHAR(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
3930 g_cclosure_marshal_VOID__CHAR(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
3934 // A marshaller for a #GCClosure with a callback of type
3935 // <literal>void (*callback) (gpointer instance, gdouble arg1, gpointer user_data)</literal>.
3936 // <closure>: the #GClosure to which the marshaller belongs
3937 // <return_value>: ignored
3938 // <n_param_values>: 2
3939 // <param_values>: a #GValue array holding the instance and the #gdouble parameter
3940 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
3941 // <marshal_data>: additional data specified when registering the marshaller
3942 static void cclosure_marshal_VOID__DOUBLE(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
3943 g_cclosure_marshal_VOID__DOUBLE(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
3947 // A marshaller for a #GCClosure with a callback of type
3948 // <literal>void (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal> where the #gint parameter denotes an enumeration type..
3949 // <closure>: the #GClosure to which the marshaller belongs
3950 // <return_value>: ignored
3951 // <n_param_values>: 2
3952 // <param_values>: a #GValue array holding the instance and the enumeration parameter
3953 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
3954 // <marshal_data>: additional data specified when registering the marshaller
3955 static void cclosure_marshal_VOID__ENUM(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
3956 g_cclosure_marshal_VOID__ENUM(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
3960 // A marshaller for a #GCClosure with a callback of type
3961 // <literal>void (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal> where the #gint parameter denotes a flags type.
3962 // <closure>: the #GClosure to which the marshaller belongs
3963 // <return_value>: ignored
3964 // <n_param_values>: 2
3965 // <param_values>: a #GValue array holding the instance and the flags parameter
3966 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
3967 // <marshal_data>: additional data specified when registering the marshaller
3968 static void cclosure_marshal_VOID__FLAGS(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
3969 g_cclosure_marshal_VOID__FLAGS(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
3973 // A marshaller for a #GCClosure with a callback of type
3974 // <literal>void (*callback) (gpointer instance, gfloat arg1, gpointer user_data)</literal>.
3975 // <closure>: the #GClosure to which the marshaller belongs
3976 // <return_value>: ignored
3977 // <n_param_values>: 2
3978 // <param_values>: a #GValue array holding the instance and the #gfloat parameter
3979 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
3980 // <marshal_data>: additional data specified when registering the marshaller
3981 static void cclosure_marshal_VOID__FLOAT(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
3982 g_cclosure_marshal_VOID__FLOAT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
3986 // A marshaller for a #GCClosure with a callback of type
3987 // <literal>void (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal>.
3988 // <closure>: the #GClosure to which the marshaller belongs
3989 // <return_value>: ignored
3990 // <n_param_values>: 2
3991 // <param_values>: a #GValue array holding the instance and the #gint parameter
3992 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
3993 // <marshal_data>: additional data specified when registering the marshaller
3994 static void cclosure_marshal_VOID__INT(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
3995 g_cclosure_marshal_VOID__INT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
3999 // A marshaller for a #GCClosure with a callback of type
4000 // <literal>void (*callback) (gpointer instance, glong arg1, gpointer user_data)</literal>.
4001 // <closure>: the #GClosure to which the marshaller belongs
4002 // <return_value>: ignored
4003 // <n_param_values>: 2
4004 // <param_values>: a #GValue array holding the instance and the #glong parameter
4005 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
4006 // <marshal_data>: additional data specified when registering the marshaller
4007 static void cclosure_marshal_VOID__LONG(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
4008 g_cclosure_marshal_VOID__LONG(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
4012 // A marshaller for a #GCClosure with a callback of type
4013 // <literal>void (*callback) (gpointer instance, GObject *arg1, gpointer user_data)</literal>.
4014 // <closure>: the #GClosure to which the marshaller belongs
4015 // <return_value>: ignored
4016 // <n_param_values>: 2
4017 // <param_values>: a #GValue array holding the instance and the #GObject* parameter
4018 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
4019 // <marshal_data>: additional data specified when registering the marshaller
4020 static void cclosure_marshal_VOID__OBJECT(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
4021 g_cclosure_marshal_VOID__OBJECT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
4025 // A marshaller for a #GCClosure with a callback of type
4026 // <literal>void (*callback) (gpointer instance, GParamSpec *arg1, gpointer user_data)</literal>.
4027 // <closure>: the #GClosure to which the marshaller belongs
4028 // <return_value>: ignored
4029 // <n_param_values>: 2
4030 // <param_values>: a #GValue array holding the instance and the #GParamSpec* parameter
4031 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
4032 // <marshal_data>: additional data specified when registering the marshaller
4033 static void cclosure_marshal_VOID__PARAM(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
4034 g_cclosure_marshal_VOID__PARAM(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
4038 // A marshaller for a #GCClosure with a callback of type
4039 // <literal>void (*callback) (gpointer instance, gpointer arg1, gpointer user_data)</literal>.
4040 // <closure>: the #GClosure to which the marshaller belongs
4041 // <return_value>: ignored
4042 // <n_param_values>: 2
4043 // <param_values>: a #GValue array holding the instance and the #gpointer parameter
4044 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
4045 // <marshal_data>: additional data specified when registering the marshaller
4046 static void cclosure_marshal_VOID__POINTER(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
4047 g_cclosure_marshal_VOID__POINTER(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
4051 // A marshaller for a #GCClosure with a callback of type
4052 // <literal>void (*callback) (gpointer instance, const gchar *arg1, gpointer user_data)</literal>.
4053 // <closure>: the #GClosure to which the marshaller belongs
4054 // <return_value>: ignored
4055 // <n_param_values>: 2
4056 // <param_values>: a #GValue array holding the instance and the #gchar* parameter
4057 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
4058 // <marshal_data>: additional data specified when registering the marshaller
4059 static void cclosure_marshal_VOID__STRING(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
4060 g_cclosure_marshal_VOID__STRING(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
4064 // A marshaller for a #GCClosure with a callback of type
4065 // <literal>void (*callback) (gpointer instance, guchar arg1, gpointer user_data)</literal>.
4066 // <closure>: the #GClosure to which the marshaller belongs
4067 // <return_value>: ignored
4068 // <n_param_values>: 2
4069 // <param_values>: a #GValue array holding the instance and the #guchar parameter
4070 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
4071 // <marshal_data>: additional data specified when registering the marshaller
4072 static void cclosure_marshal_VOID__UCHAR(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
4073 g_cclosure_marshal_VOID__UCHAR(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
4077 // A marshaller for a #GCClosure with a callback of type
4078 // <literal>void (*callback) (gpointer instance, guint arg1, gpointer user_data)</literal>.
4079 // <closure>: the #GClosure to which the marshaller belongs
4080 // <return_value>: ignored
4081 // <n_param_values>: 2
4082 // <param_values>: a #GValue array holding the instance and the #guint parameter
4083 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
4084 // <marshal_data>: additional data specified when registering the marshaller
4085 static void cclosure_marshal_VOID__UINT(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
4086 g_cclosure_marshal_VOID__UINT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
4090 // A marshaller for a #GCClosure with a callback of type
4091 // <literal>void (*callback) (gpointer instance, guint arg1, gpointer arg2, gpointer user_data)</literal>.
4092 // <closure>: the #GClosure to which the marshaller belongs
4093 // <return_value>: ignored
4094 // <n_param_values>: 3
4095 // <param_values>: a #GValue array holding instance, arg1 and arg2
4096 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
4097 // <marshal_data>: additional data specified when registering the marshaller
4098 static void cclosure_marshal_VOID__UINT_POINTER(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
4099 g_cclosure_marshal_VOID__UINT_POINTER(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
4103 // A marshaller for a #GCClosure with a callback of type
4104 // <literal>void (*callback) (gpointer instance, gulong arg1, gpointer user_data)</literal>.
4105 // <closure>: the #GClosure to which the marshaller belongs
4106 // <return_value>: ignored
4107 // <n_param_values>: 2
4108 // <param_values>: a #GValue array holding the instance and the #gulong parameter
4109 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
4110 // <marshal_data>: additional data specified when registering the marshaller
4111 static void cclosure_marshal_VOID__ULONG(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
4112 g_cclosure_marshal_VOID__ULONG(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
4116 // A marshaller for a #GCClosure with a callback of type
4117 // <literal>void (*callback) (gpointer instance, GVariant *arg1, gpointer user_data)</literal>.
4118 // <closure>: the #GClosure to which the marshaller belongs
4119 // <return_value>: ignored
4120 // <n_param_values>: 2
4121 // <param_values>: a #GValue array holding the instance and the #GVariant* parameter
4122 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
4123 // <marshal_data>: additional data specified when registering the marshaller
4124 static void cclosure_marshal_VOID__VARIANT(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
4125 g_cclosure_marshal_VOID__VARIANT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
4129 // A marshaller for a #GCClosure with a callback of type
4130 // <literal>void (*callback) (gpointer instance, gpointer user_data)</literal>.
4131 // <closure>: the #GClosure to which the marshaller belongs
4132 // <return_value>: ignored
4133 // <n_param_values>: 1
4134 // <param_values>: a #GValue array holding only the instance
4135 // <invocation_hint>: the invocation hint given as the last argument to g_closure_invoke()
4136 // <marshal_data>: additional data specified when registering the marshaller
4137 static void cclosure_marshal_VOID__VOID(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
4138 g_cclosure_marshal_VOID__VOID(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data);
4142 // A generic marshaller function implemented via <ulink
4143 // url="http://sourceware.org/libffi/">libffi</ulink>.
4144 // <closure>: A #GClosure.
4145 // <return_gvalue>: A #GValue to store the return value. May be %NULL if the callback of closure doesn't return a value.
4146 // <n_param_values>: The length of the @param_values array.
4147 // <param_values>: An array of #GValue<!-- -->s holding the arguments on which to invoke the callback of closure.
4148 // <invocation_hint>: The invocation hint given as the last argument to g_closure_invoke().
4149 // <marshal_data>: Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
4150 static void cclosure_marshal_generic(Closure* closure, Value* return_gvalue, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data) {
4151 g_cclosure_marshal_generic(closure, return_gvalue, n_param_values, param_values, invocation_hint, marshal_data);
4155 // Unintrospectable function: cclosure_new() / g_cclosure_new()
4156 // Creates a new closure which invokes @callback_func with @user_data as
4157 // the last parameter.
4158 // RETURNS: a new #GCClosure
4159 // <callback_func>: the function to invoke
4160 // <user_data>: user data to pass to @callback_func
4161 // <destroy_data>: destroy notify to be called when @user_data is no longer used
4162 static Closure* /*new*/ cclosure_new(Callback callback_func, void* user_data, ClosureNotify destroy_data) {
4163 return g_cclosure_new(callback_func, user_data, destroy_data);
4167 // Unintrospectable function: cclosure_new_object() / g_cclosure_new_object()
4168 // A variant of g_cclosure_new() which uses @object as @user_data and
4169 // calls g_object_watch_closure() on @object and the created
4170 // closure. This function is useful when you have a callback closely
4171 // associated with a #GObject, and want the callback to no longer run
4172 // after the object is is freed.
4173 // RETURNS: a new #GCClosure
4174 // <callback_func>: the function to invoke
4175 // <object>: a #GObject pointer to pass to @callback_func
4176 static Closure* /*new*/ cclosure_new_object(Callback callback_func, Object* object) {
4177 return g_cclosure_new_object(callback_func, object);
4181 // Unintrospectable function: cclosure_new_object_swap() / g_cclosure_new_object_swap()
4182 // A variant of g_cclosure_new_swap() which uses @object as @user_data
4183 // and calls g_object_watch_closure() on @object and the created
4184 // closure. This function is useful when you have a callback closely
4185 // associated with a #GObject, and want the callback to no longer run
4186 // after the object is is freed.
4187 // RETURNS: a new #GCClosure
4188 // <callback_func>: the function to invoke
4189 // <object>: a #GObject pointer to pass to @callback_func
4190 static Closure* /*new*/ cclosure_new_object_swap(Callback callback_func, Object* object) {
4191 return g_cclosure_new_object_swap(callback_func, object);
4195 // Unintrospectable function: cclosure_new_swap() / g_cclosure_new_swap()
4196 // Creates a new closure which invokes @callback_func with @user_data as
4197 // the first parameter.
4198 // RETURNS: a new #GCClosure
4199 // <callback_func>: the function to invoke
4200 // <user_data>: user data to pass to @callback_func
4201 // <destroy_data>: destroy notify to be called when @user_data is no longer used
4202 static Closure* /*new*/ cclosure_new_swap(Callback callback_func, void* user_data, ClosureNotify destroy_data) {
4203 return g_cclosure_new_swap(callback_func, user_data, destroy_data);
4207 // Unintrospectable function: clear_object() / g_clear_object()
4208 // Clears a reference to a #GObject.
4210 // @object_ptr must not be %NULL.
4212 // If the reference is %NULL then this function does nothing.
4213 // Otherwise, the reference count of the object is decreased and the
4214 // pointer is set to %NULL.
4216 // This function is threadsafe and modifies the pointer atomically,
4217 // using memory barriers where needed.
4219 // A macro is also included that allows this function to be used without
4220 // pointer casts.
4221 // <object_ptr>: a pointer to a #GObject reference
4222 static void clear_object(Object** object_ptr) {
4223 g_clear_object(object_ptr);
4227 // This function is meant to be called from the complete_type_info()
4228 // function of a #GTypePlugin implementation, as in the following
4229 // example:
4231 // |[
4232 // static void
4233 // my_enum_complete_type_info (GTypePlugin *plugin,
4234 // GType g_type,
4235 // GTypeInfo *info,
4236 // GTypeValueTable *value_table)
4237 // {
4238 // static const GEnumValue values[] = {
4239 // { MY_ENUM_FOO, "MY_ENUM_FOO", "foo" },
4240 // { MY_ENUM_BAR, "MY_ENUM_BAR", "bar" },
4241 // { 0, NULL, NULL }
4242 // };
4244 // g_enum_complete_type_info (type, info, values);
4245 // }
4246 // ]|
4247 // <g_enum_type>: the type identifier of the type being completed
4248 // <info>: the #GTypeInfo struct to be filled in
4249 // <const_values>: An array of #GEnumValue structs for the possible enumeration values. The array is terminated by a struct with all members being 0.
4250 static void enum_complete_type_info(Type g_enum_type, TypeInfo* info, EnumValue* const_values) {
4251 g_enum_complete_type_info(g_enum_type, info, const_values);
4255 // Unintrospectable function: enum_get_value() / g_enum_get_value()
4256 // Returns the #GEnumValue for a value.
4258 // member of the enumeration
4259 // RETURNS: the #GEnumValue for @value, or %NULL if @value is not a
4260 // <enum_class>: a #GEnumClass
4261 // <value>: the value to look up
4262 static EnumValue* enum_get_value(EnumClass* enum_class, int value) {
4263 return g_enum_get_value(enum_class, value);
4267 // Unintrospectable function: enum_get_value_by_name() / g_enum_get_value_by_name()
4268 // Looks up a #GEnumValue by name.
4270 // enumeration doesn't have a member with that name
4271 // RETURNS: the #GEnumValue with name @name, or %NULL if the
4272 // <enum_class>: a #GEnumClass
4273 // <name>: the name to look up
4274 static EnumValue* enum_get_value_by_name(EnumClass* enum_class, char* name) {
4275 return g_enum_get_value_by_name(enum_class, name);
4279 // Unintrospectable function: enum_get_value_by_nick() / g_enum_get_value_by_nick()
4280 // Looks up a #GEnumValue by nickname.
4282 // enumeration doesn't have a member with that nickname
4283 // RETURNS: the #GEnumValue with nickname @nick, or %NULL if the
4284 // <enum_class>: a #GEnumClass
4285 // <nick>: the nickname to look up
4286 static EnumValue* enum_get_value_by_nick(EnumClass* enum_class, char* nick) {
4287 return g_enum_get_value_by_nick(enum_class, nick);
4291 // Registers a new static enumeration type with the name @name.
4293 // It is normally more convenient to let <link
4294 // linkend="glib-mkenums">glib-mkenums</link> generate a
4295 // my_enum_get_type() function from a usual C enumeration definition
4296 // than to write one yourself using g_enum_register_static().
4297 // RETURNS: The new type identifier.
4298 // <name>: A nul-terminated string used as the name of the new type.
4299 // <const_static_values>: An array of #GEnumValue structs for the possible enumeration values. The array is terminated by a struct with all members being 0. GObject keeps a reference to the data, so it cannot be stack-allocated.
4300 static Type enum_register_static(char* name, EnumValue* const_static_values) {
4301 return g_enum_register_static(name, const_static_values);
4305 // This function is meant to be called from the complete_type_info()
4306 // function of a #GTypePlugin implementation, see the example for
4307 // g_enum_complete_type_info() above.
4308 // <g_flags_type>: the type identifier of the type being completed
4309 // <info>: the #GTypeInfo struct to be filled in
4310 // <const_values>: An array of #GFlagsValue structs for the possible enumeration values. The array is terminated by a struct with all members being 0.
4311 static void flags_complete_type_info(Type g_flags_type, TypeInfo* info, FlagsValue* const_values) {
4312 g_flags_complete_type_info(g_flags_type, info, const_values);
4316 // Unintrospectable function: flags_get_first_value() / g_flags_get_first_value()
4317 // Returns the first #GFlagsValue which is set in @value.
4319 // none is set
4320 // RETURNS: the first #GFlagsValue which is set in @value, or %NULL if
4321 // <flags_class>: a #GFlagsClass
4322 // <value>: the value
4323 static FlagsValue* flags_get_first_value(FlagsClass* flags_class, uint value) {
4324 return g_flags_get_first_value(flags_class, value);
4328 // Unintrospectable function: flags_get_value_by_name() / g_flags_get_value_by_name()
4329 // Looks up a #GFlagsValue by name.
4331 // flag with that name
4332 // RETURNS: the #GFlagsValue with name @name, or %NULL if there is no
4333 // <flags_class>: a #GFlagsClass
4334 // <name>: the name to look up
4335 static FlagsValue* flags_get_value_by_name(FlagsClass* flags_class, char* name) {
4336 return g_flags_get_value_by_name(flags_class, name);
4340 // Unintrospectable function: flags_get_value_by_nick() / g_flags_get_value_by_nick()
4341 // Looks up a #GFlagsValue by nickname.
4343 // no flag with that nickname
4344 // RETURNS: the #GFlagsValue with nickname @nick, or %NULL if there is
4345 // <flags_class>: a #GFlagsClass
4346 // <nick>: the nickname to look up
4347 static FlagsValue* flags_get_value_by_nick(FlagsClass* flags_class, char* nick) {
4348 return g_flags_get_value_by_nick(flags_class, nick);
4352 // Registers a new static flags type with the name @name.
4354 // It is normally more convenient to let <link
4355 // linkend="glib-mkenums">glib-mkenums</link> generate a
4356 // my_flags_get_type() function from a usual C enumeration definition
4357 // than to write one yourself using g_flags_register_static().
4358 // RETURNS: The new type identifier.
4359 // <name>: A nul-terminated string used as the name of the new type.
4360 // <const_static_values>: An array of #GFlagsValue structs for the possible flags values. The array is terminated by a struct with all members being 0. GObject keeps a reference to the data, so it cannot be stack-allocated.
4361 static Type flags_register_static(char* name, FlagsValue* const_static_values) {
4362 return g_flags_register_static(name, const_static_values);
4365 static Type gtype_get_type() {
4366 return g_gtype_get_type();
4370 // Unintrospectable function: param_spec_boolean() / g_param_spec_boolean()
4371 // Creates a new #GParamSpecBoolean instance specifying a %G_TYPE_BOOLEAN
4372 // property.
4374 // See g_param_spec_internal() for details on property names.
4375 // RETURNS: a newly created parameter specification
4376 // <name>: canonical name of the property specified
4377 // <nick>: nick name for the property specified
4378 // <blurb>: description of the property specified
4379 // <default_value>: default value for the property specified
4380 // <flags>: flags for the property specified
4381 static ParamSpec* param_spec_boolean(char* name, char* nick, char* blurb, int default_value, ParamFlags flags) {
4382 return g_param_spec_boolean(name, nick, blurb, default_value, flags);
4386 // Unintrospectable function: param_spec_boxed() / g_param_spec_boxed()
4387 // Creates a new #GParamSpecBoxed instance specifying a %G_TYPE_BOXED
4388 // derived property.
4390 // See g_param_spec_internal() for details on property names.
4391 // RETURNS: a newly created parameter specification
4392 // <name>: canonical name of the property specified
4393 // <nick>: nick name for the property specified
4394 // <blurb>: description of the property specified
4395 // <boxed_type>: %G_TYPE_BOXED derived type of this property
4396 // <flags>: flags for the property specified
4397 static ParamSpec* param_spec_boxed(char* name, char* nick, char* blurb, Type boxed_type, ParamFlags flags) {
4398 return g_param_spec_boxed(name, nick, blurb, boxed_type, flags);
4402 // Unintrospectable function: param_spec_char() / g_param_spec_char()
4403 // Creates a new #GParamSpecChar instance specifying a %G_TYPE_CHAR property.
4404 // RETURNS: a newly created parameter specification
4405 // <name>: canonical name of the property specified
4406 // <nick>: nick name for the property specified
4407 // <blurb>: description of the property specified
4408 // <minimum>: minimum value for the property specified
4409 // <maximum>: maximum value for the property specified
4410 // <default_value>: default value for the property specified
4411 // <flags>: flags for the property specified
4412 static ParamSpec* param_spec_char(char* name, char* nick, char* blurb, byte minimum, byte maximum, byte default_value, ParamFlags flags) {
4413 return g_param_spec_char(name, nick, blurb, minimum, maximum, default_value, flags);
4417 // Unintrospectable function: param_spec_double() / g_param_spec_double()
4418 // Creates a new #GParamSpecDouble instance specifying a %G_TYPE_DOUBLE
4419 // property.
4421 // See g_param_spec_internal() for details on property names.
4422 // RETURNS: a newly created parameter specification
4423 // <name>: canonical name of the property specified
4424 // <nick>: nick name for the property specified
4425 // <blurb>: description of the property specified
4426 // <minimum>: minimum value for the property specified
4427 // <maximum>: maximum value for the property specified
4428 // <default_value>: default value for the property specified
4429 // <flags>: flags for the property specified
4430 static ParamSpec* param_spec_double(char* name, char* nick, char* blurb, double minimum, double maximum, double default_value, ParamFlags flags) {
4431 return g_param_spec_double(name, nick, blurb, minimum, maximum, default_value, flags);
4435 // Unintrospectable function: param_spec_enum() / g_param_spec_enum()
4436 // Creates a new #GParamSpecEnum instance specifying a %G_TYPE_ENUM
4437 // property.
4439 // See g_param_spec_internal() for details on property names.
4440 // RETURNS: a newly created parameter specification
4441 // <name>: canonical name of the property specified
4442 // <nick>: nick name for the property specified
4443 // <blurb>: description of the property specified
4444 // <enum_type>: a #GType derived from %G_TYPE_ENUM
4445 // <default_value>: default value for the property specified
4446 // <flags>: flags for the property specified
4447 static ParamSpec* param_spec_enum(char* name, char* nick, char* blurb, Type enum_type, int default_value, ParamFlags flags) {
4448 return g_param_spec_enum(name, nick, blurb, enum_type, default_value, flags);
4452 // Unintrospectable function: param_spec_flags() / g_param_spec_flags()
4453 // Creates a new #GParamSpecFlags instance specifying a %G_TYPE_FLAGS
4454 // property.
4456 // See g_param_spec_internal() for details on property names.
4457 // RETURNS: a newly created parameter specification
4458 // <name>: canonical name of the property specified
4459 // <nick>: nick name for the property specified
4460 // <blurb>: description of the property specified
4461 // <flags_type>: a #GType derived from %G_TYPE_FLAGS
4462 // <default_value>: default value for the property specified
4463 // <flags>: flags for the property specified
4464 static ParamSpec* param_spec_flags(char* name, char* nick, char* blurb, Type flags_type, uint default_value, ParamFlags flags) {
4465 return g_param_spec_flags(name, nick, blurb, flags_type, default_value, flags);
4469 // Unintrospectable function: param_spec_float() / g_param_spec_float()
4470 // Creates a new #GParamSpecFloat instance specifying a %G_TYPE_FLOAT property.
4472 // See g_param_spec_internal() for details on property names.
4473 // RETURNS: a newly created parameter specification
4474 // <name>: canonical name of the property specified
4475 // <nick>: nick name for the property specified
4476 // <blurb>: description of the property specified
4477 // <minimum>: minimum value for the property specified
4478 // <maximum>: maximum value for the property specified
4479 // <default_value>: default value for the property specified
4480 // <flags>: flags for the property specified
4481 static ParamSpec* param_spec_float(char* name, char* nick, char* blurb, float minimum, float maximum, float default_value, ParamFlags flags) {
4482 return g_param_spec_float(name, nick, blurb, minimum, maximum, default_value, flags);
4486 // Unintrospectable function: param_spec_gtype() / g_param_spec_gtype()
4487 // Creates a new #GParamSpecGType instance specifying a
4488 // %G_TYPE_GTYPE property.
4490 // See g_param_spec_internal() for details on property names.
4491 // RETURNS: a newly created parameter specification
4492 // <name>: canonical name of the property specified
4493 // <nick>: nick name for the property specified
4494 // <blurb>: description of the property specified
4495 // <is_a_type>: a #GType whose subtypes are allowed as values of the property (use %G_TYPE_NONE for any type)
4496 // <flags>: flags for the property specified
4497 static ParamSpec* param_spec_gtype(char* name, char* nick, char* blurb, Type is_a_type, ParamFlags flags) {
4498 return g_param_spec_gtype(name, nick, blurb, is_a_type, flags);
4502 // Unintrospectable function: param_spec_int() / g_param_spec_int()
4503 // Creates a new #GParamSpecInt instance specifying a %G_TYPE_INT property.
4505 // See g_param_spec_internal() for details on property names.
4506 // RETURNS: a newly created parameter specification
4507 // <name>: canonical name of the property specified
4508 // <nick>: nick name for the property specified
4509 // <blurb>: description of the property specified
4510 // <minimum>: minimum value for the property specified
4511 // <maximum>: maximum value for the property specified
4512 // <default_value>: default value for the property specified
4513 // <flags>: flags for the property specified
4514 static ParamSpec* param_spec_int(char* name, char* nick, char* blurb, int minimum, int maximum, int default_value, ParamFlags flags) {
4515 return g_param_spec_int(name, nick, blurb, minimum, maximum, default_value, flags);
4519 // Unintrospectable function: param_spec_int64() / g_param_spec_int64()
4520 // Creates a new #GParamSpecInt64 instance specifying a %G_TYPE_INT64 property.
4522 // See g_param_spec_internal() for details on property names.
4523 // RETURNS: a newly created parameter specification
4524 // <name>: canonical name of the property specified
4525 // <nick>: nick name for the property specified
4526 // <blurb>: description of the property specified
4527 // <minimum>: minimum value for the property specified
4528 // <maximum>: maximum value for the property specified
4529 // <default_value>: default value for the property specified
4530 // <flags>: flags for the property specified
4531 static ParamSpec* param_spec_int64(char* name, char* nick, char* blurb, long minimum, long maximum, long default_value, ParamFlags flags) {
4532 return g_param_spec_int64(name, nick, blurb, minimum, maximum, default_value, flags);
4536 // Unintrospectable function: param_spec_long() / g_param_spec_long()
4537 // Creates a new #GParamSpecLong instance specifying a %G_TYPE_LONG property.
4539 // See g_param_spec_internal() for details on property names.
4540 // RETURNS: a newly created parameter specification
4541 // <name>: canonical name of the property specified
4542 // <nick>: nick name for the property specified
4543 // <blurb>: description of the property specified
4544 // <minimum>: minimum value for the property specified
4545 // <maximum>: maximum value for the property specified
4546 // <default_value>: default value for the property specified
4547 // <flags>: flags for the property specified
4548 static ParamSpec* param_spec_long(char* name, char* nick, char* blurb, c_long minimum, c_long maximum, c_long default_value, ParamFlags flags) {
4549 return g_param_spec_long(name, nick, blurb, minimum, maximum, default_value, flags);
4553 // Unintrospectable function: param_spec_object() / g_param_spec_object()
4554 // Creates a new #GParamSpecBoxed instance specifying a %G_TYPE_OBJECT
4555 // derived property.
4557 // See g_param_spec_internal() for details on property names.
4558 // RETURNS: a newly created parameter specification
4559 // <name>: canonical name of the property specified
4560 // <nick>: nick name for the property specified
4561 // <blurb>: description of the property specified
4562 // <object_type>: %G_TYPE_OBJECT derived type of this property
4563 // <flags>: flags for the property specified
4564 static ParamSpec* param_spec_object(char* name, char* nick, char* blurb, Type object_type, ParamFlags flags) {
4565 return g_param_spec_object(name, nick, blurb, object_type, flags);
4569 // Unintrospectable function: param_spec_override() / g_param_spec_override()
4570 // Creates a new property of type #GParamSpecOverride. This is used
4571 // to direct operations to another paramspec, and will not be directly
4572 // useful unless you are implementing a new base type similar to GObject.
4573 // RETURNS: the newly created #GParamSpec
4574 // <name>: the name of the property.
4575 // <overridden>: The property that is being overridden
4576 static ParamSpec* param_spec_override(char* name, ParamSpec* overridden) {
4577 return g_param_spec_override(name, overridden);
4581 // Unintrospectable function: param_spec_param() / g_param_spec_param()
4582 // Creates a new #GParamSpecParam instance specifying a %G_TYPE_PARAM
4583 // property.
4585 // See g_param_spec_internal() for details on property names.
4586 // RETURNS: a newly created parameter specification
4587 // <name>: canonical name of the property specified
4588 // <nick>: nick name for the property specified
4589 // <blurb>: description of the property specified
4590 // <param_type>: a #GType derived from %G_TYPE_PARAM
4591 // <flags>: flags for the property specified
4592 static ParamSpec* param_spec_param(char* name, char* nick, char* blurb, Type param_type, ParamFlags flags) {
4593 return g_param_spec_param(name, nick, blurb, param_type, flags);
4597 // Unintrospectable function: param_spec_pointer() / g_param_spec_pointer()
4598 // Creates a new #GParamSpecPoiner instance specifying a pointer property.
4600 // See g_param_spec_internal() for details on property names.
4601 // RETURNS: a newly created parameter specification
4602 // <name>: canonical name of the property specified
4603 // <nick>: nick name for the property specified
4604 // <blurb>: description of the property specified
4605 // <flags>: flags for the property specified
4606 static ParamSpec* param_spec_pointer(char* name, char* nick, char* blurb, ParamFlags flags) {
4607 return g_param_spec_pointer(name, nick, blurb, flags);
4611 // Creates a new #GParamSpecPool.
4613 // If @type_prefixing is %TRUE, lookups in the newly created pool will
4614 // allow to specify the owner as a colon-separated prefix of the
4615 // property name, like "GtkContainer:border-width". This feature is
4616 // deprecated, so you should always set @type_prefixing to %FALSE.
4617 // RETURNS: a newly allocated #GParamSpecPool.
4618 // <type_prefixing>: Whether the pool will support type-prefixed property names.
4619 static ParamSpecPool* param_spec_pool_new(int type_prefixing) {
4620 return g_param_spec_pool_new(type_prefixing);
4624 // Unintrospectable function: param_spec_string() / g_param_spec_string()
4625 // Creates a new #GParamSpecString instance.
4627 // See g_param_spec_internal() for details on property names.
4628 // RETURNS: a newly created parameter specification
4629 // <name>: canonical name of the property specified
4630 // <nick>: nick name for the property specified
4631 // <blurb>: description of the property specified
4632 // <default_value>: default value for the property specified
4633 // <flags>: flags for the property specified
4634 static ParamSpec* param_spec_string(char* name, char* nick, char* blurb, char* default_value, ParamFlags flags) {
4635 return g_param_spec_string(name, nick, blurb, default_value, flags);
4639 // Unintrospectable function: param_spec_uchar() / g_param_spec_uchar()
4640 // Creates a new #GParamSpecUChar instance specifying a %G_TYPE_UCHAR property.
4641 // RETURNS: a newly created parameter specification
4642 // <name>: canonical name of the property specified
4643 // <nick>: nick name for the property specified
4644 // <blurb>: description of the property specified
4645 // <minimum>: minimum value for the property specified
4646 // <maximum>: maximum value for the property specified
4647 // <default_value>: default value for the property specified
4648 // <flags>: flags for the property specified
4649 static ParamSpec* param_spec_uchar(char* name, char* nick, char* blurb, ubyte minimum, ubyte maximum, ubyte default_value, ParamFlags flags) {
4650 return g_param_spec_uchar(name, nick, blurb, minimum, maximum, default_value, flags);
4654 // Unintrospectable function: param_spec_uint() / g_param_spec_uint()
4655 // Creates a new #GParamSpecUInt instance specifying a %G_TYPE_UINT property.
4657 // See g_param_spec_internal() for details on property names.
4658 // RETURNS: a newly created parameter specification
4659 // <name>: canonical name of the property specified
4660 // <nick>: nick name for the property specified
4661 // <blurb>: description of the property specified
4662 // <minimum>: minimum value for the property specified
4663 // <maximum>: maximum value for the property specified
4664 // <default_value>: default value for the property specified
4665 // <flags>: flags for the property specified
4666 static ParamSpec* param_spec_uint(char* name, char* nick, char* blurb, uint minimum, uint maximum, uint default_value, ParamFlags flags) {
4667 return g_param_spec_uint(name, nick, blurb, minimum, maximum, default_value, flags);
4671 // Unintrospectable function: param_spec_uint64() / g_param_spec_uint64()
4672 // Creates a new #GParamSpecUInt64 instance specifying a %G_TYPE_UINT64
4673 // property.
4675 // See g_param_spec_internal() for details on property names.
4676 // RETURNS: a newly created parameter specification
4677 // <name>: canonical name of the property specified
4678 // <nick>: nick name for the property specified
4679 // <blurb>: description of the property specified
4680 // <minimum>: minimum value for the property specified
4681 // <maximum>: maximum value for the property specified
4682 // <default_value>: default value for the property specified
4683 // <flags>: flags for the property specified
4684 static ParamSpec* param_spec_uint64(char* name, char* nick, char* blurb, ulong minimum, ulong maximum, ulong default_value, ParamFlags flags) {
4685 return g_param_spec_uint64(name, nick, blurb, minimum, maximum, default_value, flags);
4689 // Unintrospectable function: param_spec_ulong() / g_param_spec_ulong()
4690 // Creates a new #GParamSpecULong instance specifying a %G_TYPE_ULONG
4691 // property.
4693 // See g_param_spec_internal() for details on property names.
4694 // RETURNS: a newly created parameter specification
4695 // <name>: canonical name of the property specified
4696 // <nick>: nick name for the property specified
4697 // <blurb>: description of the property specified
4698 // <minimum>: minimum value for the property specified
4699 // <maximum>: maximum value for the property specified
4700 // <default_value>: default value for the property specified
4701 // <flags>: flags for the property specified
4702 static ParamSpec* param_spec_ulong(char* name, char* nick, char* blurb, c_ulong minimum, c_ulong maximum, c_ulong default_value, ParamFlags flags) {
4703 return g_param_spec_ulong(name, nick, blurb, minimum, maximum, default_value, flags);
4707 // Unintrospectable function: param_spec_unichar() / g_param_spec_unichar()
4708 // Creates a new #GParamSpecUnichar instance specifying a %G_TYPE_UINT
4709 // property. #GValue structures for this property can be accessed with
4710 // g_value_set_uint() and g_value_get_uint().
4712 // See g_param_spec_internal() for details on property names.
4713 // RETURNS: a newly created parameter specification
4714 // <name>: canonical name of the property specified
4715 // <nick>: nick name for the property specified
4716 // <blurb>: description of the property specified
4717 // <default_value>: default value for the property specified
4718 // <flags>: flags for the property specified
4719 static ParamSpec* param_spec_unichar(char* name, char* nick, char* blurb, dchar default_value, ParamFlags flags) {
4720 return g_param_spec_unichar(name, nick, blurb, default_value, flags);
4724 // Unintrospectable function: param_spec_value_array() / g_param_spec_value_array()
4725 // Creates a new #GParamSpecValueArray instance specifying a
4726 // %G_TYPE_VALUE_ARRAY property. %G_TYPE_VALUE_ARRAY is a
4727 // %G_TYPE_BOXED type, as such, #GValue structures for this property
4728 // can be accessed with g_value_set_boxed() and g_value_get_boxed().
4730 // See g_param_spec_internal() for details on property names.
4731 // RETURNS: a newly created parameter specification
4732 // <name>: canonical name of the property specified
4733 // <nick>: nick name for the property specified
4734 // <blurb>: description of the property specified
4735 // <element_spec>: a #GParamSpec describing the elements contained in arrays of this property, may be %NULL
4736 // <flags>: flags for the property specified
4737 static ParamSpec* param_spec_value_array(char* name, char* nick, char* blurb, ParamSpec* element_spec, ParamFlags flags) {
4738 return g_param_spec_value_array(name, nick, blurb, element_spec, flags);
4742 // Unintrospectable function: param_spec_variant() / g_param_spec_variant()
4743 // Creates a new #GParamSpecVariant instance specifying a #GVariant
4744 // property.
4746 // If @default_value is floating, it is consumed.
4748 // See g_param_spec_internal() for details on property names.
4749 // RETURNS: the newly created #GParamSpec
4750 // <name>: canonical name of the property specified
4751 // <nick>: nick name for the property specified
4752 // <blurb>: description of the property specified
4753 // <type>: a #GVariantType
4754 // <default_value>: a #GVariant of type @type to use as the default value, or %NULL
4755 // <flags>: flags for the property specified
4756 static ParamSpec* param_spec_variant(char* name, char* nick, char* blurb, GLib2.VariantType* type, GLib2.Variant* default_value, ParamFlags flags) {
4757 return g_param_spec_variant(name, nick, blurb, type, default_value, flags);
4761 // Registers @name as the name of a new static type derived from
4762 // #G_TYPE_PARAM. The type system uses the information contained in
4763 // the #GParamSpecTypeInfo structure pointed to by @info to manage the
4764 // #GParamSpec type and its instances.
4765 // RETURNS: The new type identifier.
4766 // <name>: 0-terminated string used as the name of the new #GParamSpec type.
4767 // <pspec_info>: The #GParamSpecTypeInfo for this #GParamSpec type.
4768 static Type param_type_register_static(char* name, ParamSpecTypeInfo* pspec_info) {
4769 return g_param_type_register_static(name, pspec_info);
4773 // Transforms @src_value into @dest_value if possible, and then
4774 // validates @dest_value, in order for it to conform to @pspec. If
4775 // @strict_validation is %TRUE this function will only succeed if the
4776 // transformed @dest_value complied to @pspec without modifications.
4778 // See also g_value_type_transformable(), g_value_transform() and
4779 // g_param_value_validate().
4781 // %FALSE otherwise and @dest_value is left untouched.
4782 // RETURNS: %TRUE if transformation and validation were successful,
4783 // <pspec>: a valid #GParamSpec
4784 // <src_value>: souce #GValue
4785 // <dest_value>: destination #GValue of correct type for @pspec
4786 // <strict_validation>: %TRUE requires @dest_value to conform to @pspec without modifications
4787 static int param_value_convert(ParamSpec* pspec, Value* src_value, Value* dest_value, int strict_validation) {
4788 return g_param_value_convert(pspec, src_value, dest_value, strict_validation);
4792 // Checks whether @value contains the default value as specified in @pspec.
4793 // RETURNS: whether @value contains the canonical default for this @pspec
4794 // <pspec>: a valid #GParamSpec
4795 // <value>: a #GValue of correct type for @pspec
4796 static int param_value_defaults(ParamSpec* pspec, Value* value) {
4797 return g_param_value_defaults(pspec, value);
4801 // Sets @value to its default value as specified in @pspec.
4802 // <pspec>: a valid #GParamSpec
4803 // <value>: a #GValue of correct type for @pspec
4804 static void param_value_set_default(ParamSpec* pspec, Value* value) {
4805 g_param_value_set_default(pspec, value);
4809 // Ensures that the contents of @value comply with the specifications
4810 // set out by @pspec. For example, a #GParamSpecInt might require
4811 // that integers stored in @value may not be smaller than -42 and not be
4812 // greater than +42. If @value contains an integer outside of this range,
4813 // it is modified accordingly, so the resulting value will fit into the
4814 // range -42 .. +42.
4815 // RETURNS: whether modifying @value was necessary to ensure validity
4816 // <pspec>: a valid #GParamSpec
4817 // <value>: a #GValue of correct type for @pspec
4818 static int param_value_validate(ParamSpec* pspec, Value* value) {
4819 return g_param_value_validate(pspec, value);
4823 // Compares @value1 with @value2 according to @pspec, and return -1, 0 or +1,
4824 // if @value1 is found to be less than, equal to or greater than @value2,
4825 // respectively.
4826 // RETURNS: -1, 0 or +1, for a less than, equal to or greater than result
4827 // <pspec>: a valid #GParamSpec
4828 // <value1>: a #GValue of correct type for @pspec
4829 // <value2>: a #GValue of correct type for @pspec
4830 static int param_values_cmp(ParamSpec* pspec, Value* value1, Value* value2) {
4831 return g_param_values_cmp(pspec, value1, value2);
4835 // Creates a new %G_TYPE_POINTER derived type id for a new
4836 // pointer type with name @name.
4837 // RETURNS: a new %G_TYPE_POINTER derived type id for @name.
4838 // <name>: the name of the new pointer type.
4839 static Type pointer_type_register_static(char* name) {
4840 return g_pointer_type_register_static(name);
4844 // A predefined #GSignalAccumulator for signals intended to be used as a
4845 // hook for application code to provide a particular value. Usually
4846 // only one such value is desired and multiple handlers for the same
4847 // signal don't make much sense (except for the case of the default
4848 // handler defined in the class structure, in which case you will
4849 // usually want the signal connection to override the class handler).
4851 // This accumulator will use the return value from the first signal
4852 // handler that is run as the return value for the signal and not run
4853 // any further handlers (ie: the first handler "wins").
4854 // RETURNS: standard #GSignalAccumulator result
4855 // <ihint>: standard #GSignalAccumulator parameter
4856 // <return_accu>: standard #GSignalAccumulator parameter
4857 // <handler_return>: standard #GSignalAccumulator parameter
4858 // <dummy>: standard #GSignalAccumulator parameter
4859 static int signal_accumulator_first_wins(SignalInvocationHint* ihint, Value* return_accu, Value* handler_return, void* dummy) {
4860 return g_signal_accumulator_first_wins(ihint, return_accu, handler_return, dummy);
4864 // A predefined #GSignalAccumulator for signals that return a
4865 // boolean values. The behavior that this accumulator gives is
4866 // that a return of %TRUE stops the signal emission: no further
4867 // callbacks will be invoked, while a return of %FALSE allows
4868 // the emission to continue. The idea here is that a %TRUE return
4869 // indicates that the callback <emphasis>handled</emphasis> the signal,
4870 // and no further handling is needed.
4871 // RETURNS: standard #GSignalAccumulator result
4872 // <ihint>: standard #GSignalAccumulator parameter
4873 // <return_accu>: standard #GSignalAccumulator parameter
4874 // <handler_return>: standard #GSignalAccumulator parameter
4875 // <dummy>: standard #GSignalAccumulator parameter
4876 static int signal_accumulator_true_handled(SignalInvocationHint* ihint, Value* return_accu, Value* handler_return, void* dummy) {
4877 return g_signal_accumulator_true_handled(ihint, return_accu, handler_return, dummy);
4881 // Adds an emission hook for a signal, which will get called for any emission
4882 // of that signal, independent of the instance. This is possible only
4883 // for signals which don't have #G_SIGNAL_NO_HOOKS flag set.
4884 // RETURNS: the hook id, for later use with g_signal_remove_emission_hook().
4885 // <signal_id>: the signal identifier, as returned by g_signal_lookup().
4886 // <detail>: the detail on which to call the hook.
4887 // <hook_func>: a #GSignalEmissionHook function.
4888 // <hook_data>: user data for @hook_func.
4889 // <data_destroy>: a #GDestroyNotify for @hook_data.
4890 static c_ulong signal_add_emission_hook(uint signal_id, GLib2.Quark detail, SignalEmissionHook hook_func, void* hook_data, GLib2.DestroyNotify data_destroy) {
4891 return g_signal_add_emission_hook(signal_id, detail, hook_func, hook_data, data_destroy);
4895 // Calls the original class closure of a signal. This function should only
4896 // be called from an overridden class closure; see
4897 // g_signal_override_class_closure() and
4898 // g_signal_override_class_handler().
4899 // <instance_and_params>: (array) the argument list of the signal emission. The first element in the array is a #GValue for the instance the signal is being emitted on. The rest are any arguments to be passed to the signal.
4900 // <return_value>: Location for the return value.
4901 static void signal_chain_from_overridden(Value* instance_and_params, Value* return_value) {
4902 g_signal_chain_from_overridden(instance_and_params, return_value);
4906 // Unintrospectable function: signal_chain_from_overridden_handler() / g_signal_chain_from_overridden_handler()
4907 // Calls the original class closure of a signal. This function should
4908 // only be called from an overridden class closure; see
4909 // g_signal_override_class_closure() and
4910 // g_signal_override_class_handler().
4911 // <instance>: the instance the signal is being emitted on.
4912 alias g_signal_chain_from_overridden_handler signal_chain_from_overridden_handler; // Variadic
4915 // Connects a closure to a signal for a particular object.
4916 // RETURNS: the handler id
4917 // <instance>: the instance to connect to.
4918 // <detailed_signal>: a string of the form "signal-name::detail".
4919 // <closure>: the closure to connect.
4920 // <after>: whether the handler should be called before or after the default handler of the signal.
4921 static c_ulong signal_connect_closure(void* instance, char* detailed_signal, Closure* closure, int after) {
4922 return g_signal_connect_closure(instance, detailed_signal, closure, after);
4926 // Connects a closure to a signal for a particular object.
4927 // RETURNS: the handler id
4928 // <instance>: the instance to connect to.
4929 // <signal_id>: the id of the signal.
4930 // <detail>: the detail.
4931 // <closure>: the closure to connect.
4932 // <after>: whether the handler should be called before or after the default handler of the signal.
4933 static c_ulong signal_connect_closure_by_id(void* instance, uint signal_id, GLib2.Quark detail, Closure* closure, int after) {
4934 return g_signal_connect_closure_by_id(instance, signal_id, detail, closure, after);
4938 // Unintrospectable function: signal_connect_data() / g_signal_connect_data()
4939 // Connects a #GCallback function to a signal for a particular object. Similar
4940 // to g_signal_connect(), but allows to provide a #GClosureNotify for the data
4941 // which will be called when the signal handler is disconnected and no longer
4942 // used. Specify @connect_flags if you need <literal>..._after()</literal> or
4943 // <literal>..._swapped()</literal> variants of this function.
4944 // RETURNS: the handler id
4945 // <instance>: the instance to connect to.
4946 // <detailed_signal>: a string of the form "signal-name::detail".
4947 // <c_handler>: the #GCallback to connect.
4948 // <data>: data to pass to @c_handler calls.
4949 // <destroy_data>: a #GClosureNotify for @data.
4950 // <connect_flags>: a combination of #GConnectFlags.
4951 static c_ulong signal_connect_data(void* instance, char* detailed_signal, Callback c_handler, void* data, ClosureNotify destroy_data, ConnectFlags connect_flags) {
4952 return g_signal_connect_data(instance, detailed_signal, c_handler, data, destroy_data, connect_flags);
4956 // Unintrospectable function: signal_connect_object() / g_signal_connect_object()
4957 // This is similar to g_signal_connect_data(), but uses a closure which
4958 // ensures that the @gobject stays alive during the call to @c_handler
4959 // by temporarily adding a reference count to @gobject.
4961 // Note that there is a bug in GObject that makes this function
4962 // much less useful than it might seem otherwise. Once @gobject is
4963 // disposed, the callback will no longer be called, but, the signal
4964 // handler is <emphasis>not</emphasis> currently disconnected. If the
4965 // @instance is itself being freed at the same time than this doesn't
4966 // matter, since the signal will automatically be removed, but
4967 // if @instance persists, then the signal handler will leak. You
4968 // should not remove the signal yourself because in a future versions of
4969 // GObject, the handler <emphasis>will</emphasis> automatically
4970 // be disconnected.
4972 // It's possible to work around this problem in a way that will
4973 // continue to work with future versions of GObject by checking
4974 // that the signal handler is still connected before disconnected it:
4975 // <informalexample><programlisting>
4976 // if (g_signal_handler_is_connected (instance, id))
4977 // g_signal_handler_disconnect (instance, id);
4978 // </programlisting></informalexample>
4979 // RETURNS: the handler id.
4980 // <instance>: the instance to connect to.
4981 // <detailed_signal>: a string of the form "signal-name::detail".
4982 // <c_handler>: the #GCallback to connect.
4983 // <gobject>: the object to pass as data to @c_handler.
4984 // <connect_flags>: a combination of #GConnnectFlags.
4985 static c_ulong signal_connect_object(void* instance, char* detailed_signal, Callback c_handler, void* gobject, ConnectFlags connect_flags) {
4986 return g_signal_connect_object(instance, detailed_signal, c_handler, gobject, connect_flags);
4990 // Unintrospectable function: signal_emit() / g_signal_emit()
4991 // Emits a signal.
4993 // Note that g_signal_emit() resets the return value to the default
4994 // if no handlers are connected, in contrast to g_signal_emitv().
4995 // <instance>: the instance the signal is being emitted on.
4996 // <signal_id>: the signal id
4997 // <detail>: the detail
4998 alias g_signal_emit signal_emit; // Variadic
5001 // Unintrospectable function: signal_emit_by_name() / g_signal_emit_by_name()
5002 // Emits a signal.
5004 // Note that g_signal_emit_by_name() resets the return value to the default
5005 // if no handlers are connected, in contrast to g_signal_emitv().
5006 // <instance>: the instance the signal is being emitted on.
5007 // <detailed_signal>: a string of the form "signal-name::detail".
5008 alias g_signal_emit_by_name signal_emit_by_name; // Variadic
5011 // Unintrospectable function: signal_emit_valist() / g_signal_emit_valist()
5012 // Emits a signal.
5014 // Note that g_signal_emit_valist() resets the return value to the default
5015 // if no handlers are connected, in contrast to g_signal_emitv().
5016 // <instance>: the instance the signal is being emitted on.
5017 // <signal_id>: the signal id
5018 // <detail>: the detail
5019 // <var_args>: a list of parameters to be passed to the signal, followed by a location for the return value. If the return type of the signal is #G_TYPE_NONE, the return value location can be omitted.
5020 static void signal_emit_valist(void* instance, uint signal_id, GLib2.Quark detail, va_list var_args) {
5021 g_signal_emit_valist(instance, signal_id, detail, var_args);
5025 // Emits a signal.
5027 // Note that g_signal_emitv() doesn't change @return_value if no handlers are
5028 // connected, in contrast to g_signal_emit() and g_signal_emit_valist().
5029 // <instance_and_params>: argument list for the signal emission. The first element in the array is a #GValue for the instance the signal is being emitted on. The rest are any arguments to be passed to the signal.
5030 // <signal_id>: the signal id
5031 // <detail>: the detail
5032 // <return_value>: Location to store the return value of the signal emission.
5033 static void signal_emitv(Value* instance_and_params, uint signal_id, GLib2.Quark detail, Value* return_value) {
5034 g_signal_emitv(instance_and_params, signal_id, detail, return_value);
5038 // Returns the invocation hint of the innermost signal emission of instance.
5039 // RETURNS: the invocation hint of the innermost signal emission.
5040 // <instance>: the instance to query
5041 static SignalInvocationHint* signal_get_invocation_hint(void* instance) {
5042 return g_signal_get_invocation_hint(instance);
5046 // Blocks a handler of an instance so it will not be called during any
5047 // signal emissions unless it is unblocked again. Thus "blocking" a
5048 // signal handler means to temporarily deactive it, a signal handler
5049 // has to be unblocked exactly the same amount of times it has been
5050 // blocked before to become active again.
5052 // The @handler_id has to be a valid signal handler id, connected to a
5053 // signal of @instance.
5054 // <instance>: The instance to block the signal handler of.
5055 // <handler_id>: Handler id of the handler to be blocked.
5056 static void signal_handler_block(void* instance, c_ulong handler_id) {
5057 g_signal_handler_block(instance, handler_id);
5061 // Disconnects a handler from an instance so it will not be called during
5062 // any future or currently ongoing emissions of the signal it has been
5063 // connected to. The @handler_id becomes invalid and may be reused.
5065 // The @handler_id has to be a valid signal handler id, connected to a
5066 // signal of @instance.
5067 // <instance>: The instance to remove the signal handler from.
5068 // <handler_id>: Handler id of the handler to be disconnected.
5069 static void signal_handler_disconnect(void* instance, c_ulong handler_id) {
5070 g_signal_handler_disconnect(instance, handler_id);
5074 // Finds the first signal handler that matches certain selection criteria.
5075 // The criteria mask is passed as an OR-ed combination of #GSignalMatchType
5076 // flags, and the criteria values are passed as arguments.
5077 // The match @mask has to be non-0 for successful matches.
5078 // If no handler was found, 0 is returned.
5079 // RETURNS: A valid non-0 signal handler id for a successful match.
5080 // <instance>: The instance owning the signal handler to be found.
5081 // <mask>: Mask indicating which of @signal_id, @detail, @closure, @func and/or @data the handler has to match.
5082 // <signal_id>: Signal the handler has to be connected to.
5083 // <detail>: Signal detail the handler has to be connected to.
5084 // <closure>: The closure the handler will invoke.
5085 // <func>: The C closure callback of the handler (useless for non-C closures).
5086 // <data>: The closure data of the handler's closure.
5087 static c_ulong signal_handler_find(void* instance, SignalMatchType mask, uint signal_id, GLib2.Quark detail, Closure* closure, void* func, void* data) {
5088 return g_signal_handler_find(instance, mask, signal_id, detail, closure, func, data);
5092 // Returns whether @handler_id is the id of a handler connected to @instance.
5093 // RETURNS: whether @handler_id identifies a handler connected to @instance.
5094 // <instance>: The instance where a signal handler is sought.
5095 // <handler_id>: the handler id.
5096 static int signal_handler_is_connected(void* instance, c_ulong handler_id) {
5097 return g_signal_handler_is_connected(instance, handler_id);
5101 // Undoes the effect of a previous g_signal_handler_block() call. A
5102 // blocked handler is skipped during signal emissions and will not be
5103 // invoked, unblocking it (for exactly the amount of times it has been
5104 // blocked before) reverts its "blocked" state, so the handler will be
5105 // recognized by the signal system and is called upon future or
5106 // currently ongoing signal emissions (since the order in which
5107 // handlers are called during signal emissions is deterministic,
5108 // whether the unblocked handler in question is called as part of a
5109 // currently ongoing emission depends on how far that emission has
5110 // proceeded yet).
5112 // The @handler_id has to be a valid id of a signal handler that is
5113 // connected to a signal of @instance and is currently blocked.
5114 // <instance>: The instance to unblock the signal handler of.
5115 // <handler_id>: Handler id of the handler to be unblocked.
5116 static void signal_handler_unblock(void* instance, c_ulong handler_id) {
5117 g_signal_handler_unblock(instance, handler_id);
5121 // Blocks all handlers on an instance that match a certain selection criteria.
5122 // The criteria mask is passed as an OR-ed combination of #GSignalMatchType
5123 // flags, and the criteria values are passed as arguments.
5124 // Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
5125 // or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
5126 // If no handlers were found, 0 is returned, the number of blocked handlers
5127 // otherwise.
5128 // RETURNS: The number of handlers that matched.
5129 // <instance>: The instance to block handlers from.
5130 // <mask>: Mask indicating which of @signal_id, @detail, @closure, @func and/or @data the handlers have to match.
5131 // <signal_id>: Signal the handlers have to be connected to.
5132 // <detail>: Signal detail the handlers have to be connected to.
5133 // <closure>: The closure the handlers will invoke.
5134 // <func>: The C closure callback of the handlers (useless for non-C closures).
5135 // <data>: The closure data of the handlers' closures.
5136 static uint signal_handlers_block_matched(void* instance, SignalMatchType mask, uint signal_id, GLib2.Quark detail, Closure* closure, void* func, void* data) {
5137 return g_signal_handlers_block_matched(instance, mask, signal_id, detail, closure, func, data);
5140 static void signal_handlers_destroy(void* instance) {
5141 g_signal_handlers_destroy(instance);
5145 // Disconnects all handlers on an instance that match a certain
5146 // selection criteria. The criteria mask is passed as an OR-ed
5147 // combination of #GSignalMatchType flags, and the criteria values are
5148 // passed as arguments. Passing at least one of the
5149 // %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC or
5150 // %G_SIGNAL_MATCH_DATA match flags is required for successful
5151 // matches. If no handlers were found, 0 is returned, the number of
5152 // disconnected handlers otherwise.
5153 // RETURNS: The number of handlers that matched.
5154 // <instance>: The instance to remove handlers from.
5155 // <mask>: Mask indicating which of @signal_id, @detail, @closure, @func and/or @data the handlers have to match.
5156 // <signal_id>: Signal the handlers have to be connected to.
5157 // <detail>: Signal detail the handlers have to be connected to.
5158 // <closure>: The closure the handlers will invoke.
5159 // <func>: The C closure callback of the handlers (useless for non-C closures).
5160 // <data>: The closure data of the handlers' closures.
5161 static uint signal_handlers_disconnect_matched(void* instance, SignalMatchType mask, uint signal_id, GLib2.Quark detail, Closure* closure, void* func, void* data) {
5162 return g_signal_handlers_disconnect_matched(instance, mask, signal_id, detail, closure, func, data);
5166 // Unblocks all handlers on an instance that match a certain selection
5167 // criteria. The criteria mask is passed as an OR-ed combination of
5168 // #GSignalMatchType flags, and the criteria values are passed as arguments.
5169 // Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
5170 // or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
5171 // If no handlers were found, 0 is returned, the number of unblocked handlers
5172 // otherwise. The match criteria should not apply to any handlers that are
5173 // not currently blocked.
5174 // RETURNS: The number of handlers that matched.
5175 // <instance>: The instance to unblock handlers from.
5176 // <mask>: Mask indicating which of @signal_id, @detail, @closure, @func and/or @data the handlers have to match.
5177 // <signal_id>: Signal the handlers have to be connected to.
5178 // <detail>: Signal detail the handlers have to be connected to.
5179 // <closure>: The closure the handlers will invoke.
5180 // <func>: The C closure callback of the handlers (useless for non-C closures).
5181 // <data>: The closure data of the handlers' closures.
5182 static uint signal_handlers_unblock_matched(void* instance, SignalMatchType mask, uint signal_id, GLib2.Quark detail, Closure* closure, void* func, void* data) {
5183 return g_signal_handlers_unblock_matched(instance, mask, signal_id, detail, closure, func, data);
5187 // Returns whether there are any handlers connected to @instance for the
5188 // given signal id and detail.
5190 // One example of when you might use this is when the arguments to the
5191 // signal are difficult to compute. A class implementor may opt to not
5192 // emit the signal if no one is attached anyway, thus saving the cost
5193 // of building the arguments.
5195 // otherwise.
5196 // RETURNS: %TRUE if a handler is connected to the signal, %FALSE
5197 // <instance>: the object whose signal handlers are sought.
5198 // <signal_id>: the signal id.
5199 // <detail>: the detail.
5200 // <may_be_blocked>: whether blocked handlers should count as match.
5201 static int signal_has_handler_pending(void* instance, uint signal_id, GLib2.Quark detail, int may_be_blocked) {
5202 return g_signal_has_handler_pending(instance, signal_id, detail, may_be_blocked);
5206 // Lists the signals by id that a certain instance or interface type
5207 // created. Further information about the signals can be acquired through
5208 // g_signal_query().
5209 // RETURNS: Newly allocated array of signal IDs.
5210 // <itype>: Instance or interface type.
5211 // <n_ids>: Location to store the number of signal ids for @itype.
5212 static uint* signal_list_ids(Type itype, /*out*/ uint* n_ids) {
5213 return g_signal_list_ids(itype, n_ids);
5217 // Given the name of the signal and the type of object it connects to, gets
5218 // the signal's identifying integer. Emitting the signal by number is
5219 // somewhat faster than using the name each time.
5221 // Also tries the ancestors of the given type.
5223 // See g_signal_new() for details on allowed signal names.
5224 // RETURNS: the signal's identifying number, or 0 if no signal was found.
5225 // <name>: the signal's name.
5226 // <itype>: the type that the signal operates on.
5227 static uint signal_lookup(char* name, Type itype) {
5228 return g_signal_lookup(name, itype);
5232 // Given the signal's identifier, finds its name.
5234 // Two different signals may have the same name, if they have differing types.
5235 // RETURNS: the signal name, or %NULL if the signal number was invalid.
5236 // <signal_id>: the signal's identifying number.
5237 static char* signal_name(uint signal_id) {
5238 return g_signal_name(signal_id);
5242 // Unintrospectable function: signal_new() / g_signal_new()
5243 // Creates a new signal. (This is usually done in the class initializer.)
5245 // A signal name consists of segments consisting of ASCII letters and
5246 // digits, separated by either the '-' or '_' character. The first
5247 // character of a signal name must be a letter. Names which violate these
5248 // rules lead to undefined behaviour of the GSignal system.
5250 // When registering a signal and looking up a signal, either separator can
5251 // be used, but they cannot be mixed.
5253 // If 0 is used for @class_offset subclasses cannot override the class handler
5254 // in their <code>class_init</code> method by doing
5255 // <code>super_class->signal_handler = my_signal_handler</code>. Instead they
5256 // will have to use g_signal_override_class_handler().
5258 // If c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as
5259 // the marshaller for this signal.
5260 // RETURNS: the signal id
5261 // <signal_name>: the name for the signal
5262 // <itype>: the type this signal pertains to. It will also pertain to types which are derived from this type.
5263 // <signal_flags>: a combination of #GSignalFlags specifying detail of when the default handler is to be invoked. You should at least specify %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
5264 // <class_offset>: The offset of the function pointer in the class structure for this type. Used to invoke a class method generically. Pass 0 to not associate a class method slot with this signal.
5265 // <accumulator>: the accumulator for this signal; may be %NULL.
5266 // <accu_data>: user data for the @accumulator.
5267 // <c_marshaller>: the function to translate arrays of parameter values to signal emissions into C language callback invocations or %NULL.
5268 // <return_type>: the type of return value, or #G_TYPE_NONE for a signal without a return value.
5269 // <n_params>: the number of parameter types to follow.
5270 alias g_signal_new signal_new; // Variadic
5273 // Unintrospectable function: signal_new_class_handler() / g_signal_new_class_handler()
5274 // Creates a new signal. (This is usually done in the class initializer.)
5276 // This is a variant of g_signal_new() that takes a C callback instead
5277 // off a class offset for the signal's class handler. This function
5278 // doesn't need a function pointer exposed in the class structure of
5279 // an object definition, instead the function pointer is passed
5280 // directly and can be overriden by derived classes with
5281 // g_signal_override_class_closure() or
5282 // g_signal_override_class_handler()and chained to with
5283 // g_signal_chain_from_overridden() or
5284 // g_signal_chain_from_overridden_handler().
5286 // See g_signal_new() for information about signal names.
5288 // If c_marshaller is %NULL @g_cclosure_marshal_generic will be used as
5289 // the marshaller for this signal.
5290 // RETURNS: the signal id
5291 // <signal_name>: the name for the signal
5292 // <itype>: the type this signal pertains to. It will also pertain to types which are derived from this type.
5293 // <signal_flags>: a combination of #GSignalFlags specifying detail of when the default handler is to be invoked. You should at least specify %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
5294 // <class_handler>: a #GCallback which acts as class implementation of this signal. Used to invoke a class method generically. Pass %NULL to not associate a class method with this signal.
5295 // <accumulator>: the accumulator for this signal; may be %NULL.
5296 // <accu_data>: user data for the @accumulator.
5297 // <c_marshaller>: the function to translate arrays of parameter values to signal emissions into C language callback invocations or %NULL.
5298 // <return_type>: the type of return value, or #G_TYPE_NONE for a signal without a return value.
5299 // <n_params>: the number of parameter types to follow.
5300 alias g_signal_new_class_handler signal_new_class_handler; // Variadic
5303 // Unintrospectable function: signal_new_valist() / g_signal_new_valist()
5304 // Creates a new signal. (This is usually done in the class initializer.)
5306 // See g_signal_new() for details on allowed signal names.
5308 // If c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as
5309 // the marshaller for this signal.
5310 // RETURNS: the signal id
5311 // <signal_name>: the name for the signal
5312 // <itype>: the type this signal pertains to. It will also pertain to types which are derived from this type.
5313 // <signal_flags>: a combination of #GSignalFlags specifying detail of when the default handler is to be invoked. You should at least specify %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
5314 // <class_closure>: The closure to invoke on signal emission; may be %NULL.
5315 // <accumulator>: the accumulator for this signal; may be %NULL.
5316 // <accu_data>: user data for the @accumulator.
5317 // <c_marshaller>: the function to translate arrays of parameter values to signal emissions into C language callback invocations or %NULL.
5318 // <return_type>: the type of return value, or #G_TYPE_NONE for a signal without a return value.
5319 // <n_params>: the number of parameter types in @args.
5320 // <args>: va_list of #GType, one for each parameter.
5321 static uint signal_new_valist(char* signal_name, Type itype, SignalFlags signal_flags, Closure* class_closure, SignalAccumulator accumulator, void* accu_data, SignalCMarshaller c_marshaller, Type return_type, uint n_params, va_list args) {
5322 return g_signal_new_valist(signal_name, itype, signal_flags, class_closure, accumulator, accu_data, c_marshaller, return_type, n_params, args);
5326 // Unintrospectable function: signal_newv() / g_signal_newv()
5327 // Creates a new signal. (This is usually done in the class initializer.)
5329 // See g_signal_new() for details on allowed signal names.
5331 // If c_marshaller is %NULL @g_cclosure_marshal_generic will be used as
5332 // the marshaller for this signal.
5333 // RETURNS: the signal id
5334 // <signal_name>: the name for the signal
5335 // <itype>: the type this signal pertains to. It will also pertain to types which are derived from this type
5336 // <signal_flags>: a combination of #GSignalFlags specifying detail of when the default handler is to be invoked. You should at least specify %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST
5337 // <class_closure>: The closure to invoke on signal emission; may be %NULL
5338 // <accumulator>: the accumulator for this signal; may be %NULL
5339 // <accu_data>: user data for the @accumulator
5340 // <c_marshaller>: the function to translate arrays of parameter values to signal emissions into C language callback invocations or %NULL
5341 // <return_type>: the type of return value, or #G_TYPE_NONE for a signal without a return value
5342 // <n_params>: the length of @param_types
5343 // <param_types>: an array of types, one for each parameter
5344 static uint signal_newv(char* signal_name, Type itype, SignalFlags signal_flags, Closure* class_closure, SignalAccumulator accumulator, void* accu_data, SignalCMarshaller c_marshaller, Type return_type, uint n_params, Type* param_types) {
5345 return g_signal_newv(signal_name, itype, signal_flags, class_closure, accumulator, accu_data, c_marshaller, return_type, n_params, param_types);
5349 // Overrides the class closure (i.e. the default handler) for the given signal
5350 // for emissions on instances of @instance_type. @instance_type must be derived
5351 // from the type to which the signal belongs.
5353 // See g_signal_chain_from_overridden() and
5354 // g_signal_chain_from_overridden_handler() for how to chain up to the
5355 // parent class closure from inside the overridden one.
5356 // <signal_id>: the signal id
5357 // <instance_type>: the instance type on which to override the class closure for the signal.
5358 // <class_closure>: the closure.
5359 static void signal_override_class_closure(uint signal_id, Type instance_type, Closure* class_closure) {
5360 g_signal_override_class_closure(signal_id, instance_type, class_closure);
5364 // Unintrospectable function: signal_override_class_handler() / g_signal_override_class_handler()
5365 // Overrides the class closure (i.e. the default handler) for the
5366 // given signal for emissions on instances of @instance_type with
5367 // callabck @class_handler. @instance_type must be derived from the
5368 // type to which the signal belongs.
5370 // See g_signal_chain_from_overridden() and
5371 // g_signal_chain_from_overridden_handler() for how to chain up to the
5372 // parent class closure from inside the overridden one.
5373 // <signal_name>: the name for the signal
5374 // <instance_type>: the instance type on which to override the class handler for the signal.
5375 // <class_handler>: the handler.
5376 static void signal_override_class_handler(char* signal_name, Type instance_type, Callback class_handler) {
5377 g_signal_override_class_handler(signal_name, instance_type, class_handler);
5381 // Internal function to parse a signal name into its @signal_id
5382 // and @detail quark.
5383 // RETURNS: Whether the signal name could successfully be parsed and @signal_id_p and @detail_p contain valid return values.
5384 // <detailed_signal>: a string of the form "signal-name::detail".
5385 // <itype>: The interface/instance type that introduced "signal-name".
5386 // <signal_id_p>: Location to store the signal id.
5387 // <detail_p>: Location to store the detail quark.
5388 // <force_detail_quark>: %TRUE forces creation of a #GQuark for the detail.
5389 static int signal_parse_name(char* detailed_signal, Type itype, /*out*/ uint* signal_id_p, /*out*/ GLib2.Quark* detail_p, int force_detail_quark) {
5390 return g_signal_parse_name(detailed_signal, itype, signal_id_p, detail_p, force_detail_quark);
5394 // Queries the signal system for in-depth information about a
5395 // specific signal. This function will fill in a user-provided
5396 // structure to hold signal-specific information. If an invalid
5397 // signal id is passed in, the @signal_id member of the #GSignalQuery
5398 // is 0. All members filled into the #GSignalQuery structure should
5399 // be considered constant and have to be left untouched.
5400 // <signal_id>: The signal id of the signal to query information for.
5401 // <query>: A user provided structure that is filled in with constant values upon success.
5402 static void signal_query(uint signal_id, /*out*/ SignalQuery* query) {
5403 g_signal_query(signal_id, query);
5407 // Deletes an emission hook.
5408 // <signal_id>: the id of the signal
5409 // <hook_id>: the id of the emission hook, as returned by g_signal_add_emission_hook()
5410 static void signal_remove_emission_hook(uint signal_id, c_ulong hook_id) {
5411 g_signal_remove_emission_hook(signal_id, hook_id);
5415 // Stops a signal's current emission.
5417 // This will prevent the default method from running, if the signal was
5418 // %G_SIGNAL_RUN_LAST and you connected normally (i.e. without the "after"
5419 // flag).
5421 // Prints a warning if used on a signal which isn't being emitted.
5422 // <instance>: the object whose signal handlers you wish to stop.
5423 // <signal_id>: the signal identifier, as returned by g_signal_lookup().
5424 // <detail>: the detail which the signal was emitted with.
5425 static void signal_stop_emission(void* instance, uint signal_id, GLib2.Quark detail) {
5426 g_signal_stop_emission(instance, signal_id, detail);
5430 // Stops a signal's current emission.
5432 // This is just like g_signal_stop_emission() except it will look up the
5433 // signal id for you.
5434 // <instance>: the object whose signal handlers you wish to stop.
5435 // <detailed_signal>: a string of the form "signal-name::detail".
5436 static void signal_stop_emission_by_name(void* instance, char* detailed_signal) {
5437 g_signal_stop_emission_by_name(instance, detailed_signal);
5441 // Creates a new closure which invokes the function found at the offset
5442 // @struct_offset in the class structure of the interface or classed type
5443 // identified by @itype.
5444 // RETURNS: a new #GCClosure
5445 // <itype>: the #GType identifier of an interface or classed type
5446 // <struct_offset>: the offset of the member function of @itype's class structure which is to be invoked by the new closure
5447 static Closure* /*new*/ signal_type_cclosure_new(Type itype, uint struct_offset) {
5448 return g_signal_type_cclosure_new(itype, struct_offset);
5452 // Set the callback for a source as a #GClosure.
5454 // If the source is not one of the standard GLib types, the @closure_callback
5455 // and @closure_marshal fields of the #GSourceFuncs structure must have been
5456 // filled in with pointers to appropriate functions.
5457 // <source>: the source
5458 // <closure>: a #GClosure
5459 static void source_set_closure(GLib2.Source* source, Closure* closure) {
5460 g_source_set_closure(source, closure);
5464 // Sets a dummy callback for @source. The callback will do nothing, and
5465 // if the source expects a #gboolean return value, it will return %TRUE.
5466 // (If the source expects any other type of return value, it will return
5467 // a 0/%NULL value; whatever g_value_init() initializes a #GValue to for
5468 // that type.)
5470 // If the source is not one of the standard GLib types, the
5471 // @closure_callback and @closure_marshal fields of the #GSourceFuncs
5472 // structure must have been filled in with pointers to appropriate
5473 // functions.
5474 // <source>: the source
5475 static void source_set_dummy_callback(GLib2.Source* source) {
5476 g_source_set_dummy_callback(source);
5480 // Return a newly allocated string, which describes the contents of a
5481 // #GValue. The main purpose of this function is to describe #GValue
5482 // contents for debugging output, the way in which the contents are
5483 // described may change between different GLib versions.
5484 // RETURNS: Newly allocated string.
5485 // <value>: #GValue which contents are to be described.
5486 static char* /*new*/ strdup_value_contents(Value* value) {
5487 return g_strdup_value_contents(value);
5491 // Unintrospectable function: type_add_class_cache_func() / g_type_add_class_cache_func()
5492 // Adds a #GTypeClassCacheFunc to be called before the reference count of a
5493 // class goes from one to zero. This can be used to prevent premature class
5494 // destruction. All installed #GTypeClassCacheFunc functions will be chained
5495 // until one of them returns %TRUE. The functions have to check the class id
5496 // passed in to figure whether they actually want to cache the class of this
5497 // type, since all classes are routed through the same #GTypeClassCacheFunc
5498 // chain.
5499 // <cache_data>: data to be passed to @cache_func
5500 // <cache_func>: a #GTypeClassCacheFunc
5501 static void type_add_class_cache_func(void* cache_data, TypeClassCacheFunc cache_func) {
5502 g_type_add_class_cache_func(cache_data, cache_func);
5506 // Registers a private class structure for a classed type;
5507 // when the class is allocated, the private structures for
5508 // the class and all of its parent types are allocated
5509 // sequentially in the same memory block as the public
5510 // structures. This function should be called in the
5511 // type's get_type() function after the type is registered.
5512 // The private structure can be retrieved using the
5513 // G_TYPE_CLASS_GET_PRIVATE() macro.
5514 // <class_type>: GType of an classed type.
5515 // <private_size>: size of private structure.
5516 static void type_add_class_private(Type class_type, size_t private_size) {
5517 g_type_add_class_private(class_type, private_size);
5521 // Unintrospectable function: type_add_interface_check() / g_type_add_interface_check()
5522 // Adds a function to be called after an interface vtable is
5523 // initialized for any class (i.e. after the @interface_init member of
5524 // #GInterfaceInfo has been called).
5526 // This function is useful when you want to check an invariant that
5527 // depends on the interfaces of a class. For instance, the
5528 // implementation of #GObject uses this facility to check that an
5529 // object implements all of the properties that are defined on its
5530 // interfaces.
5531 // <check_data>: data to pass to @check_func
5532 // <check_func>: function to be called after each interface is initialized.
5533 static void type_add_interface_check(void* check_data, TypeInterfaceCheckFunc check_func) {
5534 g_type_add_interface_check(check_data, check_func);
5538 // Adds the dynamic @interface_type to @instantiable_type. The information
5539 // contained in the #GTypePlugin structure pointed to by @plugin
5540 // is used to manage the relationship.
5541 // <instance_type>: the #GType value of an instantiable type.
5542 // <interface_type>: the #GType value of an interface type.
5543 // <plugin>: the #GTypePlugin structure to retrieve the #GInterfaceInfo from.
5544 static void type_add_interface_dynamic(Type instance_type, Type interface_type, TypePlugin* plugin) {
5545 g_type_add_interface_dynamic(instance_type, interface_type, plugin);
5549 // Adds the static @interface_type to @instantiable_type. The information
5550 // contained in the #GTypeInterfaceInfo structure pointed to by @info
5551 // is used to manage the relationship.
5552 // <instance_type>: #GType value of an instantiable type.
5553 // <interface_type>: #GType value of an interface type.
5554 // <info>: The #GInterfaceInfo structure for this (@instance_type, @interface_type) combination.
5555 static void type_add_interface_static(Type instance_type, Type interface_type, InterfaceInfo* info) {
5556 g_type_add_interface_static(instance_type, interface_type, info);
5559 // Unintrospectable function: type_check_class_cast() / g_type_check_class_cast()
5560 static TypeClass* type_check_class_cast(TypeClass* g_class, Type is_a_type) {
5561 return g_type_check_class_cast(g_class, is_a_type);
5564 static int type_check_class_is_a(TypeClass* g_class, Type is_a_type) {
5565 return g_type_check_class_is_a(g_class, is_a_type);
5569 // Private helper function to aid implementation of the G_TYPE_CHECK_INSTANCE()
5570 // macro.
5571 // <instance>: A valid #GTypeInstance structure.
5572 static int type_check_instance(TypeInstance* instance) {
5573 return g_type_check_instance(instance);
5576 // Unintrospectable function: type_check_instance_cast() / g_type_check_instance_cast()
5577 static TypeInstance* type_check_instance_cast(TypeInstance* instance, Type iface_type) {
5578 return g_type_check_instance_cast(instance, iface_type);
5581 static int type_check_instance_is_a(TypeInstance* instance, Type iface_type) {
5582 return g_type_check_instance_is_a(instance, iface_type);
5585 static int type_check_is_value_type(Type type) {
5586 return g_type_check_is_value_type(type);
5589 static int type_check_value(Value* value) {
5590 return g_type_check_value(value);
5593 static int type_check_value_holds(Value* value, Type type) {
5594 return g_type_check_value_holds(value, type);
5598 // Return a newly allocated and 0-terminated array of type IDs, listing the
5599 // child types of @type. The return value has to be g_free()ed after use.
5601 // and 0-terminated array of child types.
5602 // RETURNS: Newly allocated
5603 // <type>: The parent type.
5604 // <n_children>: Optional #guint pointer to contain the number of child types.
5605 static Type* /*new*/ type_children(Type type, /*out*/ uint* n_children=null) {
5606 return g_type_children(type, n_children);
5610 // Registers a private structure for an instantiatable type.
5612 // When an object is allocated, the private structures for
5613 // the type and all of its parent types are allocated
5614 // sequentially in the same memory block as the public
5615 // structures.
5617 // Note that the accumulated size of the private structures of
5618 // a type and all its parent types cannot excced 64kB.
5620 // This function should be called in the type's class_init() function.
5621 // The private structure can be retrieved using the
5622 // G_TYPE_INSTANCE_GET_PRIVATE() macro.
5624 // The following example shows attaching a private structure
5625 // <structname>MyObjectPrivate</structname> to an object
5626 // <structname>MyObject</structname> defined in the standard GObject
5627 // fashion.
5628 // type's class_init() function.
5630 // |[
5631 // typedef struct _MyObject MyObject;
5632 // typedef struct _MyObjectPrivate MyObjectPrivate;
5634 // struct _MyObject {
5635 // GObject parent;
5637 // MyObjectPrivate *priv;
5638 // };
5640 // struct _MyObjectPrivate {
5641 // int some_field;
5642 // };
5644 // static void
5645 // my_object_class_init (MyObjectClass *klass)
5646 // {
5647 // g_type_class_add_private (klass, sizeof (MyObjectPrivate));
5648 // }
5650 // static void
5651 // my_object_init (MyObject *my_object)
5652 // {
5653 // my_object->priv = G_TYPE_INSTANCE_GET_PRIVATE (my_object,
5654 // MY_TYPE_OBJECT,
5655 // MyObjectPrivate);
5656 // }
5658 // static int
5659 // my_object_get_some_field (MyObject *my_object)
5660 // {
5661 // MyObjectPrivate *priv = my_object->priv;
5663 // return priv->some_field;
5664 // }
5665 // ]|
5666 // <g_class>: class structure for an instantiatable type
5667 // <private_size>: size of private structure.
5668 static void type_class_add_private(void* g_class, size_t private_size) {
5669 g_type_class_add_private(g_class, private_size);
5673 // This function is essentially the same as g_type_class_ref(), except that
5674 // the classes reference count isn't incremented. As a consequence, this function
5675 // may return %NULL if the class of the type passed in does not currently
5676 // exist (hasn't been referenced before).
5678 // structure for the given type ID or %NULL if the class does not
5679 // currently exist.
5680 // RETURNS: The #GTypeClass
5681 // <type>: Type ID of a classed type.
5682 static TypeClass* type_class_peek(Type type) {
5683 return g_type_class_peek(type);
5687 // A more efficient version of g_type_class_peek() which works only for
5688 // static types.
5690 // structure for the given type ID or %NULL if the class does not
5691 // currently exist or is dynamically loaded.
5692 // RETURNS: The #GTypeClass
5693 // <type>: Type ID of a classed type.
5694 static TypeClass* type_class_peek_static(Type type) {
5695 return g_type_class_peek_static(type);
5699 // Increments the reference count of the class structure belonging to
5700 // @type. This function will demand-create the class if it doesn't
5701 // exist already.
5703 // structure for the given type ID.
5704 // RETURNS: The #GTypeClass
5705 // <type>: Type ID of a classed type.
5706 static TypeClass* type_class_ref(Type type) {
5707 return g_type_class_ref(type);
5711 // Unintrospectable function: type_create_instance() / g_type_create_instance()
5712 // Creates and initializes an instance of @type if @type is valid and
5713 // can be instantiated. The type system only performs basic allocation
5714 // and structure setups for instances: actual instance creation should
5715 // happen through functions supplied by the type's fundamental type
5716 // implementation. So use of g_type_create_instance() is reserved for
5717 // implementators of fundamental types only. E.g. instances of the
5718 // #GObject hierarchy should be created via g_object_new() and
5719 // <emphasis>never</emphasis> directly through
5720 // g_type_create_instance() which doesn't handle things like singleton
5721 // objects or object construction. Note: Do <emphasis>not</emphasis>
5722 // use this function, unless you're implementing a fundamental
5723 // type. Also language bindings should <emphasis>not</emphasis> use
5724 // this function but g_object_new() instead.
5726 // treatment by the fundamental type implementation.
5727 // RETURNS: An allocated and initialized instance, subject to further
5728 // <type>: An instantiatable type to create an instance for.
5729 static TypeInstance* type_create_instance(Type type) {
5730 return g_type_create_instance(type);
5734 // If the interface type @g_type is currently in use, returns its
5735 // default interface vtable.
5738 // vtable for the interface, or %NULL if the type is not currently in
5739 // use.
5740 // RETURNS: the default
5741 // <g_type>: an interface type
5742 static TypeInterface* type_default_interface_peek(Type g_type) {
5743 return g_type_default_interface_peek(g_type);
5747 // Increments the reference count for the interface type @g_type,
5748 // and returns the default interface vtable for the type.
5750 // If the type is not currently in use, then the default vtable
5751 // for the type will be created and initalized by calling
5752 // the base interface init and default vtable init functions for
5753 // the type (the @<structfield>base_init</structfield>
5754 // and <structfield>class_init</structfield> members of #GTypeInfo).
5755 // Calling g_type_default_interface_ref() is useful when you
5756 // want to make sure that signals and properties for an interface
5757 // have been installed.
5760 // vtable for the interface; call g_type_default_interface_unref()
5761 // when you are done using the interface.
5762 // RETURNS: the default
5763 // <g_type>: an interface type
5764 static TypeInterface* type_default_interface_ref(Type g_type) {
5765 return g_type_default_interface_ref(g_type);
5769 // Decrements the reference count for the type corresponding to the
5770 // interface default vtable @g_iface. If the type is dynamic, then
5771 // when no one is using the interface and all references have
5772 // been released, the finalize function for the interface's default
5773 // vtable (the <structfield>class_finalize</structfield> member of
5774 // #GTypeInfo) will be called.
5775 // <g_iface>: the default vtable structure for a interface, as returned by g_type_default_interface_ref()
5776 static void type_default_interface_unref(TypeInterface* g_iface) {
5777 g_type_default_interface_unref(g_iface);
5781 // Returns the length of the ancestry of the passed in type. This
5782 // includes the type itself, so that e.g. a fundamental type has depth 1.
5783 // RETURNS: The depth of @type.
5784 // <type>: A #GType value.
5785 static uint type_depth(Type type) {
5786 return g_type_depth(type);
5790 // Frees an instance of a type, returning it to the instance pool for
5791 // the type, if there is one.
5793 // Like g_type_create_instance(), this function is reserved for
5794 // implementors of fundamental types.
5795 // <instance>: an instance of a type.
5796 static void type_free_instance(TypeInstance* instance) {
5797 g_type_free_instance(instance);
5801 // Lookup the type ID from a given type name, returning 0 if no type
5802 // has been registered under this name (this is the preferred method
5803 // to find out by name whether a specific type has been registered
5804 // yet).
5805 // RETURNS: Corresponding type ID or 0.
5806 // <name>: Type name to lookup.
5807 static Type type_from_name(char* name) {
5808 return g_type_from_name(name);
5812 // Internal function, used to extract the fundamental type ID portion.
5813 // use G_TYPE_FUNDAMENTAL() instead.
5814 // RETURNS: fundamental type ID
5815 // <type_id>: valid type ID
5816 static Type type_fundamental(Type type_id) {
5817 return g_type_fundamental(type_id);
5821 // Returns the next free fundamental type id which can be used to
5822 // register a new fundamental type with g_type_register_fundamental().
5823 // The returned type ID represents the highest currently registered
5824 // fundamental type identifier.
5826 // or 0 if the type system ran out of fundamental type IDs.
5827 // RETURNS: The nextmost fundamental type ID to be registered,
5828 static Type type_fundamental_next() {
5829 return g_type_fundamental_next();
5833 // Returns the #GTypePlugin structure for @type or
5834 // %NULL if @type does not have a #GTypePlugin structure.
5836 // dynamic type, %NULL otherwise.
5837 // RETURNS: The corresponding plugin if @type is a
5838 // <type>: The #GType to retrieve the plugin for.
5839 static TypePlugin* type_get_plugin(Type type) {
5840 return g_type_get_plugin(type);
5844 // Obtains data which has previously been attached to @type
5845 // with g_type_set_qdata().
5847 // Note that this does not take subtyping into account; data
5848 // attached to one type with g_type_set_qdata() cannot
5849 // be retrieved from a subtype using g_type_get_qdata().
5850 // RETURNS: the data, or %NULL if no data was found
5851 // <type>: a #GType
5852 // <quark>: a #GQuark id to identify the data
5853 static void* type_get_qdata(Type type, GLib2.Quark quark) {
5854 return g_type_get_qdata(type, quark);
5858 // Prior to any use of the type system, g_type_init() has to be called
5859 // to initialize the type system and assorted other code portions
5860 // (such as the various fundamental type implementations or the signal
5861 // system).
5863 // Since version 2.24 this also initializes the thread system
5864 static void type_init() {
5865 g_type_init();
5869 // Similar to g_type_init(), but additionally sets debug flags.
5870 // <debug_flags>: Bitwise combination of #GTypeDebugFlags values for debugging purposes.
5871 static void type_init_with_debug_flags(TypeDebugFlags debug_flags) {
5872 g_type_init_with_debug_flags(debug_flags);
5876 // Adds @prerequisite_type to the list of prerequisites of @interface_type.
5877 // This means that any type implementing @interface_type must also implement
5878 // @prerequisite_type. Prerequisites can be thought of as an alternative to
5879 // interface derivation (which GType doesn't support). An interface can have
5880 // at most one instantiatable prerequisite type.
5881 // <interface_type>: #GType value of an interface type.
5882 // <prerequisite_type>: #GType value of an interface or instantiatable type.
5883 static void type_interface_add_prerequisite(Type interface_type, Type prerequisite_type) {
5884 g_type_interface_add_prerequisite(interface_type, prerequisite_type);
5888 // Returns the #GTypePlugin structure for the dynamic interface
5889 // @interface_type which has been added to @instance_type, or %NULL if
5890 // @interface_type has not been added to @instance_type or does not
5891 // have a #GTypePlugin structure. See g_type_add_interface_dynamic().
5893 // interface @interface_type of @instance_type.
5894 // RETURNS: the #GTypePlugin for the dynamic
5895 // <instance_type>: the #GType value of an instantiatable type.
5896 // <interface_type>: the #GType value of an interface type.
5897 static TypePlugin* type_interface_get_plugin(Type instance_type, Type interface_type) {
5898 return g_type_interface_get_plugin(instance_type, interface_type);
5902 // Returns the #GTypeInterface structure of an interface to which the
5903 // passed in class conforms.
5905 // structure of iface_type if implemented by @instance_class, %NULL
5906 // otherwise
5907 // RETURNS: The GTypeInterface
5908 // <instance_class>: A #GTypeClass structure.
5909 // <iface_type>: An interface ID which this class conforms to.
5910 static TypeInterface* type_interface_peek(TypeClass* instance_class, Type iface_type) {
5911 return g_type_interface_peek(instance_class, iface_type);
5915 // Returns the prerequisites of an interfaces type.
5918 // newly-allocated zero-terminated array of #GType containing
5919 // the prerequisites of @interface_type
5920 // RETURNS: a
5921 // <interface_type>: an interface type
5922 // <n_prerequisites>: location to return the number of prerequisites, or %NULL
5923 static Type* /*new*/ type_interface_prerequisites(Type interface_type, /*out*/ uint* n_prerequisites=null) {
5924 return g_type_interface_prerequisites(interface_type, n_prerequisites);
5928 // Return a newly allocated and 0-terminated array of type IDs, listing the
5929 // interface types that @type conforms to. The return value has to be
5930 // g_free()ed after use.
5932 // allocated and 0-terminated array of interface types.
5933 // RETURNS: Newly
5934 // <type>: The type to list interface types for.
5935 // <n_interfaces>: Optional #guint pointer to contain the number of interface types.
5936 static Type* /*new*/ type_interfaces(Type type, /*out*/ uint* n_interfaces=null) {
5937 return g_type_interfaces(type, n_interfaces);
5941 // If @is_a_type is a derivable type, check whether @type is a
5942 // descendant of @is_a_type. If @is_a_type is an interface, check
5943 // whether @type conforms to it.
5944 // RETURNS: %TRUE if @type is_a @is_a_type holds true.
5945 // <type>: Type to check anchestry for.
5946 // <is_a_type>: Possible anchestor of @type or interface @type could conform to.
5947 static int type_is_a(Type type, Type is_a_type) {
5948 return g_type_is_a(type, is_a_type);
5952 // Get the unique name that is assigned to a type ID. Note that this
5953 // function (like all other GType API) cannot cope with invalid type
5954 // IDs. %G_TYPE_INVALID may be passed to this function, as may be any
5955 // other validly registered type ID, but randomized type IDs should
5956 // not be passed in and will most likely lead to a crash.
5957 // RETURNS: Static type name or %NULL.
5958 // <type>: Type to return name for.
5959 static char* type_name(Type type) {
5960 return g_type_name(type);
5963 static char* type_name_from_class(TypeClass* g_class) {
5964 return g_type_name_from_class(g_class);
5967 static char* type_name_from_instance(TypeInstance* instance) {
5968 return g_type_name_from_instance(instance);
5972 // Given a @leaf_type and a @root_type which is contained in its
5973 // anchestry, return the type that @root_type is the immediate parent
5974 // of. In other words, this function determines the type that is
5975 // derived directly from @root_type which is also a base class of
5976 // @leaf_type. Given a root type and a leaf type, this function can
5977 // be used to determine the types and order in which the leaf type is
5978 // descended from the root type.
5979 // RETURNS: Immediate child of @root_type and anchestor of @leaf_type.
5980 // <leaf_type>: Descendant of @root_type and the type to be returned.
5981 // <root_type>: Immediate parent of the returned type.
5982 static Type type_next_base(Type leaf_type, Type root_type) {
5983 return g_type_next_base(leaf_type, root_type);
5987 // Return the direct parent type of the passed in type. If the passed
5988 // in type has no parent, i.e. is a fundamental type, 0 is returned.
5989 // RETURNS: The parent type.
5990 // <type>: The derived type.
5991 static Type type_parent(Type type) {
5992 return g_type_parent(type);
5996 // Get the corresponding quark of the type IDs name.
5997 // RETURNS: The type names quark or 0.
5998 // <type>: Type to return quark of type name for.
5999 static GLib2.Quark type_qname(Type type) {
6000 return g_type_qname(type);
6004 // Queries the type system for information about a specific type.
6005 // This function will fill in a user-provided structure to hold
6006 // type-specific information. If an invalid #GType is passed in, the
6007 // @type member of the #GTypeQuery is 0. All members filled into the
6008 // #GTypeQuery structure should be considered constant and have to be
6009 // left untouched.
6010 // <type>: the #GType value of a static, classed type.
6011 // <query>: A user provided structure that is filled in with constant values upon success.
6012 static void type_query(Type type, /*out*/ TypeQuery* query) {
6013 g_type_query(type, query);
6017 // Registers @type_name as the name of a new dynamic type derived from
6018 // @parent_type. The type system uses the information contained in the
6019 // #GTypePlugin structure pointed to by @plugin to manage the type and its
6020 // instances (if not abstract). The value of @flags determines the nature
6021 // (e.g. abstract or not) of the type.
6022 // RETURNS: The new type identifier or #G_TYPE_INVALID if registration failed.
6023 // <parent_type>: Type from which this type will be derived.
6024 // <type_name>: 0-terminated string used as the name of the new type.
6025 // <plugin>: The #GTypePlugin structure to retrieve the #GTypeInfo from.
6026 // <flags>: Bitwise combination of #GTypeFlags values.
6027 static Type type_register_dynamic(Type parent_type, char* type_name, TypePlugin* plugin, TypeFlags flags) {
6028 return g_type_register_dynamic(parent_type, type_name, plugin, flags);
6032 // Registers @type_id as the predefined identifier and @type_name as the
6033 // name of a fundamental type. The type system uses the information
6034 // contained in the #GTypeInfo structure pointed to by @info and the
6035 // #GTypeFundamentalInfo structure pointed to by @finfo to manage the
6036 // type and its instances. The value of @flags determines additional
6037 // characteristics of the fundamental type.
6038 // RETURNS: The predefined type identifier.
6039 // <type_id>: A predefined type identifier.
6040 // <type_name>: 0-terminated string used as the name of the new type.
6041 // <info>: The #GTypeInfo structure for this type.
6042 // <finfo>: The #GTypeFundamentalInfo structure for this type.
6043 // <flags>: Bitwise combination of #GTypeFlags values.
6044 static Type type_register_fundamental(Type type_id, char* type_name, TypeInfo* info, TypeFundamentalInfo* finfo, TypeFlags flags) {
6045 return g_type_register_fundamental(type_id, type_name, info, finfo, flags);
6049 // Registers @type_name as the name of a new static type derived from
6050 // @parent_type. The type system uses the information contained in the
6051 // #GTypeInfo structure pointed to by @info to manage the type and its
6052 // instances (if not abstract). The value of @flags determines the nature
6053 // (e.g. abstract or not) of the type.
6054 // RETURNS: The new type identifier.
6055 // <parent_type>: Type from which this type will be derived.
6056 // <type_name>: 0-terminated string used as the name of the new type.
6057 // <info>: The #GTypeInfo structure for this type.
6058 // <flags>: Bitwise combination of #GTypeFlags values.
6059 static Type type_register_static(Type parent_type, char* type_name, TypeInfo* info, TypeFlags flags) {
6060 return g_type_register_static(parent_type, type_name, info, flags);
6064 // Unintrospectable function: type_register_static_simple() / g_type_register_static_simple()
6065 // Registers @type_name as the name of a new static type derived from
6066 // @parent_type. The value of @flags determines the nature (e.g.
6067 // abstract or not) of the type. It works by filling a #GTypeInfo
6068 // struct and calling g_type_register_static().
6069 // RETURNS: The new type identifier.
6070 // <parent_type>: Type from which this type will be derived.
6071 // <type_name>: 0-terminated string used as the name of the new type.
6072 // <class_size>: Size of the class structure (see #GTypeInfo)
6073 // <class_init>: Location of the class initialization function (see #GTypeInfo)
6074 // <instance_size>: Size of the instance structure (see #GTypeInfo)
6075 // <instance_init>: Location of the instance initialization function (see #GTypeInfo)
6076 // <flags>: Bitwise combination of #GTypeFlags values.
6077 static Type type_register_static_simple(Type parent_type, char* type_name, uint class_size, ClassInitFunc class_init, uint instance_size, InstanceInitFunc instance_init, TypeFlags flags) {
6078 return g_type_register_static_simple(parent_type, type_name, class_size, class_init, instance_size, instance_init, flags);
6082 // Unintrospectable function: type_remove_class_cache_func() / g_type_remove_class_cache_func()
6083 // Removes a previously installed #GTypeClassCacheFunc. The cache
6084 // maintained by @cache_func has to be empty when calling
6085 // g_type_remove_class_cache_func() to avoid leaks.
6086 // <cache_data>: data that was given when adding @cache_func
6087 // <cache_func>: a #GTypeClassCacheFunc
6088 static void type_remove_class_cache_func(void* cache_data, TypeClassCacheFunc cache_func) {
6089 g_type_remove_class_cache_func(cache_data, cache_func);
6093 // Unintrospectable function: type_remove_interface_check() / g_type_remove_interface_check()
6094 // Removes an interface check function added with
6095 // g_type_add_interface_check().
6096 // <check_data>: callback data passed to g_type_add_interface_check()
6097 // <check_func>: callback function passed to g_type_add_interface_check()
6098 static void type_remove_interface_check(void* check_data, TypeInterfaceCheckFunc check_func) {
6099 g_type_remove_interface_check(check_data, check_func);
6103 // Attaches arbitrary data to a type.
6104 // <type>: a #GType
6105 // <quark>: a #GQuark id to identify the data
6106 // <data>: the data
6107 static void type_set_qdata(Type type, GLib2.Quark quark, void* data) {
6108 g_type_set_qdata(type, quark, data);
6111 static int type_test_flags(Type type, uint flags) {
6112 return g_type_test_flags(type, flags);
6116 // Unintrospectable function: type_value_table_peek() / g_type_value_table_peek()
6117 // Returns the location of the #GTypeValueTable associated with @type.
6118 // <emphasis>Note that this function should only be used from source code
6119 // that implements or has internal knowledge of the implementation of
6120 // @type.</emphasis>
6122 // %NULL if there is no #GTypeValueTable associated with @type.
6123 // RETURNS: Location of the #GTypeValueTable associated with @type or
6124 // <type>: A #GType value.
6125 static TypeValueTable* type_value_table_peek(Type type) {
6126 return g_type_value_table_peek(type);
6130 // Get the contents of a %G_TYPE_GTYPE #GValue.
6131 // RETURNS: the #GType stored in @value
6132 // <value>: a valid #GValue of type %G_TYPE_GTYPE
6133 static Type value_get_gtype(Value* value) {
6134 return g_value_get_gtype(value);
6138 // Unintrospectable function: value_register_transform_func() / g_value_register_transform_func()
6139 // Registers a value transformation function for use in g_value_transform().
6140 // A previously registered transformation function for @src_type and @dest_type
6141 // will be replaced.
6142 // <src_type>: Source type.
6143 // <dest_type>: Target type.
6144 // <transform_func>: a function which transforms values of type @src_type into value of type @dest_type
6145 static void value_register_transform_func(Type src_type, Type dest_type, ValueTransform transform_func) {
6146 g_value_register_transform_func(src_type, dest_type, transform_func);
6150 // Returns whether a #GValue of type @src_type can be copied into
6151 // a #GValue of type @dest_type.
6152 // RETURNS: %TRUE if g_value_copy() is possible with @src_type and @dest_type.
6153 // <src_type>: source type to be copied.
6154 // <dest_type>: destination type for copying.
6155 static int value_type_compatible(Type src_type, Type dest_type) {
6156 return g_value_type_compatible(src_type, dest_type);
6160 // Check whether g_value_transform() is able to transform values
6161 // of type @src_type into values of type @dest_type.
6162 // RETURNS: %TRUE if the transformation is possible, %FALSE otherwise.
6163 // <src_type>: Source type.
6164 // <dest_type>: Target type.
6165 static int value_type_transformable(Type src_type, Type dest_type) {
6166 return g_value_type_transformable(src_type, dest_type);
6170 // C prototypes:
6172 extern (C) {
6173 BindingFlags g_binding_get_flags(Binding* this_);
6174 Object* g_binding_get_source(Binding* this_);
6175 char* g_binding_get_source_property(Binding* this_);
6176 Object* g_binding_get_target(Binding* this_);
6177 char* g_binding_get_target_property(Binding* this_);
6178 void g_cclosure_marshal_BOOLEAN__BOXED_BOXED(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6179 void g_cclosure_marshal_BOOLEAN__FLAGS(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6180 void g_cclosure_marshal_STRING__OBJECT_POINTER(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6181 void g_cclosure_marshal_VOID__BOOLEAN(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6182 void g_cclosure_marshal_VOID__BOXED(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6183 void g_cclosure_marshal_VOID__CHAR(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6184 void g_cclosure_marshal_VOID__DOUBLE(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6185 void g_cclosure_marshal_VOID__ENUM(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6186 void g_cclosure_marshal_VOID__FLAGS(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6187 void g_cclosure_marshal_VOID__FLOAT(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6188 void g_cclosure_marshal_VOID__INT(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6189 void g_cclosure_marshal_VOID__LONG(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6190 void g_cclosure_marshal_VOID__OBJECT(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6191 void g_cclosure_marshal_VOID__PARAM(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6192 void g_cclosure_marshal_VOID__POINTER(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6193 void g_cclosure_marshal_VOID__STRING(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6194 void g_cclosure_marshal_VOID__UCHAR(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6195 void g_cclosure_marshal_VOID__UINT(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6196 void g_cclosure_marshal_VOID__UINT_POINTER(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6197 void g_cclosure_marshal_VOID__ULONG(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6198 void g_cclosure_marshal_VOID__VARIANT(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6199 void g_cclosure_marshal_VOID__VOID(Closure* closure, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6200 void g_cclosure_marshal_generic(Closure* closure, Value* return_gvalue, uint n_param_values, Value* param_values, void* invocation_hint, void* marshal_data);
6201 Closure* /*new*/ g_cclosure_new(Callback callback_func, void* user_data, ClosureNotify destroy_data);
6202 Closure* /*new*/ g_cclosure_new_object(Callback callback_func, Object* object);
6203 Closure* /*new*/ g_cclosure_new_object_swap(Callback callback_func, Object* object);
6204 Closure* /*new*/ g_cclosure_new_swap(Callback callback_func, void* user_data, ClosureNotify destroy_data);
6205 Closure* /*new*/ g_closure_new_object(uint sizeof_closure, Object* object);
6206 Closure* /*new*/ g_closure_new_simple(uint sizeof_closure, void* data);
6207 void g_closure_add_finalize_notifier(Closure* this_, void* notify_data, ClosureNotify notify_func);
6208 void g_closure_add_invalidate_notifier(Closure* this_, void* notify_data, ClosureNotify notify_func);
6209 void g_closure_add_marshal_guards(Closure* this_, void* pre_marshal_data, ClosureNotify pre_marshal_notify, void* post_marshal_data, ClosureNotify post_marshal_notify);
6210 void g_closure_invalidate(Closure* this_);
6211 void g_closure_invoke(Closure* this_, Value* return_value, uint n_param_values, Value* param_values, void* invocation_hint=null);
6212 Closure* g_closure_ref(Closure* this_);
6213 void g_closure_remove_finalize_notifier(Closure* this_, void* notify_data, ClosureNotify notify_func);
6214 void g_closure_remove_invalidate_notifier(Closure* this_, void* notify_data, ClosureNotify notify_func);
6215 void g_closure_set_marshal(Closure* this_, ClosureMarshal marshal);
6216 void g_closure_set_meta_marshal(Closure* this_, void* marshal_data, ClosureMarshal meta_marshal);
6217 void g_closure_sink(Closure* this_);
6218 void g_closure_unref(Closure* this_);
6219 Object* /*new*/ g_object_new_valist(Type object_type, char* first_property_name, va_list var_args);
6220 Object* /*new*/ g_object_newv(Type object_type, uint n_parameters, Parameter* parameters);
6221 Binding* g_object_bind_property(void* source, char* source_property, void* target, char* target_property, BindingFlags flags);
6222 Binding* g_object_bind_property_full(void* source, char* source_property, void* target, char* target_property, BindingFlags flags, BindingTransformFunc transform_to, BindingTransformFunc transform_from, void* user_data, GLib2.DestroyNotify notify);
6223 Binding* g_object_bind_property_with_closures(void* source, char* source_property, void* target, char* target_property, BindingFlags flags, Closure* transform_to, Closure* transform_from);
6224 size_t g_object_compat_control(size_t what, void* data);
6225 void* g_object_connect(void* object, char* signal_spec, ...);
6226 void g_object_disconnect(void* object, char* signal_spec, ...);
6227 void g_object_get(void* object, char* first_property_name, ...);
6228 ParamSpec* g_object_interface_find_property(void* g_iface, char* property_name);
6229 void g_object_interface_install_property(void* g_iface, ParamSpec* pspec);
6230 ParamSpec** /*new container*/ g_object_interface_list_properties(void* g_iface, /*out*/ uint* n_properties_p);
6231 void* /*new*/ g_object_new(Type object_type, char* first_property_name, ...);
6232 void g_object_set(void* object, char* first_property_name, ...);
6233 void g_object_add_toggle_ref(Object* this_, ToggleNotify notify, void* data);
6234 void g_object_add_weak_pointer(Object* this_, /*inout*/ void** weak_pointer_location);
6235 void g_object_force_floating(Object* this_);
6236 void g_object_freeze_notify(Object* this_);
6237 void* g_object_get_data(Object* this_, char* key);
6238 void g_object_get_property(Object* this_, char* property_name, Value* value);
6239 void* g_object_get_qdata(Object* this_, GLib2.Quark quark);
6240 void g_object_get_valist(Object* this_, char* first_property_name, va_list var_args);
6241 int g_object_is_floating(Object* this_);
6242 void g_object_notify(Object* this_, char* property_name);
6243 void g_object_notify_by_pspec(Object* this_, ParamSpec* pspec);
6244 Object* g_object_ref(Object* this_);
6245 Object* g_object_ref_sink(Object* this_);
6246 void g_object_remove_toggle_ref(Object* this_, ToggleNotify notify, void* data);
6247 void g_object_remove_weak_pointer(Object* this_, /*inout*/ void** weak_pointer_location);
6248 void g_object_run_dispose(Object* this_);
6249 void g_object_set_data(Object* this_, char* key, void* data);
6250 void g_object_set_data_full(Object* this_, char* key, void* data, GLib2.DestroyNotify destroy);
6251 void g_object_set_property(Object* this_, char* property_name, Value* value);
6252 void g_object_set_qdata(Object* this_, GLib2.Quark quark, void* data);
6253 void g_object_set_qdata_full(Object* this_, GLib2.Quark quark, void* data, GLib2.DestroyNotify destroy);
6254 void g_object_set_valist(Object* this_, char* first_property_name, va_list var_args);
6255 void* /*new*/ g_object_steal_data(Object* this_, char* key);
6256 void* /*new*/ g_object_steal_qdata(Object* this_, GLib2.Quark quark);
6257 void g_object_thaw_notify(Object* this_);
6258 void g_object_unref(Object* this_);
6259 void g_object_watch_closure(Object* this_, Closure* closure);
6260 void g_object_weak_ref(Object* this_, WeakNotify notify, void* data);
6261 void g_object_weak_unref(Object* this_, WeakNotify notify, void* data);
6262 ParamSpec* g_object_class_find_property(ObjectClass* this_, char* property_name);
6263 void g_object_class_install_properties(ObjectClass* this_, uint n_pspecs, ParamSpec** pspecs);
6264 void g_object_class_install_property(ObjectClass* this_, uint property_id, ParamSpec* pspec);
6265 ParamSpec** /*new container*/ g_object_class_list_properties(ObjectClass* this_, /*out*/ uint* n_properties);
6266 void g_object_class_override_property(ObjectClass* this_, uint property_id, char* name);
6267 void* g_param_spec_internal(Type param_type, char* name, char* nick, char* blurb, ParamFlags flags);
6268 char* g_param_spec_get_blurb(ParamSpec* this_);
6269 char* g_param_spec_get_name(ParamSpec* this_);
6270 char* g_param_spec_get_nick(ParamSpec* this_);
6271 void* g_param_spec_get_qdata(ParamSpec* this_, GLib2.Quark quark);
6272 ParamSpec* g_param_spec_get_redirect_target(ParamSpec* this_);
6273 ParamSpec* g_param_spec_ref(ParamSpec* this_);
6274 ParamSpec* g_param_spec_ref_sink(ParamSpec* this_);
6275 void g_param_spec_set_qdata(ParamSpec* this_, GLib2.Quark quark, void* data);
6276 void g_param_spec_set_qdata_full(ParamSpec* this_, GLib2.Quark quark, void* data, GLib2.DestroyNotify destroy);
6277 void g_param_spec_sink(ParamSpec* this_);
6278 void* g_param_spec_steal_qdata(ParamSpec* this_, GLib2.Quark quark);
6279 void g_param_spec_unref(ParamSpec* this_);
6280 void g_param_spec_pool_insert(ParamSpecPool* this_, ParamSpec* pspec, Type owner_type);
6281 ParamSpec** /*new container*/ g_param_spec_pool_list(ParamSpecPool* this_, Type owner_type, /*out*/ uint* n_pspecs_p);
6282 GLib2.List* /*new container*/ g_param_spec_pool_list_owned(ParamSpecPool* this_, Type owner_type);
6283 ParamSpec* g_param_spec_pool_lookup(ParamSpecPool* this_, char* param_name, Type owner_type, int walk_ancestors);
6284 void g_param_spec_pool_remove(ParamSpecPool* this_, ParamSpec* pspec);
6285 ParamSpecPool* g_param_spec_pool_new(int type_prefixing);
6286 void* g_type_class_get_private(TypeClass* this_, Type private_type);
6287 TypeClass* g_type_class_peek_parent(TypeClass* this_);
6288 void g_type_class_unref(TypeClass* this_);
6289 void g_type_class_unref_uncached(TypeClass* this_);
6290 void g_type_class_add_private(void* g_class, size_t private_size);
6291 TypeClass* g_type_class_peek(Type type);
6292 TypeClass* g_type_class_peek_static(Type type);
6293 TypeClass* g_type_class_ref(Type type);
6294 void* g_type_instance_get_private(TypeInstance* this_, Type private_type);
6295 TypeInterface* g_type_interface_peek_parent(TypeInterface* this_);
6296 void g_type_interface_add_prerequisite(Type interface_type, Type prerequisite_type);
6297 TypePlugin* g_type_interface_get_plugin(Type instance_type, Type interface_type);
6298 TypeInterface* g_type_interface_peek(TypeClass* instance_class, Type iface_type);
6299 Type* /*new*/ g_type_interface_prerequisites(Type interface_type, /*out*/ uint* n_prerequisites=null);
6300 void g_type_module_add_interface(TypeModule* this_, Type instance_type, Type interface_type, InterfaceInfo* interface_info);
6301 Type g_type_module_register_enum(TypeModule* this_, char* name, EnumValue* const_static_values);
6302 Type g_type_module_register_flags(TypeModule* this_, char* name, FlagsValue* const_static_values);
6303 Type g_type_module_register_type(TypeModule* this_, Type parent_type, char* type_name, TypeInfo* type_info, TypeFlags flags);
6304 void g_type_module_set_name(TypeModule* this_, char* name);
6305 void g_type_module_unuse(TypeModule* this_);
6306 int g_type_module_use(TypeModule* this_);
6307 void g_type_plugin_complete_interface_info(TypePlugin* this_, Type instance_type, Type interface_type, InterfaceInfo* info);
6308 void g_type_plugin_complete_type_info(TypePlugin* this_, Type g_type, TypeInfo* info, TypeValueTable* value_table);
6309 void g_type_plugin_unuse(TypePlugin* this_);
6310 void g_type_plugin_use(TypePlugin* this_);
6311 TypeValueTable* g_type_value_table_peek(Type type);
6312 void g_value_copy(Value* this_, Value* dest_value);
6313 void* g_value_dup_boxed(Value* this_);
6314 Object* /*new*/ g_value_dup_object(Value* this_);
6315 ParamSpec* g_value_dup_param(Value* this_);
6316 char* /*new*/ g_value_dup_string(Value* this_);
6317 GLib2.Variant* /*new*/ g_value_dup_variant(Value* this_);
6318 int g_value_fits_pointer(Value* this_);
6319 int g_value_get_boolean(Value* this_);
6320 void* g_value_get_boxed(Value* this_);
6321 char g_value_get_char(Value* this_);
6322 double g_value_get_double(Value* this_);
6323 int g_value_get_enum(Value* this_);
6324 uint g_value_get_flags(Value* this_);
6325 float g_value_get_float(Value* this_);
6326 int g_value_get_int(Value* this_);
6327 long g_value_get_int64(Value* this_);
6328 c_long g_value_get_long(Value* this_);
6329 Object* g_value_get_object(Value* this_);
6330 ParamSpec* g_value_get_param(Value* this_);
6331 void* g_value_get_pointer(Value* this_);
6332 char* g_value_get_string(Value* this_);
6333 ubyte g_value_get_uchar(Value* this_);
6334 uint g_value_get_uint(Value* this_);
6335 ulong g_value_get_uint64(Value* this_);
6336 c_ulong g_value_get_ulong(Value* this_);
6337 GLib2.Variant* /*new*/ g_value_get_variant(Value* this_);
6338 Value* g_value_init(Value* this_, Type g_type);
6339 void* g_value_peek_pointer(Value* this_);
6340 Value* /*new*/ g_value_reset(Value* this_);
6341 void g_value_set_boolean(Value* this_, int v_boolean);
6342 void g_value_set_boxed(Value* this_, const(void)* v_boxed=null);
6343 void g_value_set_boxed_take_ownership(Value* this_, const(void)* v_boxed=null);
6344 void g_value_set_char(Value* this_, char v_char);
6345 void g_value_set_double(Value* this_, double v_double);
6346 void g_value_set_enum(Value* this_, int v_enum);
6347 void g_value_set_flags(Value* this_, uint v_flags);
6348 void g_value_set_float(Value* this_, float v_float);
6349 void g_value_set_gtype(Value* this_, Type v_gtype);
6350 void g_value_set_instance(Value* this_, void* instance=null);
6351 void g_value_set_int(Value* this_, int v_int);
6352 void g_value_set_int64(Value* this_, long v_int64);
6353 void g_value_set_long(Value* this_, c_long v_long);
6354 void g_value_set_object(Value* this_, Object* v_object=null);
6355 void g_value_set_object_take_ownership(Value* this_, void* v_object=null);
6356 void g_value_set_param(Value* this_, ParamSpec* param=null);
6357 void g_value_set_param_take_ownership(Value* this_, ParamSpec* param=null);
6358 void g_value_set_pointer(Value* this_, void* v_pointer);
6359 void g_value_set_static_boxed(Value* this_, const(void)* v_boxed=null);
6360 void g_value_set_static_string(Value* this_, char* v_string=null);
6361 void g_value_set_string(Value* this_, char* v_string=null);
6362 void g_value_set_string_take_ownership(Value* this_, char* v_string=null);
6363 void g_value_set_uchar(Value* this_, ubyte v_uchar);
6364 void g_value_set_uint(Value* this_, uint v_uint);
6365 void g_value_set_uint64(Value* this_, ulong v_uint64);
6366 void g_value_set_ulong(Value* this_, c_ulong v_ulong);
6367 void g_value_set_variant(Value* this_, GLib2.Variant* variant=null);
6368 void g_value_take_boxed(Value* this_, const(void)* v_boxed=null);
6369 void g_value_take_object(Value* this_, void* v_object=null);
6370 void g_value_take_param(Value* this_, ParamSpec* param=null);
6371 void g_value_take_string(Value* this_, char* v_string=null);
6372 void g_value_take_variant(Value* this_, GLib2.Variant* variant=null);
6373 int g_value_transform(Value* this_, Value* dest_value);
6374 void g_value_unset(Value* this_);
6375 void g_value_register_transform_func(Type src_type, Type dest_type, ValueTransform transform_func);
6376 int g_value_type_compatible(Type src_type, Type dest_type);
6377 int g_value_type_transformable(Type src_type, Type dest_type);
6378 ValueArray* /*new*/ g_value_array_new(uint n_prealloced);
6379 ValueArray* g_value_array_append(ValueArray* this_, Value* value=null);
6380 ValueArray* /*new*/ g_value_array_copy(ValueArray* this_);
6381 void g_value_array_free(ValueArray* this_);
6382 Value* g_value_array_get_nth(ValueArray* this_, uint index_);
6383 ValueArray* g_value_array_insert(ValueArray* this_, uint index_, Value* value=null);
6384 ValueArray* g_value_array_prepend(ValueArray* this_, Value* value=null);
6385 ValueArray* g_value_array_remove(ValueArray* this_, uint index_);
6386 ValueArray* g_value_array_sort(ValueArray* this_, GLib2.CompareFunc compare_func);
6387 ValueArray* g_value_array_sort_with_data(ValueArray* this_, GLib2.CompareDataFunc compare_func, void* user_data);
6388 void* g_boxed_copy(Type boxed_type, const(void)* src_boxed);
6389 void g_boxed_free(Type boxed_type, void* boxed);
6390 Type g_boxed_type_register_static(char* name, BoxedCopyFunc boxed_copy, BoxedFreeFunc boxed_free);
6391 void g_clear_object(Object** object_ptr);
6392 void g_enum_complete_type_info(Type g_enum_type, TypeInfo* info, EnumValue* const_values);
6393 EnumValue* g_enum_get_value(EnumClass* enum_class, int value);
6394 EnumValue* g_enum_get_value_by_name(EnumClass* enum_class, char* name);
6395 EnumValue* g_enum_get_value_by_nick(EnumClass* enum_class, char* nick);
6396 Type g_enum_register_static(char* name, EnumValue* const_static_values);
6397 void g_flags_complete_type_info(Type g_flags_type, TypeInfo* info, FlagsValue* const_values);
6398 FlagsValue* g_flags_get_first_value(FlagsClass* flags_class, uint value);
6399 FlagsValue* g_flags_get_value_by_name(FlagsClass* flags_class, char* name);
6400 FlagsValue* g_flags_get_value_by_nick(FlagsClass* flags_class, char* nick);
6401 Type g_flags_register_static(char* name, FlagsValue* const_static_values);
6402 Type g_gtype_get_type();
6403 ParamSpec* g_param_spec_boolean(char* name, char* nick, char* blurb, int default_value, ParamFlags flags);
6404 ParamSpec* g_param_spec_boxed(char* name, char* nick, char* blurb, Type boxed_type, ParamFlags flags);
6405 ParamSpec* g_param_spec_char(char* name, char* nick, char* blurb, byte minimum, byte maximum, byte default_value, ParamFlags flags);
6406 ParamSpec* g_param_spec_double(char* name, char* nick, char* blurb, double minimum, double maximum, double default_value, ParamFlags flags);
6407 ParamSpec* g_param_spec_enum(char* name, char* nick, char* blurb, Type enum_type, int default_value, ParamFlags flags);
6408 ParamSpec* g_param_spec_flags(char* name, char* nick, char* blurb, Type flags_type, uint default_value, ParamFlags flags);
6409 ParamSpec* g_param_spec_float(char* name, char* nick, char* blurb, float minimum, float maximum, float default_value, ParamFlags flags);
6410 ParamSpec* g_param_spec_gtype(char* name, char* nick, char* blurb, Type is_a_type, ParamFlags flags);
6411 ParamSpec* g_param_spec_int(char* name, char* nick, char* blurb, int minimum, int maximum, int default_value, ParamFlags flags);
6412 ParamSpec* g_param_spec_int64(char* name, char* nick, char* blurb, long minimum, long maximum, long default_value, ParamFlags flags);
6413 ParamSpec* g_param_spec_long(char* name, char* nick, char* blurb, c_long minimum, c_long maximum, c_long default_value, ParamFlags flags);
6414 ParamSpec* g_param_spec_object(char* name, char* nick, char* blurb, Type object_type, ParamFlags flags);
6415 ParamSpec* g_param_spec_override(char* name, ParamSpec* overridden);
6416 ParamSpec* g_param_spec_param(char* name, char* nick, char* blurb, Type param_type, ParamFlags flags);
6417 ParamSpec* g_param_spec_pointer(char* name, char* nick, char* blurb, ParamFlags flags);
6418 ParamSpec* g_param_spec_string(char* name, char* nick, char* blurb, char* default_value, ParamFlags flags);
6419 ParamSpec* g_param_spec_uchar(char* name, char* nick, char* blurb, ubyte minimum, ubyte maximum, ubyte default_value, ParamFlags flags);
6420 ParamSpec* g_param_spec_uint(char* name, char* nick, char* blurb, uint minimum, uint maximum, uint default_value, ParamFlags flags);
6421 ParamSpec* g_param_spec_uint64(char* name, char* nick, char* blurb, ulong minimum, ulong maximum, ulong default_value, ParamFlags flags);
6422 ParamSpec* g_param_spec_ulong(char* name, char* nick, char* blurb, c_ulong minimum, c_ulong maximum, c_ulong default_value, ParamFlags flags);
6423 ParamSpec* g_param_spec_unichar(char* name, char* nick, char* blurb, dchar default_value, ParamFlags flags);
6424 ParamSpec* g_param_spec_value_array(char* name, char* nick, char* blurb, ParamSpec* element_spec, ParamFlags flags);
6425 ParamSpec* g_param_spec_variant(char* name, char* nick, char* blurb, GLib2.VariantType* type, GLib2.Variant* default_value, ParamFlags flags);
6426 Type g_param_type_register_static(char* name, ParamSpecTypeInfo* pspec_info);
6427 int g_param_value_convert(ParamSpec* pspec, Value* src_value, Value* dest_value, int strict_validation);
6428 int g_param_value_defaults(ParamSpec* pspec, Value* value);
6429 void g_param_value_set_default(ParamSpec* pspec, Value* value);
6430 int g_param_value_validate(ParamSpec* pspec, Value* value);
6431 int g_param_values_cmp(ParamSpec* pspec, Value* value1, Value* value2);
6432 Type g_pointer_type_register_static(char* name);
6433 int g_signal_accumulator_first_wins(SignalInvocationHint* ihint, Value* return_accu, Value* handler_return, void* dummy);
6434 int g_signal_accumulator_true_handled(SignalInvocationHint* ihint, Value* return_accu, Value* handler_return, void* dummy);
6435 c_ulong g_signal_add_emission_hook(uint signal_id, GLib2.Quark detail, SignalEmissionHook hook_func, void* hook_data, GLib2.DestroyNotify data_destroy);
6436 void g_signal_chain_from_overridden(Value* instance_and_params, Value* return_value);
6437 void g_signal_chain_from_overridden_handler(void* instance, ...);
6438 c_ulong g_signal_connect_closure(void* instance, char* detailed_signal, Closure* closure, int after);
6439 c_ulong g_signal_connect_closure_by_id(void* instance, uint signal_id, GLib2.Quark detail, Closure* closure, int after);
6440 c_ulong g_signal_connect_data(void* instance, char* detailed_signal, Callback c_handler, void* data, ClosureNotify destroy_data, ConnectFlags connect_flags);
6441 c_ulong g_signal_connect_object(void* instance, char* detailed_signal, Callback c_handler, void* gobject, ConnectFlags connect_flags);
6442 void g_signal_emit(void* instance, uint signal_id, GLib2.Quark detail, ...);
6443 void g_signal_emit_by_name(void* instance, char* detailed_signal, ...);
6444 void g_signal_emit_valist(void* instance, uint signal_id, GLib2.Quark detail, va_list var_args);
6445 void g_signal_emitv(Value* instance_and_params, uint signal_id, GLib2.Quark detail, Value* return_value);
6446 SignalInvocationHint* g_signal_get_invocation_hint(void* instance);
6447 void g_signal_handler_block(void* instance, c_ulong handler_id);
6448 void g_signal_handler_disconnect(void* instance, c_ulong handler_id);
6449 c_ulong g_signal_handler_find(void* instance, SignalMatchType mask, uint signal_id, GLib2.Quark detail, Closure* closure, void* func, void* data);
6450 int g_signal_handler_is_connected(void* instance, c_ulong handler_id);
6451 void g_signal_handler_unblock(void* instance, c_ulong handler_id);
6452 uint g_signal_handlers_block_matched(void* instance, SignalMatchType mask, uint signal_id, GLib2.Quark detail, Closure* closure, void* func, void* data);
6453 void g_signal_handlers_destroy(void* instance);
6454 uint g_signal_handlers_disconnect_matched(void* instance, SignalMatchType mask, uint signal_id, GLib2.Quark detail, Closure* closure, void* func, void* data);
6455 uint g_signal_handlers_unblock_matched(void* instance, SignalMatchType mask, uint signal_id, GLib2.Quark detail, Closure* closure, void* func, void* data);
6456 int g_signal_has_handler_pending(void* instance, uint signal_id, GLib2.Quark detail, int may_be_blocked);
6457 uint* g_signal_list_ids(Type itype, /*out*/ uint* n_ids);
6458 uint g_signal_lookup(char* name, Type itype);
6459 char* g_signal_name(uint signal_id);
6460 uint g_signal_new(char* signal_name, Type itype, SignalFlags signal_flags, uint class_offset, SignalAccumulator accumulator, void* accu_data, SignalCMarshaller c_marshaller, Type return_type, uint n_params, ...);
6461 uint g_signal_new_class_handler(char* signal_name, Type itype, SignalFlags signal_flags, Callback class_handler, SignalAccumulator accumulator, void* accu_data, SignalCMarshaller c_marshaller, Type return_type, uint n_params, ...);
6462 uint g_signal_new_valist(char* signal_name, Type itype, SignalFlags signal_flags, Closure* class_closure, SignalAccumulator accumulator, void* accu_data, SignalCMarshaller c_marshaller, Type return_type, uint n_params, va_list args);
6463 uint g_signal_newv(char* signal_name, Type itype, SignalFlags signal_flags, Closure* class_closure, SignalAccumulator accumulator, void* accu_data, SignalCMarshaller c_marshaller, Type return_type, uint n_params, Type* param_types);
6464 void g_signal_override_class_closure(uint signal_id, Type instance_type, Closure* class_closure);
6465 void g_signal_override_class_handler(char* signal_name, Type instance_type, Callback class_handler);
6466 int g_signal_parse_name(char* detailed_signal, Type itype, /*out*/ uint* signal_id_p, /*out*/ GLib2.Quark* detail_p, int force_detail_quark);
6467 void g_signal_query(uint signal_id, /*out*/ SignalQuery* query);
6468 void g_signal_remove_emission_hook(uint signal_id, c_ulong hook_id);
6469 void g_signal_stop_emission(void* instance, uint signal_id, GLib2.Quark detail);
6470 void g_signal_stop_emission_by_name(void* instance, char* detailed_signal);
6471 Closure* /*new*/ g_signal_type_cclosure_new(Type itype, uint struct_offset);
6472 void g_source_set_closure(GLib2.Source* source, Closure* closure);
6473 void g_source_set_dummy_callback(GLib2.Source* source);
6474 char* /*new*/ g_strdup_value_contents(Value* value);
6475 void g_type_add_class_cache_func(void* cache_data, TypeClassCacheFunc cache_func);
6476 void g_type_add_class_private(Type class_type, size_t private_size);
6477 void g_type_add_interface_check(void* check_data, TypeInterfaceCheckFunc check_func);
6478 void g_type_add_interface_dynamic(Type instance_type, Type interface_type, TypePlugin* plugin);
6479 void g_type_add_interface_static(Type instance_type, Type interface_type, InterfaceInfo* info);
6480 TypeClass* g_type_check_class_cast(TypeClass* g_class, Type is_a_type);
6481 int g_type_check_class_is_a(TypeClass* g_class, Type is_a_type);
6482 int g_type_check_instance(TypeInstance* instance);
6483 TypeInstance* g_type_check_instance_cast(TypeInstance* instance, Type iface_type);
6484 int g_type_check_instance_is_a(TypeInstance* instance, Type iface_type);
6485 int g_type_check_is_value_type(Type type);
6486 int g_type_check_value(Value* value);
6487 int g_type_check_value_holds(Value* value, Type type);
6488 Type* /*new*/ g_type_children(Type type, /*out*/ uint* n_children=null);
6489 TypeInstance* g_type_create_instance(Type type);
6490 TypeInterface* g_type_default_interface_peek(Type g_type);
6491 TypeInterface* g_type_default_interface_ref(Type g_type);
6492 void g_type_default_interface_unref(TypeInterface* g_iface);
6493 uint g_type_depth(Type type);
6494 void g_type_free_instance(TypeInstance* instance);
6495 Type g_type_from_name(char* name);
6496 Type g_type_fundamental(Type type_id);
6497 Type g_type_fundamental_next();
6498 TypePlugin* g_type_get_plugin(Type type);
6499 void* g_type_get_qdata(Type type, GLib2.Quark quark);
6500 void g_type_init();
6501 void g_type_init_with_debug_flags(TypeDebugFlags debug_flags);
6502 Type* /*new*/ g_type_interfaces(Type type, /*out*/ uint* n_interfaces=null);
6503 int g_type_is_a(Type type, Type is_a_type);
6504 char* g_type_name(Type type);
6505 char* g_type_name_from_class(TypeClass* g_class);
6506 char* g_type_name_from_instance(TypeInstance* instance);
6507 Type g_type_next_base(Type leaf_type, Type root_type);
6508 Type g_type_parent(Type type);
6509 GLib2.Quark g_type_qname(Type type);
6510 void g_type_query(Type type, /*out*/ TypeQuery* query);
6511 Type g_type_register_dynamic(Type parent_type, char* type_name, TypePlugin* plugin, TypeFlags flags);
6512 Type g_type_register_fundamental(Type type_id, char* type_name, TypeInfo* info, TypeFundamentalInfo* finfo, TypeFlags flags);
6513 Type g_type_register_static(Type parent_type, char* type_name, TypeInfo* info, TypeFlags flags);
6514 Type g_type_register_static_simple(Type parent_type, char* type_name, uint class_size, ClassInitFunc class_init, uint instance_size, InstanceInitFunc instance_init, TypeFlags flags);
6515 void g_type_remove_class_cache_func(void* cache_data, TypeClassCacheFunc cache_func);
6516 void g_type_remove_interface_check(void* check_data, TypeInterfaceCheckFunc check_func);
6517 void g_type_set_qdata(Type type, GLib2.Quark quark, void* data);
6518 int g_type_test_flags(Type type, uint flags);
6519 Type g_value_get_gtype(Value* value);