v0.2.1 c0399be

gtype.go RawHistoryFolder

1// Package gobject was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gobject
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11	"github.com/bnema/puregotk/v4/glib"
12	"github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// A callback function used by the type system to finalize those portions
16// of a derived types class structure that were setup from the corresponding
17// GBaseInitFunc() function.
18//
19// Class finalization basically works the inverse way in which class
20// initialization is performed.
21//
22// See GClassInitFunc() for a discussion of the class initialization process.
23type BaseFinalizeFunc func(*TypeClass)
24
25// A callback function used by the type system to do base initialization
26// of the class structures of derived types.
27//
28// This function is called as part of the initialization process of all derived
29// classes and should reallocate or reset all dynamic class members copied over
30// from the parent class.
31//
32// For example, class members (such as strings) that are not sufficiently
33// handled by a plain memory copy of the parent class into the derived class
34// have to be altered. See GClassInitFunc() for a discussion of the class
35// initialization process.
36type BaseInitFunc func(*TypeClass)
37
38// A callback function used by the type system to finalize a class.
39//
40// This function is rarely needed, as dynamically allocated class resources
41// should be handled by GBaseInitFunc() and GBaseFinalizeFunc().
42//
43// Also, specification of a GClassFinalizeFunc() in the #GTypeInfo
44// structure of a static type is invalid, because classes of static types
45// will never be finalized (they are artificially kept alive when their
46// reference count drops to zero).
47type ClassFinalizeFunc func(*TypeClass, uintptr)
48
49// A callback function used by the type system to initialize the class
50// of a specific type.
51//
52// This function should initialize all static class members.
53//
54// The initialization process of a class involves:
55//
56//   - Copying common members from the parent class over to the
57//     derived class structure.
58//   - Zero initialization of the remaining members not copied
59//     over from the parent class.
60//   - Invocation of the GBaseInitFunc() initializers of all parent
61//     types and the class' type.
62//   - Invocation of the class' GClassInitFunc() initializer.
63//
64// Since derived classes are partially initialized through a memory copy
65// of the parent class, the general rule is that GBaseInitFunc() and
66// GBaseFinalizeFunc() should take care of necessary reinitialization
67// and release of those class members that were introduced by the type
68// that specified these GBaseInitFunc()/GBaseFinalizeFunc().
69// GClassInitFunc() should only care about initializing static
70// class members, while dynamic class members (such as allocated strings
71// or reference counted resources) are better handled by a GBaseInitFunc()
72// for this type, so proper initialization of the dynamic class members
73// is performed for class initialization of derived types as well.
74//
75// An example may help to correspond the intend of the different class
76// initializers:
77//
78// |[<!-- language="C" -->
79//
80//	typedef struct {
81//	  GObjectClass parent_class;
82//	  gint         static_integer;
83//	  gchar       *dynamic_string;
84//	} TypeAClass;
85//
86// static void
87// type_a_base_class_init (TypeAClass *class)
88//
89//	{
90//	  class->dynamic_string = g_strdup ("some string");
91//	}
92//
93// static void
94// type_a_base_class_finalize (TypeAClass *class)
95//
96//	{
97//	  g_free (class->dynamic_string);
98//	}
99//
100// static void
101// type_a_class_init (TypeAClass *class)
102//
103//	{
104//	  class->static_integer = 42;
105//	}
106//
107//	typedef struct {
108//	  TypeAClass   parent_class;
109//	  gfloat       static_float;
110//	  GString     *dynamic_gstring;
111//	} TypeBClass;
112//
113// static void
114// type_b_base_class_init (TypeBClass *class)
115//
116//	{
117//	  class->dynamic_gstring = g_string_new ("some other string");
118//	}
119//
120// static void
121// type_b_base_class_finalize (TypeBClass *class)
122//
123//	{
124//	  g_string_free (class->dynamic_gstring);
125//	}
126//
127// static void
128// type_b_class_init (TypeBClass *class)
129//
130//	{
131//	  class->static_float = 3.14159265358979323846;
132//	}
133//
134// ]|
135//
136// Initialization of TypeBClass will first cause initialization of
137// TypeAClass (derived classes reference their parent classes, see
138// g_type_class_ref() on this).
139//
140// Initialization of TypeAClass roughly involves zero-initializing its fields,
141// then calling its GBaseInitFunc() type_a_base_class_init() to allocate
142// its dynamic members (dynamic_string), and finally calling its GClassInitFunc()
143// type_a_class_init() to initialize its static members (static_integer).
144// The first step in the initialization process of TypeBClass is then
145// a plain memory copy of the contents of TypeAClass into TypeBClass and
146// zero-initialization of the remaining fields in TypeBClass.
147// The dynamic members of TypeAClass within TypeBClass now need
148// reinitialization which is performed by calling type_a_base_class_init()
149// with an argument of TypeBClass.
150//
151// After that, the GBaseInitFunc() of TypeBClass, type_b_base_class_init()
152// is called to allocate the dynamic members of TypeBClass (dynamic_gstring),
153// and finally the GClassInitFunc() of TypeBClass, type_b_class_init(),
154// is called to complete the initialization process with the static members
155// (static_float).
156//
157// Corresponding finalization counter parts to the GBaseInitFunc() functions
158// have to be provided to release allocated resources at class finalization
159// time.
160type ClassInitFunc func(*TypeClass, uintptr)
161
162// A callback function used by the type system to initialize a new
163// instance of a type.
164//
165// This function initializes all instance members and allocates any resources
166// required by it.
167//
168// Initialization of a derived instance involves calling all its parent
169// types instance initializers, so the class member of the instance
170// is altered during its initialization to always point to the class that
171// belongs to the type the current initializer was introduced for.
172//
173// The extended members of @instance are guaranteed to have been filled with
174// zeros before this function is called.
175type InstanceInitFunc func(*TypeInstance, *TypeClass)
176
177// A callback function used by the type system to finalize an interface.
178//
179// This function should destroy any internal data and release any resources
180// allocated by the corresponding GInterfaceInitFunc() function.
181type InterfaceFinalizeFunc func(*TypeInterface, uintptr)
182
183// A callback function used by the type system to initialize a new
184// interface.
185//
186// This function should initialize all internal data and* allocate any
187// resources required by the interface.
188//
189// The members of @iface_data are guaranteed to have been filled with
190// zeros before this function is called.
191type InterfaceInitFunc func(*TypeInterface, uintptr)
192
193// A callback function which is called when the reference count of a class
194// drops to zero.
195//
196// It may use g_type_class_ref() to prevent the class from being freed. You
197// should not call g_type_class_unref() from a #GTypeClassCacheFunc function
198// to prevent infinite recursion, use g_type_class_unref_uncached() instead.
199//
200// The functions have to check the class id passed in to figure
201// whether they actually want to cache the class of this type, since all
202// classes are routed through the same #GTypeClassCacheFunc chain.
203type TypeClassCacheFunc func(uintptr, *TypeClass) bool
204
205// A callback called after an interface vtable is initialized.
206//
207// See g_type_add_interface_check().
208type TypeInterfaceCheckFunc func(uintptr, *TypeInterface)
209
210// This function is responsible for converting the values collected from
211// a variadic argument list into contents suitable for storage in a #GValue.
212//
213// This function should setup @value similar to #GTypeValueInitFunc; e.g.
214// for a string value that does not allow `NULL` pointers, it needs to either
215// emit an error, or do an implicit conversion by storing an empty string.
216//
217// The @value passed in to this function has a zero-filled data array, so
218// just like for #GTypeValueInitFunc it is guaranteed to not contain any old
219// contents that might need freeing.
220//
221// The @n_collect_values argument is the string length of the `collect_format`
222// field of #GTypeValueTable, and `collect_values` is an array of #GTypeCValue
223// with length of @n_collect_values, containing the collected values according
224// to `collect_format`.
225//
226// The @collect_flags argument provided as a hint by the caller. It may
227// contain the flag %G_VALUE_NOCOPY_CONTENTS indicating that the collected
228// value contents may be considered ‘static’ for the duration of the @value
229// lifetime. Thus an extra copy of the contents stored in @collect_values is
230// not required for assignment to @value.
231//
232// For our above string example, we continue with:
233//
234// |[<!-- language="C" -->
235// if (!collect_values[0].v_pointer)
236//
237//	value->data[0].v_pointer = g_strdup ("");
238//
239// else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
240//
241//	{
242//	  value->data[0].v_pointer = collect_values[0].v_pointer;
243//	  // keep a flag for the value_free() implementation to not free this string
244//	  value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
245//	}
246//
247// else
248//
249//	value->data[0].v_pointer = g_strdup (collect_values[0].v_pointer);
250//
251// return NULL;
252// ]|
253//
254// It should be noted, that it is generally a bad idea to follow the
255// %G_VALUE_NOCOPY_CONTENTS hint for reference counted types. Due to
256// reentrancy requirements and reference count assertions performed
257// by the signal emission code, reference counts should always be
258// incremented for reference counted contents stored in the `value->data`
259// array. To deviate from our string example for a moment, and taking
260// a look at an exemplary implementation for `GTypeValueTable.collect_value()`
261// of `GObject`:
262//
263// |[<!-- language="C" -->
264// GObject *object = G_OBJECT (collect_values[0].v_pointer);
265// g_return_val_if_fail (object != NULL,
266//
267//	g_strdup_printf ("Object %p passed as invalid NULL pointer", object));
268//
269// // never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types
270// value->data[0].v_pointer = g_object_ref (object);
271// return NULL;
272// ]|
273//
274// The reference count for valid objects is always incremented, regardless
275// of `collect_flags`. For invalid objects, the example returns a newly
276// allocated string without altering `value`.
277//
278// Upon success, `collect_value()` needs to return `NULL`. If, however,
279// an error condition occurred, `collect_value()` should return a newly
280// allocated string containing an error diagnostic.
281//
282// The calling code makes no assumptions about the `value` contents being
283// valid upon error returns, `value` is simply thrown away without further
284// freeing. As such, it is a good idea to not allocate `GValue` contents
285// prior to returning an error; however, `collect_values()` is not obliged
286// to return a correctly setup @value for error returns, simply because
287// any non-`NULL` return is considered a fatal programming error, and
288// further program behaviour is undefined.
289type TypeValueCollectFunc func(*Value, uint, []TypeCValue, uint) string
290
291// Copies the content of a #GValue into another.
292//
293// The @dest_value is a #GValue with zero-filled data section and @src_value
294// is a properly initialized #GValue of same type, or derived type.
295//
296// The purpose of this function is to copy the contents of @src_value
297// into @dest_value in a way, that even after @src_value has been freed, the
298// contents of @dest_value remain valid. String type example:
299//
300// |[<!-- language="C" -->
301// dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
302// ]|
303type TypeValueCopyFunc func(*Value, *Value)
304
305// Frees any old contents that might be left in the `value->data` array of
306// the given value.
307//
308// No resources may remain allocated through the #GValue contents after this
309// function returns. E.g. for our above string type:
310//
311// |[<!-- language="C" -->
312// // only free strings without a specific flag for static storage
313// if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
314//
315//	g_free (value->data[0].v_pointer);
316//
317// ]|
318type TypeValueFreeFunc func(*Value)
319
320// Initializes the value contents by setting the fields of the `value->data`
321// array.
322//
323// The data array of the #GValue passed into this function was zero-filled
324// with `memset()`, so no care has to be taken to free any old contents.
325// For example, in the case of a string value that may never be %NULL, the
326// implementation might look like:
327//
328// |[<!-- language="C" -->
329// value->data[0].v_pointer = g_strdup ("");
330// ]|
331type TypeValueInitFunc func(*Value)
332
333// This function is responsible for storing the `value`
334// contents into arguments passed through a variadic argument list which
335// got collected into `collect_values` according to `lcopy_format`.
336//
337// The `n_collect_values` argument equals the string length of
338// `lcopy_format`, and `collect_flags` may contain %G_VALUE_NOCOPY_CONTENTS.
339//
340// In contrast to #GTypeValueCollectFunc, this function is obliged to always
341// properly support %G_VALUE_NOCOPY_CONTENTS.
342//
343// Similar to #GTypeValueCollectFunc the function may prematurely abort by
344// returning a newly allocated string describing an error condition. To
345// complete the string example:
346//
347// |[<!-- language="C" -->
348// gchar **string_p = collect_values[0].v_pointer;
349// g_return_val_if_fail (string_p != NULL,
350//
351//	g_strdup ("string location passed as NULL"));
352//
353// if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
354//
355//	*string_p = value->data[0].v_pointer;
356//
357// else
358//
359//	*string_p = g_strdup (value->data[0].v_pointer);
360//
361// ]|
362//
363// And an illustrative version of this function for reference-counted
364// types:
365//
366// |[<!-- language="C" -->
367// GObject **object_p = collect_values[0].v_pointer;
368// g_return_val_if_fail (object_p != NULL,
369//
370//	g_strdup ("object location passed as NULL"));
371//
372// if (value->data[0].v_pointer == NULL)
373//
374//	*object_p = NULL;
375//
376// else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) // always honour
377//
378//	*object_p = value->data[0].v_pointer;
379//
380// else
381//
382//	*object_p = g_object_ref (value->data[0].v_pointer);
383//
384// return NULL;
385// ]|
386type TypeValueLCopyFunc func(*Value, uint, []TypeCValue, uint) string
387
388// If the value contents fit into a pointer, such as objects or strings,
389// return this pointer, so the caller can peek at the current contents.
390//
391// To extend on our above string example:
392//
393// |[<!-- language="C" -->
394// return value->data[0].v_pointer;
395// ]|
396type TypeValuePeekPointerFunc func(*Value) uintptr
397
398// A structure that provides information to the type system which is
399// used specifically for managing interface types.
400type InterfaceInfo struct {
401	_ structs.HostLayout
402
403	InterfaceInit InterfaceInitFunc
404
405	InterfaceFinalize InterfaceFinalizeFunc
406
407	InterfaceData uintptr
408}
409
410func (x *InterfaceInfo) GoPointer() uintptr {
411	return uintptr(unsafe.Pointer(x))
412}
413
414// An opaque structure used as the base of all classes.
415type TypeClass struct {
416	_ structs.HostLayout
417
418	GType types.GType
419}
420
421func (x *TypeClass) GoPointer() uintptr {
422	return uintptr(unsafe.Pointer(x))
423}
424
425var xTypeClassAddPrivate func(uintptr, uint)
426
427// Registers a private structure for an instantiatable type.
428//
429// When an object is allocated, the private structures for
430// the type and all of its parent types are allocated
431// sequentially in the same memory block as the public
432// structures, and are zero-filled.
433//
434// Note that the accumulated size of the private structures of
435// a type and all its parent types cannot exceed 64 KiB.
436//
437// This function should be called in the type's class_init() function.
438// The private structure can be retrieved using the
439// G_TYPE_INSTANCE_GET_PRIVATE() macro.
440//
441// The following example shows attaching a private structure
442// MyObjectPrivate to an object MyObject defined in the standard
443// GObject fashion in the type's class_init() function.
444//
445// Note the use of a structure member "priv" to avoid the overhead
446// of repeatedly calling MY_OBJECT_GET_PRIVATE().
447//
448// |[<!-- language="C" -->
449// typedef struct _MyObject        MyObject;
450// typedef struct _MyObjectPrivate MyObjectPrivate;
451//
452//	struct _MyObject {
453//	 GObject parent;
454//
455//	 MyObjectPrivate *priv;
456//	};
457//
458//	struct _MyObjectPrivate {
459//	  int some_field;
460//	};
461//
462// static void
463// my_object_class_init (MyObjectClass *klass)
464//
465//	{
466//	  g_type_class_add_private (klass, sizeof (MyObjectPrivate));
467//	}
468//
469// static void
470// my_object_init (MyObject *my_object)
471//
472//	{
473//	  my_object->priv = G_TYPE_INSTANCE_GET_PRIVATE (my_object,
474//	                                                 MY_TYPE_OBJECT,
475//	                                                 MyObjectPrivate);
476//	  // my_object->priv->some_field will be automatically initialised to 0
477//	}
478//
479// static int
480// my_object_get_some_field (MyObject *my_object)
481//
482//	{
483//	  MyObjectPrivate *priv;
484//
485//	  g_return_val_if_fail (MY_IS_OBJECT (my_object), 0);
486//
487//	  priv = my_object->priv;
488//
489//	  return priv->some_field;
490//	}
491//
492// ]|
493func (x *TypeClass) AddPrivate(PrivateSizeVar uint) {
494
495	xTypeClassAddPrivate(x.GoPointer(), PrivateSizeVar)
496
497}
498
499var xTypeClassGetInstancePrivateOffset func(uintptr) int
500
501// Gets the offset of the private data for instances of @g_class.
502//
503// This is how many bytes you should add to the instance pointer of a
504// class in order to get the private data for the type represented by
505// @g_class.
506//
507// You can only call this function after you have registered a private
508// data area for @g_class using g_type_class_add_private().
509func (x *TypeClass) GetInstancePrivateOffset() int {
510
511	cret := xTypeClassGetInstancePrivateOffset(x.GoPointer())
512	return cret
513}
514
515var xTypeClassGetPrivate func(uintptr, types.GType) uintptr
516
517func (x *TypeClass) GetPrivate(PrivateTypeVar types.GType) uintptr {
518
519	cret := xTypeClassGetPrivate(x.GoPointer(), PrivateTypeVar)
520	return cret
521}
522
523var xTypeClassPeekParent func(uintptr) *TypeClass
524
525// Retrieves the class structure of the immediate parent type of the
526// class passed in.
527//
528// This is a convenience function often needed in class initializers.
529//
530// Since derived classes hold a reference on their parent classes as
531// long as they are instantiated, the returned class will always exist.
532//
533// This function is essentially equivalent to:
534// g_type_class_peek (g_type_parent (G_TYPE_FROM_CLASS (g_class)))
535func (x *TypeClass) PeekParent() *TypeClass {
536
537	cret := xTypeClassPeekParent(x.GoPointer())
538	return cret
539}
540
541var xTypeClassUnref func(uintptr)
542
543// Decrements the reference count of the class structure being passed in.
544//
545// Once the last reference count of a class has been released, classes
546// may be finalized by the type system, so further dereferencing of a
547// class pointer after g_type_class_unref() are invalid.
548func (x *TypeClass) Unref() {
549
550	xTypeClassUnref(x.GoPointer())
551
552}
553
554var xTypeClassUnrefUncached func(uintptr)
555
556// A variant of g_type_class_unref() for use in #GTypeClassCacheFunc
557// implementations.
558//
559// It unreferences a class without consulting the chain
560// of #GTypeClassCacheFuncs, avoiding the recursion which would occur
561// otherwise.
562func (x *TypeClass) UnrefUncached() {
563
564	xTypeClassUnrefUncached(x.GoPointer())
565
566}
567
568// A structure that provides information to the type system which is
569// used specifically for managing fundamental types.
570type TypeFundamentalInfo struct {
571	_ structs.HostLayout
572
573	TypeFlags TypeFundamentalFlags
574}
575
576func (x *TypeFundamentalInfo) GoPointer() uintptr {
577	return uintptr(unsafe.Pointer(x))
578}
579
580// This structure is used to provide the type system with the information
581// required to initialize and destruct (finalize) a type's class and
582// its instances.
583//
584// The initialized structure is passed to the g_type_register_static() function
585// (or is copied into the provided #GTypeInfo structure in the
586// g_type_plugin_complete_type_info()). The type system will perform a deep
587// copy of this structure, so its memory does not need to be persistent
588// across invocation of g_type_register_static().
589type TypeInfo struct {
590	_ structs.HostLayout
591
592	ClassSize uint16
593
594	BaseInit BaseInitFunc
595
596	BaseFinalize BaseFinalizeFunc
597
598	ClassInit ClassInitFunc
599
600	ClassFinalize ClassFinalizeFunc
601
602	ClassData uintptr
603
604	InstanceSize uint16
605
606	NPreallocs uint16
607
608	InstanceInit InstanceInitFunc
609
610	ValueTable *TypeValueTable
611}
612
613func (x *TypeInfo) GoPointer() uintptr {
614	return uintptr(unsafe.Pointer(x))
615}
616
617// An opaque structure used as the base of all type instances.
618type TypeInstance struct {
619	_ structs.HostLayout
620
621	GClass *TypeClass
622}
623
624func (x *TypeInstance) GoPointer() uintptr {
625	return uintptr(unsafe.Pointer(x))
626}
627
628var xTypeInstanceGetPrivate func(uintptr, types.GType) uintptr
629
630func (x *TypeInstance) GetPrivate(PrivateTypeVar types.GType) uintptr {
631
632	cret := xTypeInstanceGetPrivate(x.GoPointer(), PrivateTypeVar)
633	return cret
634}
635
636// An opaque structure used as the base of all interface types.
637type TypeInterface struct {
638	_ structs.HostLayout
639
640	GType types.GType
641
642	GInstanceType types.GType
643}
644
645func (x *TypeInterface) GoPointer() uintptr {
646	return uintptr(unsafe.Pointer(x))
647}
648
649var xTypeInterfacePeekParent func(uintptr) *TypeInterface
650
651// Returns the corresponding #GTypeInterface structure of the parent type
652// of the instance type to which @g_iface belongs.
653//
654// This is useful when deriving the implementation of an interface from the
655// parent type and then possibly overriding some methods.
656func (x *TypeInterface) PeekParent() *TypeInterface {
657
658	cret := xTypeInterfacePeekParent(x.GoPointer())
659	return cret
660}
661
662// A structure holding information for a specific type.
663//
664// See also: g_type_query()
665type TypeQuery struct {
666	_ structs.HostLayout
667
668	Type types.GType
669
670	TypeName uintptr
671
672	ClassSize uint
673
674	InstanceSize uint
675}
676
677func (x *TypeQuery) GoPointer() uintptr {
678	return uintptr(unsafe.Pointer(x))
679}
680
681// - `'i'`: Integers, passed as `collect_values[].v_int`
682//
683//   - `'l'`: Longs, passed as `collect_values[].v_long`
684//
685//   - `'d'`: Doubles, passed as `collect_values[].v_double`
686//
687//   - `'p'`: Pointers, passed as `collect_values[].v_pointer`
688//
689//     It should be noted that for variable argument list construction,
690//     ANSI C promotes every type smaller than an integer to an int, and
691//     floats to doubles. So for collection of short int or char, `'i'`
692//     needs to be used, and for collection of floats `'d'`.
693//
694// The #GTypeValueTable provides the functions required by the #GValue
695// implementation, to serve as a container for values of a type.
696type TypeValueTable struct {
697	_ structs.HostLayout
698
699	ValueInit TypeValueInitFunc
700
701	ValueFree TypeValueFreeFunc
702
703	ValueCopy TypeValueCopyFunc
704
705	ValuePeekPointer TypeValuePeekPointerFunc
706
707	CollectFormat uintptr
708
709	CollectValue TypeValueCollectFunc
710
711	LcopyFormat uintptr
712
713	LcopyValue TypeValueLCopyFunc
714}
715
716func (x *TypeValueTable) GoPointer() uintptr {
717	return uintptr(unsafe.Pointer(x))
718}
719
720const (
721	// A bit in the type number that's supposed to be left untouched.
722	TYPE_FLAG_RESERVED_ID_BIT Type = 1
723	// An integer constant that represents the number of identifiers reserved
724	// for types that are assigned at compile-time.
725	TYPE_FUNDAMENTAL_MAX int = 1020
726	// Shift value used in converting numbers to type IDs.
727	TYPE_FUNDAMENTAL_SHIFT int = 2
728	// First fundamental type number to create a new fundamental type id with
729	// G_TYPE_MAKE_FUNDAMENTAL() reserved for BSE.
730	TYPE_RESERVED_BSE_FIRST int = 32
731	// Last fundamental type number reserved for BSE.
732	TYPE_RESERVED_BSE_LAST int = 48
733	// First fundamental type number to create a new fundamental type id with
734	// G_TYPE_MAKE_FUNDAMENTAL() reserved for GLib.
735	TYPE_RESERVED_GLIB_FIRST int = 22
736	// Last fundamental type number reserved for GLib.
737	TYPE_RESERVED_GLIB_LAST int = 31
738	// First available fundamental type number to create new fundamental
739	// type id with G_TYPE_MAKE_FUNDAMENTAL().
740	TYPE_RESERVED_USER_FIRST int = 49
741)
742
743// These flags used to be passed to g_type_init_with_debug_flags() which
744// is now deprecated.
745//
746// If you need to enable debugging features, use the `GOBJECT_DEBUG`
747// environment variable.
748type TypeDebugFlags int
749
750const (
751
752	// Print no messages
753	GTypeDebugNoneValue TypeDebugFlags = 0
754	// Print messages about object bookkeeping
755	GTypeDebugObjectsValue TypeDebugFlags = 1
756	// Print messages about signal emissions
757	GTypeDebugSignalsValue TypeDebugFlags = 2
758	// Keep a count of instances of each type
759	GTypeDebugInstanceCountValue TypeDebugFlags = 4
760	// Mask covering all debug flags
761	GTypeDebugMaskValue TypeDebugFlags = 7
762)
763
764// Bit masks used to check or determine characteristics of a type.
765type TypeFlags int
766
767const (
768
769	// No special flags. Since: 2.74
770	GTypeFlagNoneValue TypeFlags = 0
771	// Indicates an abstract type. No instances can be
772	//  created for an abstract type
773	GTypeFlagAbstractValue TypeFlags = 16
774	// Indicates an abstract value type, i.e. a type
775	//  that introduces a value table, but can't be used for
776	//  g_value_init()
777	GTypeFlagValueAbstractValue TypeFlags = 32
778	// Indicates a final type. A final type is a non-derivable
779	//  leaf node in a deep derivable type hierarchy tree. Since: 2.70
780	GTypeFlagFinalValue TypeFlags = 64
781	// The type is deprecated and may be removed in a
782	//  future version. A warning will be emitted if it is instantiated while
783	//  running with `G_ENABLE_DIAGNOSTIC=1`. Since 2.76
784	GTypeFlagDeprecatedValue TypeFlags = 128
785)
786
787// Bit masks used to check or determine specific characteristics of a
788// fundamental type.
789type TypeFundamentalFlags int
790
791const (
792
793	// Indicates a classed type
794	GTypeFlagClassedValue TypeFundamentalFlags = 1
795	// Indicates an instantiatable type (implies classed)
796	GTypeFlagInstantiatableValue TypeFundamentalFlags = 2
797	// Indicates a flat derivable type
798	GTypeFlagDerivableValue TypeFundamentalFlags = 4
799	// Indicates a deep derivable type (implies derivable)
800	GTypeFlagDeepDerivableValue TypeFundamentalFlags = 8
801)
802
803var xTypeAddClassCacheFunc func(uintptr, uintptr)
804
805// Adds a #GTypeClassCacheFunc to be called before the reference count of a
806// class goes from one to zero. This can be used to prevent premature class
807// destruction. All installed #GTypeClassCacheFunc functions will be chained
808// until one of them returns %TRUE. The functions have to check the class id
809// passed in to figure whether they actually want to cache the class of this
810// type, since all classes are routed through the same #GTypeClassCacheFunc
811// chain.
812func TypeAddClassCacheFunc(CacheDataVar uintptr, CacheFuncVar *TypeClassCacheFunc) {
813
814	var CacheFuncVarRef uintptr
815	if CacheFuncVar != nil {
816		CacheFuncVarPtr := uintptr(unsafe.Pointer(CacheFuncVar))
817		if cbRefPtr, ok := glib.GetCallback(CacheFuncVarPtr); ok {
818			CacheFuncVarRef = cbRefPtr
819		} else {
820			fcb := func(arg0 uintptr, arg1 *TypeClass) bool {
821				cbFn := *CacheFuncVar
822				return cbFn(arg0, arg1)
823			}
824			CacheFuncVarRef = purego.NewCallback(fcb)
825			glib.SaveCallbackWithClosure(CacheFuncVarPtr, CacheFuncVarRef, CacheFuncVar)
826		}
827	}
828
829	xTypeAddClassCacheFunc(CacheDataVar, CacheFuncVarRef)
830
831}
832
833var xTypeAddClassPrivate func(types.GType, uint)
834
835// Registers a private class structure for a classed type;
836// when the class is allocated, the private structures for
837// the class and all of its parent types are allocated
838// sequentially in the same memory block as the public
839// structures, and are zero-filled.
840//
841// This function should be called in the
842// type's get_type() function after the type is registered.
843// The private structure can be retrieved using the
844// G_TYPE_CLASS_GET_PRIVATE() macro.
845func TypeAddClassPrivate(ClassTypeVar types.GType, PrivateSizeVar uint) {
846
847	xTypeAddClassPrivate(ClassTypeVar, PrivateSizeVar)
848
849}
850
851var xTypeAddInstancePrivate func(types.GType, uint) int
852
853func TypeAddInstancePrivate(ClassTypeVar types.GType, PrivateSizeVar uint) int {
854
855	cret := xTypeAddInstancePrivate(ClassTypeVar, PrivateSizeVar)
856	return cret
857}
858
859var xTypeAddInterfaceCheck func(uintptr, uintptr)
860
861// Adds a function to be called after an interface vtable is
862// initialized for any class (i.e. after the @interface_init
863// member of #GInterfaceInfo has been called).
864//
865// This function is useful when you want to check an invariant
866// that depends on the interfaces of a class. For instance, the
867// implementation of #GObject uses this facility to check that an
868// object implements all of the properties that are defined on its
869// interfaces.
870func TypeAddInterfaceCheck(CheckDataVar uintptr, CheckFuncVar *TypeInterfaceCheckFunc) {
871
872	var CheckFuncVarRef uintptr
873	if CheckFuncVar != nil {
874		CheckFuncVarPtr := uintptr(unsafe.Pointer(CheckFuncVar))
875		if cbRefPtr, ok := glib.GetCallback(CheckFuncVarPtr); ok {
876			CheckFuncVarRef = cbRefPtr
877		} else {
878			fcb := func(arg0 uintptr, arg1 *TypeInterface) {
879				cbFn := *CheckFuncVar
880				cbFn(arg0, arg1)
881			}
882			CheckFuncVarRef = purego.NewCallback(fcb)
883			glib.SaveCallbackWithClosure(CheckFuncVarPtr, CheckFuncVarRef, CheckFuncVar)
884		}
885	}
886
887	xTypeAddInterfaceCheck(CheckDataVar, CheckFuncVarRef)
888
889}
890
891var xTypeAddInterfaceDynamic func(types.GType, types.GType, uintptr)
892
893// Adds @interface_type to the dynamic @instance_type. The information
894// contained in the #GTypePlugin structure pointed to by @plugin
895// is used to manage the relationship.
896func TypeAddInterfaceDynamic(InstanceTypeVar types.GType, InterfaceTypeVar types.GType, PluginVar TypePlugin) {
897
898	xTypeAddInterfaceDynamic(InstanceTypeVar, InterfaceTypeVar, PluginVar.GoPointer())
899
900}
901
902var xTypeAddInterfaceStatic func(types.GType, types.GType, *InterfaceInfo)
903
904// Adds @interface_type to the static @instance_type.
905// The information contained in the #GInterfaceInfo structure
906// pointed to by @info is used to manage the relationship.
907func TypeAddInterfaceStatic(InstanceTypeVar types.GType, InterfaceTypeVar types.GType, InfoVar *InterfaceInfo) {
908
909	xTypeAddInterfaceStatic(InstanceTypeVar, InterfaceTypeVar, InfoVar)
910
911}
912
913var xTypeCheckClassCast func(*TypeClass, types.GType) *TypeClass
914
915func TypeCheckClassCast(GClassVar *TypeClass, IsATypeVar types.GType) *TypeClass {
916
917	cret := xTypeCheckClassCast(GClassVar, IsATypeVar)
918	return cret
919}
920
921var xTypeCheckClassIsA func(*TypeClass, types.GType) bool
922
923func TypeCheckClassIsA(GClassVar *TypeClass, IsATypeVar types.GType) bool {
924
925	cret := xTypeCheckClassIsA(GClassVar, IsATypeVar)
926	return cret
927}
928
929var xTypeCheckInstance func(*TypeInstance) bool
930
931// Private helper function to aid implementation of the
932// G_TYPE_CHECK_INSTANCE() macro.
933func TypeCheckInstance(InstanceVar *TypeInstance) bool {
934
935	cret := xTypeCheckInstance(InstanceVar)
936	return cret
937}
938
939var xTypeCheckInstanceCast func(*TypeInstance, types.GType) *TypeInstance
940
941func TypeCheckInstanceCast(InstanceVar *TypeInstance, IfaceTypeVar types.GType) *TypeInstance {
942
943	cret := xTypeCheckInstanceCast(InstanceVar, IfaceTypeVar)
944	return cret
945}
946
947var xTypeCheckInstanceIsA func(*TypeInstance, types.GType) bool
948
949func TypeCheckInstanceIsA(InstanceVar *TypeInstance, IfaceTypeVar types.GType) bool {
950
951	cret := xTypeCheckInstanceIsA(InstanceVar, IfaceTypeVar)
952	return cret
953}
954
955var xTypeCheckInstanceIsFundamentallyA func(*TypeInstance, types.GType) bool
956
957func TypeCheckInstanceIsFundamentallyA(InstanceVar *TypeInstance, FundamentalTypeVar types.GType) bool {
958
959	cret := xTypeCheckInstanceIsFundamentallyA(InstanceVar, FundamentalTypeVar)
960	return cret
961}
962
963var xTypeCheckIsValueType func(types.GType) bool
964
965func TypeCheckIsValueType(TypeVar types.GType) bool {
966
967	cret := xTypeCheckIsValueType(TypeVar)
968	return cret
969}
970
971var xTypeCheckValue func(*Value) bool
972
973func TypeCheckValue(ValueVar *Value) bool {
974
975	cret := xTypeCheckValue(ValueVar)
976	return cret
977}
978
979var xTypeCheckValueHolds func(*Value, types.GType) bool
980
981func TypeCheckValueHolds(ValueVar *Value, TypeVar types.GType) bool {
982
983	cret := xTypeCheckValueHolds(ValueVar, TypeVar)
984	return cret
985}
986
987var xTypeChildren func(types.GType, *uint) uintptr
988
989// Return a newly allocated and 0-terminated array of type IDs, listing
990// the child types of @type.
991func TypeChildren(TypeVar types.GType, NChildrenVar *uint) uintptr {
992
993	cret := xTypeChildren(TypeVar, NChildrenVar)
994	return cret
995}
996
997var xTypeClassAdjustPrivateOffset func(uintptr, int)
998
999func TypeClassAdjustPrivateOffset(GClassVar uintptr, PrivateSizeOrOffsetVar int) {
1000
1001	xTypeClassAdjustPrivateOffset(GClassVar, PrivateSizeOrOffsetVar)
1002
1003}
1004
1005var xTypeClassGet func(types.GType) *TypeClass
1006
1007// Retrieves the type class of the given @type.
1008//
1009// This function will create the class on demand if it does not exist
1010// already.
1011//
1012// If you don't want to create the class, use g_type_class_peek() instead.
1013func TypeClassGet(TypeVar types.GType) *TypeClass {
1014
1015	cret := xTypeClassGet(TypeVar)
1016	return cret
1017}
1018
1019var xTypeClassPeek func(types.GType) *TypeClass
1020
1021// Retrieves the class for a give type.
1022//
1023// This function is essentially the same as g_type_class_get(),
1024// except that the class may have not been instantiated yet.
1025//
1026// As a consequence, this function may return %NULL if the class
1027// of the type passed in does not currently exist (hasn't been
1028// referenced before).
1029func TypeClassPeek(TypeVar types.GType) *TypeClass {
1030
1031	cret := xTypeClassPeek(TypeVar)
1032	return cret
1033}
1034
1035var xTypeClassPeekStatic func(types.GType) *TypeClass
1036
1037// A more efficient version of g_type_class_peek() which works only for
1038// static types.
1039func TypeClassPeekStatic(TypeVar types.GType) *TypeClass {
1040
1041	cret := xTypeClassPeekStatic(TypeVar)
1042	return cret
1043}
1044
1045var xTypeCreateInstance func(types.GType) *TypeInstance
1046
1047// Creates and initializes an instance of @type if @type is valid and
1048// can be instantiated. The type system only performs basic allocation
1049// and structure setups for instances: actual instance creation should
1050// happen through functions supplied by the type's fundamental type
1051// implementation.  So use of g_type_create_instance() is reserved for
1052// implementers of fundamental types only. E.g. instances of the
1053// #GObject hierarchy should be created via g_object_new() and never
1054// directly through g_type_create_instance() which doesn't handle things
1055// like singleton objects or object construction.
1056//
1057// The extended members of the returned instance are guaranteed to be filled
1058// with zeros.
1059//
1060// Note: Do not use this function, unless you're implementing a
1061// fundamental type. Also language bindings should not use this
1062// function, but g_object_new() instead.
1063func TypeCreateInstance(TypeVar types.GType) *TypeInstance {
1064
1065	cret := xTypeCreateInstance(TypeVar)
1066	return cret
1067}
1068
1069var xTypeDefaultInterfaceGet func(types.GType) *TypeInterface
1070
1071// Returns the default interface vtable for the given @g_type.
1072//
1073// If the type is not currently in use, then the default vtable
1074// for the type will be created and initialized by calling
1075// the base interface init and default vtable init functions for
1076// the type (the @base_init and @class_init members of #GTypeInfo).
1077//
1078// If you don't want to create the interface vtable, you should use
1079// g_type_default_interface_peek() instead.
1080//
1081// Calling g_type_default_interface_get() is useful when you
1082// want to make sure that signals and properties for an interface
1083// have been installed.
1084func TypeDefaultInterfaceGet(GTypeVar types.GType) *TypeInterface {
1085
1086	cret := xTypeDefaultInterfaceGet(GTypeVar)
1087	return cret
1088}
1089
1090var xTypeDefaultInterfacePeek func(types.GType) *TypeInterface
1091
1092// If the interface type @g_type is currently in use, returns its
1093// default interface vtable.
1094func TypeDefaultInterfacePeek(GTypeVar types.GType) *TypeInterface {
1095
1096	cret := xTypeDefaultInterfacePeek(GTypeVar)
1097	return cret
1098}
1099
1100var xTypeDefaultInterfaceRef func(types.GType) *TypeInterface
1101
1102// Increments the reference count for the interface type @g_type,
1103// and returns the default interface vtable for the type.
1104//
1105// If the type is not currently in use, then the default vtable
1106// for the type will be created and initialized by calling
1107// the base interface init and default vtable init functions for
1108// the type (the @base_init and @class_init members of #GTypeInfo).
1109// Calling g_type_default_interface_ref() is useful when you
1110// want to make sure that signals and properties for an interface
1111// have been installed.
1112func TypeDefaultInterfaceRef(GTypeVar types.GType) *TypeInterface {
1113
1114	cret := xTypeDefaultInterfaceRef(GTypeVar)
1115	return cret
1116}
1117
1118var xTypeDefaultInterfaceUnref func(*TypeInterface)
1119
1120// Decrements the reference count for the type corresponding to the
1121// interface default vtable @g_iface.
1122//
1123// If the type is dynamic, then when no one is using the interface and all
1124// references have been released, the finalize function for the interface's
1125// default vtable (the @class_finalize member of #GTypeInfo) will be called.
1126func TypeDefaultInterfaceUnref(GIfaceVar *TypeInterface) {
1127
1128	xTypeDefaultInterfaceUnref(GIfaceVar)
1129
1130}
1131
1132var xTypeDepth func(types.GType) uint
1133
1134// Returns the length of the ancestry of the passed in type. This
1135// includes the type itself, so that e.g. a fundamental type has depth 1.
1136func TypeDepth(TypeVar types.GType) uint {
1137
1138	cret := xTypeDepth(TypeVar)
1139	return cret
1140}
1141
1142var xTypeEnsure func(types.GType)
1143
1144// Ensures that the indicated @type has been registered with the
1145// type system, and its _class_init() method has been run.
1146//
1147// In theory, simply calling the type's _get_type() method (or using
1148// the corresponding macro) is supposed take care of this. However,
1149// _get_type() methods are often marked %G_GNUC_CONST for performance
1150// reasons, even though this is technically incorrect (since
1151// %G_GNUC_CONST requires that the function not have side effects,
1152// which _get_type() methods do on the first call). As a result, if
1153// you write a bare call to a _get_type() macro, it may get optimized
1154// out by the compiler. Using g_type_ensure() guarantees that the
1155// type's _get_type() method is called.
1156func TypeEnsure(TypeVar types.GType) {
1157
1158	xTypeEnsure(TypeVar)
1159
1160}
1161
1162var xTypeFreeInstance func(*TypeInstance)
1163
1164// Frees an instance of a type, returning it to the instance pool for
1165// the type, if there is one.
1166//
1167// Like g_type_create_instance(), this function is reserved for
1168// implementors of fundamental types.
1169func TypeFreeInstance(InstanceVar *TypeInstance) {
1170
1171	xTypeFreeInstance(InstanceVar)
1172
1173}
1174
1175var xTypeFromName func(string) types.GType
1176
1177// Look up the type ID from a given type name, returning 0 if no type
1178// has been registered under this name (this is the preferred method
1179// to find out by name whether a specific type has been registered
1180// yet).
1181func TypeFromName(NameVar string) types.GType {
1182
1183	cret := xTypeFromName(NameVar)
1184	return cret
1185}
1186
1187var xTypeFundamental func(types.GType) types.GType
1188
1189// Internal function, used to extract the fundamental type ID portion.
1190// Use G_TYPE_FUNDAMENTAL() instead.
1191func TypeFundamental(TypeIdVar types.GType) types.GType {
1192
1193	cret := xTypeFundamental(TypeIdVar)
1194	return cret
1195}
1196
1197var xTypeFundamentalNext func() types.GType
1198
1199// Returns the next free fundamental type id which can be used to
1200// register a new fundamental type with g_type_register_fundamental().
1201// The returned type ID represents the highest currently registered
1202// fundamental type identifier.
1203func TypeFundamentalNext() types.GType {
1204
1205	cret := xTypeFundamentalNext()
1206	return cret
1207}
1208
1209var xTypeGetInstanceCount func(types.GType) int
1210
1211// Returns the number of instances allocated of the particular type;
1212// this is only available if GLib is built with debugging support and
1213// the `instance-count` debug flag is set (by setting the `GOBJECT_DEBUG`
1214// variable to include `instance-count`).
1215func TypeGetInstanceCount(TypeVar types.GType) int {
1216
1217	cret := xTypeGetInstanceCount(TypeVar)
1218	return cret
1219}
1220
1221var xTypeGetPlugin func(types.GType) uintptr
1222
1223// Returns the #GTypePlugin structure for @type.
1224func TypeGetPlugin(TypeVar types.GType) *TypePluginBase {
1225	var cls *TypePluginBase
1226
1227	cret := xTypeGetPlugin(TypeVar)
1228
1229	if cret == 0 {
1230		return nil
1231	}
1232	IncreaseRef(cret)
1233	cls = &TypePluginBase{}
1234	cls.Ptr = cret
1235	return cls
1236}
1237
1238var xTypeGetQdata func(types.GType, glib.Quark) uintptr
1239
1240// Obtains data which has previously been attached to @type
1241// with g_type_set_qdata().
1242//
1243// Note that this does not take subtyping into account; data
1244// attached to one type with g_type_set_qdata() cannot
1245// be retrieved from a subtype using g_type_get_qdata().
1246func TypeGetQdata(TypeVar types.GType, QuarkVar glib.Quark) uintptr {
1247
1248	cret := xTypeGetQdata(TypeVar, QuarkVar)
1249	return cret
1250}
1251
1252var xTypeGetTypeRegistrationSerial func() uint
1253
1254// Returns an opaque serial number that represents the state of the set
1255// of registered types. Any time a type is registered this serial changes,
1256// which means you can cache information based on type lookups (such as
1257// g_type_from_name()) and know if the cache is still valid at a later
1258// time by comparing the current serial with the one at the type lookup.
1259func TypeGetTypeRegistrationSerial() uint {
1260
1261	cret := xTypeGetTypeRegistrationSerial()
1262	return cret
1263}
1264
1265var xTypeInit func()
1266
1267// This function used to initialise the type system.  Since GLib 2.36,
1268// the type system is initialised automatically and this function does
1269// nothing.
1270func TypeInit() {
1271
1272	xTypeInit()
1273
1274}
1275
1276var xTypeInitWithDebugFlags func(TypeDebugFlags)
1277
1278// This function used to initialise the type system with debugging
1279// flags.  Since GLib 2.36, the type system is initialised automatically
1280// and this function does nothing.
1281//
1282// If you need to enable debugging features, use the `GOBJECT_DEBUG`
1283// environment variable.
1284func TypeInitWithDebugFlags(DebugFlagsVar TypeDebugFlags) {
1285
1286	xTypeInitWithDebugFlags(DebugFlagsVar)
1287
1288}
1289
1290var xTypeInterfaceAddPrerequisite func(types.GType, types.GType)
1291
1292// Adds @prerequisite_type to the list of prerequisites of @interface_type.
1293// This means that any type implementing @interface_type must also implement
1294// @prerequisite_type. Prerequisites can be thought of as an alternative to
1295// interface derivation (which GType doesn't support). An interface can have
1296// at most one instantiatable prerequisite type.
1297func TypeInterfaceAddPrerequisite(InterfaceTypeVar types.GType, PrerequisiteTypeVar types.GType) {
1298
1299	xTypeInterfaceAddPrerequisite(InterfaceTypeVar, PrerequisiteTypeVar)
1300
1301}
1302
1303var xTypeInterfaceGetPlugin func(types.GType, types.GType) uintptr
1304
1305// Returns the #GTypePlugin structure for the dynamic interface
1306// @interface_type which has been added to @instance_type, or %NULL
1307// if @interface_type has not been added to @instance_type or does
1308// not have a #GTypePlugin structure. See g_type_add_interface_dynamic().
1309func TypeInterfaceGetPlugin(InstanceTypeVar types.GType, InterfaceTypeVar types.GType) *TypePluginBase {
1310	var cls *TypePluginBase
1311
1312	cret := xTypeInterfaceGetPlugin(InstanceTypeVar, InterfaceTypeVar)
1313
1314	if cret == 0 {
1315		return nil
1316	}
1317	IncreaseRef(cret)
1318	cls = &TypePluginBase{}
1319	cls.Ptr = cret
1320	return cls
1321}
1322
1323var xTypeInterfaceInstantiatablePrerequisite func(types.GType) types.GType
1324
1325// Returns the most specific instantiatable prerequisite of an
1326// interface type. If the interface type has no instantiatable
1327// prerequisite, %G_TYPE_INVALID is returned.
1328//
1329// See g_type_interface_add_prerequisite() for more information
1330// about prerequisites.
1331func TypeInterfaceInstantiatablePrerequisite(InterfaceTypeVar types.GType) types.GType {
1332
1333	cret := xTypeInterfaceInstantiatablePrerequisite(InterfaceTypeVar)
1334	return cret
1335}
1336
1337var xTypeInterfacePeek func(*TypeClass, types.GType) *TypeInterface
1338
1339// Returns the #GTypeInterface structure of an interface to which the
1340// passed in class conforms.
1341func TypeInterfacePeek(InstanceClassVar *TypeClass, IfaceTypeVar types.GType) *TypeInterface {
1342
1343	cret := xTypeInterfacePeek(InstanceClassVar, IfaceTypeVar)
1344	return cret
1345}
1346
1347var xTypeInterfacePrerequisites func(types.GType, *uint) uintptr
1348
1349// Returns the prerequisites of an interfaces type.
1350func TypeInterfacePrerequisites(InterfaceTypeVar types.GType, NPrerequisitesVar *uint) uintptr {
1351
1352	cret := xTypeInterfacePrerequisites(InterfaceTypeVar, NPrerequisitesVar)
1353	return cret
1354}
1355
1356var xTypeInterfaces func(types.GType, *uint) uintptr
1357
1358// Return a newly allocated and 0-terminated array of type IDs, listing
1359// the interface types that @type conforms to.
1360func TypeInterfaces(TypeVar types.GType, NInterfacesVar *uint) uintptr {
1361
1362	cret := xTypeInterfaces(TypeVar, NInterfacesVar)
1363	return cret
1364}
1365
1366var xTypeIsA func(types.GType, types.GType) bool
1367
1368// If @is_a_type is a derivable type, check whether @type is a
1369// descendant of @is_a_type. If @is_a_type is an interface, check
1370// whether @type conforms to it.
1371func TypeIsA(TypeVar types.GType, IsATypeVar types.GType) bool {
1372
1373	cret := xTypeIsA(TypeVar, IsATypeVar)
1374	return cret
1375}
1376
1377var xTypeName func(types.GType) string
1378
1379// Get the unique name that is assigned to a type ID.
1380//
1381// Note that this function (like all other GType API) cannot cope with
1382// invalid type IDs. %G_TYPE_INVALID may be passed to this function, as
1383// may be any other validly registered type ID, but randomized type IDs
1384// should not be passed in and will most likely lead to a crash.
1385func TypeName(TypeVar types.GType) string {
1386
1387	cret := xTypeName(TypeVar)
1388	return cret
1389}
1390
1391var xTypeNameFromClass func(*TypeClass) string
1392
1393func TypeNameFromClass(GClassVar *TypeClass) string {
1394
1395	cret := xTypeNameFromClass(GClassVar)
1396	return cret
1397}
1398
1399var xTypeNameFromInstance func(*TypeInstance) string
1400
1401func TypeNameFromInstance(InstanceVar *TypeInstance) string {
1402
1403	cret := xTypeNameFromInstance(InstanceVar)
1404	return cret
1405}
1406
1407var xTypeNextBase func(types.GType, types.GType) types.GType
1408
1409// Given a @leaf_type and a @root_type which is contained in its
1410// ancestry, return the type that @root_type is the immediate parent
1411// of. In other words, this function determines the type that is
1412// derived directly from @root_type which is also a base class of
1413// @leaf_type.  Given a root type and a leaf type, this function can
1414// be used to determine the types and order in which the leaf type is
1415// descended from the root type.
1416func TypeNextBase(LeafTypeVar types.GType, RootTypeVar types.GType) types.GType {
1417
1418	cret := xTypeNextBase(LeafTypeVar, RootTypeVar)
1419	return cret
1420}
1421
1422var xTypeParent func(types.GType) types.GType
1423
1424// Return the direct parent type of the passed in type. If the passed
1425// in type has no parent, i.e. is a fundamental type, 0 is returned.
1426func TypeParent(TypeVar types.GType) types.GType {
1427
1428	cret := xTypeParent(TypeVar)
1429	return cret
1430}
1431
1432var xTypeQname func(types.GType) glib.Quark
1433
1434// Get the corresponding quark of the type IDs name.
1435func TypeQname(TypeVar types.GType) glib.Quark {
1436
1437	cret := xTypeQname(TypeVar)
1438	return cret
1439}
1440
1441var xNewTypeQuery func(types.GType, *TypeQuery)
1442
1443// Queries the type system for information about a specific type.
1444//
1445// This function will fill in a user-provided structure to hold
1446// type-specific information. If an invalid #GType is passed in, the
1447// @type member of the #GTypeQuery is 0. All members filled into the
1448// #GTypeQuery structure should be considered constant and have to be
1449// left untouched.
1450//
1451// Since GLib 2.78, this function allows queries on dynamic types. Previously
1452// it only supported static types.
1453func NewTypeQuery(TypeVar types.GType, QueryVar *TypeQuery) {
1454
1455	xNewTypeQuery(TypeVar, QueryVar)
1456
1457}
1458
1459var xTypeRegisterDynamic func(types.GType, string, uintptr, TypeFlags) types.GType
1460
1461// Registers @type_name as the name of a new dynamic type derived from
1462// @parent_type.  The type system uses the information contained in the
1463// #GTypePlugin structure pointed to by @plugin to manage the type and its
1464// instances (if not abstract).  The value of @flags determines the nature
1465// (e.g. abstract or not) of the type.
1466func TypeRegisterDynamic(ParentTypeVar types.GType, TypeNameVar string, PluginVar TypePlugin, FlagsVar TypeFlags) types.GType {
1467
1468	cret := xTypeRegisterDynamic(ParentTypeVar, TypeNameVar, PluginVar.GoPointer(), FlagsVar)
1469	return cret
1470}
1471
1472var xTypeRegisterFundamental func(types.GType, string, *TypeInfo, *TypeFundamentalInfo, TypeFlags) types.GType
1473
1474// Registers @type_id as the predefined identifier and @type_name as the
1475// name of a fundamental type. If @type_id is already registered, or a
1476// type named @type_name is already registered, the behaviour is undefined.
1477// The type system uses the information contained in the #GTypeInfo structure
1478// pointed to by @info and the #GTypeFundamentalInfo structure pointed to by
1479// @finfo to manage the type and its instances. The value of @flags determines
1480// additional characteristics of the fundamental type.
1481func TypeRegisterFundamental(TypeIdVar types.GType, TypeNameVar string, InfoVar *TypeInfo, FinfoVar *TypeFundamentalInfo, FlagsVar TypeFlags) types.GType {
1482
1483	cret := xTypeRegisterFundamental(TypeIdVar, TypeNameVar, InfoVar, FinfoVar, FlagsVar)
1484	return cret
1485}
1486
1487var xTypeRegisterStatic func(types.GType, string, *TypeInfo, TypeFlags) types.GType
1488
1489// Registers @type_name as the name of a new static type derived from
1490// @parent_type. The type system uses the information contained in the
1491// #GTypeInfo structure pointed to by @info to manage the type and its
1492// instances (if not abstract). The value of @flags determines the nature
1493// (e.g. abstract or not) of the type.
1494func TypeRegisterStatic(ParentTypeVar types.GType, TypeNameVar string, InfoVar *TypeInfo, FlagsVar TypeFlags) types.GType {
1495
1496	cret := xTypeRegisterStatic(ParentTypeVar, TypeNameVar, InfoVar, FlagsVar)
1497	return cret
1498}
1499
1500var xTypeRegisterStaticSimple func(types.GType, string, uint, uintptr, uint, uintptr, TypeFlags) types.GType
1501
1502// Registers @type_name as the name of a new static type derived from
1503// @parent_type.  The value of @flags determines the nature (e.g.
1504// abstract or not) of the type. It works by filling a #GTypeInfo
1505// struct and calling g_type_register_static().
1506func TypeRegisterStaticSimple(ParentTypeVar types.GType, TypeNameVar string, ClassSizeVar uint, ClassInitVar *ClassInitFunc, InstanceSizeVar uint, InstanceInitVar *InstanceInitFunc, FlagsVar TypeFlags) types.GType {
1507
1508	var ClassInitVarRef uintptr
1509	if ClassInitVar != nil {
1510		ClassInitVarPtr := uintptr(unsafe.Pointer(ClassInitVar))
1511		if cbRefPtr, ok := glib.GetCallback(ClassInitVarPtr); ok {
1512			ClassInitVarRef = cbRefPtr
1513		} else {
1514			fcb := func(arg0 *TypeClass, arg1 uintptr) {
1515				cbFn := *ClassInitVar
1516				cbFn(arg0, arg1)
1517			}
1518			ClassInitVarRef = purego.NewCallback(fcb)
1519			glib.SaveCallbackWithClosure(ClassInitVarPtr, ClassInitVarRef, ClassInitVar)
1520		}
1521	}
1522
1523	var InstanceInitVarRef uintptr
1524	if InstanceInitVar != nil {
1525		InstanceInitVarPtr := uintptr(unsafe.Pointer(InstanceInitVar))
1526		if cbRefPtr, ok := glib.GetCallback(InstanceInitVarPtr); ok {
1527			InstanceInitVarRef = cbRefPtr
1528		} else {
1529			fcb := func(arg0 *TypeInstance, arg1 *TypeClass) {
1530				cbFn := *InstanceInitVar
1531				cbFn(arg0, arg1)
1532			}
1533			InstanceInitVarRef = purego.NewCallback(fcb)
1534			glib.SaveCallbackWithClosure(InstanceInitVarPtr, InstanceInitVarRef, InstanceInitVar)
1535		}
1536	}
1537
1538	cret := xTypeRegisterStaticSimple(ParentTypeVar, TypeNameVar, ClassSizeVar, ClassInitVarRef, InstanceSizeVar, InstanceInitVarRef, FlagsVar)
1539	return cret
1540}
1541
1542var xTypeRemoveClassCacheFunc func(uintptr, uintptr)
1543
1544// Removes a previously installed #GTypeClassCacheFunc. The cache
1545// maintained by @cache_func has to be empty when calling
1546// g_type_remove_class_cache_func() to avoid leaks.
1547func TypeRemoveClassCacheFunc(CacheDataVar uintptr, CacheFuncVar *TypeClassCacheFunc) {
1548
1549	var CacheFuncVarRef uintptr
1550	if CacheFuncVar != nil {
1551		CacheFuncVarPtr := uintptr(unsafe.Pointer(CacheFuncVar))
1552		if cbRefPtr, ok := glib.GetCallback(CacheFuncVarPtr); ok {
1553			CacheFuncVarRef = cbRefPtr
1554		} else {
1555			fcb := func(arg0 uintptr, arg1 *TypeClass) bool {
1556				cbFn := *CacheFuncVar
1557				return cbFn(arg0, arg1)
1558			}
1559			CacheFuncVarRef = purego.NewCallback(fcb)
1560			glib.SaveCallbackWithClosure(CacheFuncVarPtr, CacheFuncVarRef, CacheFuncVar)
1561		}
1562	}
1563
1564	xTypeRemoveClassCacheFunc(CacheDataVar, CacheFuncVarRef)
1565
1566}
1567
1568var xTypeRemoveInterfaceCheck func(uintptr, uintptr)
1569
1570// Removes an interface check function added with
1571// g_type_add_interface_check().
1572func TypeRemoveInterfaceCheck(CheckDataVar uintptr, CheckFuncVar *TypeInterfaceCheckFunc) {
1573
1574	var CheckFuncVarRef uintptr
1575	if CheckFuncVar != nil {
1576		CheckFuncVarPtr := uintptr(unsafe.Pointer(CheckFuncVar))
1577		if cbRefPtr, ok := glib.GetCallback(CheckFuncVarPtr); ok {
1578			CheckFuncVarRef = cbRefPtr
1579		} else {
1580			fcb := func(arg0 uintptr, arg1 *TypeInterface) {
1581				cbFn := *CheckFuncVar
1582				cbFn(arg0, arg1)
1583			}
1584			CheckFuncVarRef = purego.NewCallback(fcb)
1585			glib.SaveCallbackWithClosure(CheckFuncVarPtr, CheckFuncVarRef, CheckFuncVar)
1586		}
1587	}
1588
1589	xTypeRemoveInterfaceCheck(CheckDataVar, CheckFuncVarRef)
1590
1591}
1592
1593var xTypeSetQdata func(types.GType, glib.Quark, uintptr)
1594
1595// Attaches arbitrary data to a type.
1596func TypeSetQdata(TypeVar types.GType, QuarkVar glib.Quark, DataVar uintptr) {
1597
1598	xTypeSetQdata(TypeVar, QuarkVar, DataVar)
1599
1600}
1601
1602var xTypeTestFlags func(types.GType, uint) bool
1603
1604func TypeTestFlags(TypeVar types.GType, FlagsVar uint) bool {
1605
1606	cret := xTypeTestFlags(TypeVar, FlagsVar)
1607	return cret
1608}
1609
1610var xTypeValueTablePeek func(types.GType) *TypeValueTable
1611
1612// Returns the location of the #GTypeValueTable associated with @type.
1613//
1614// Note that this function should only be used from source code
1615// that implements or has internal knowledge of the implementation of
1616// @type.
1617func TypeValueTablePeek(TypeVar types.GType) *TypeValueTable {
1618
1619	cret := xTypeValueTablePeek(TypeVar)
1620	return cret
1621}
1622
1623func init() {
1624	core.SetPackageName("GOBJECT", "gobject-2.0")
1625	core.SetSharedLibraries("GOBJECT", []string{"libgobject-2.0.so.0"})
1626	var libs []uintptr
1627	for _, libPath := range core.GetPaths("GOBJECT") {
1628		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1629		if err != nil {
1630			panic(err)
1631		}
1632		libs = append(libs, lib)
1633	}
1634
1635	core.PuregoSafeRegister(&xTypeAddClassCacheFunc, libs, "g_type_add_class_cache_func")
1636	core.PuregoSafeRegister(&xTypeAddClassPrivate, libs, "g_type_add_class_private")
1637	core.PuregoSafeRegister(&xTypeAddInstancePrivate, libs, "g_type_add_instance_private")
1638	core.PuregoSafeRegister(&xTypeAddInterfaceCheck, libs, "g_type_add_interface_check")
1639	core.PuregoSafeRegister(&xTypeAddInterfaceDynamic, libs, "g_type_add_interface_dynamic")
1640	core.PuregoSafeRegister(&xTypeAddInterfaceStatic, libs, "g_type_add_interface_static")
1641	core.PuregoSafeRegister(&xTypeCheckClassCast, libs, "g_type_check_class_cast")
1642	core.PuregoSafeRegister(&xTypeCheckClassIsA, libs, "g_type_check_class_is_a")
1643	core.PuregoSafeRegister(&xTypeCheckInstance, libs, "g_type_check_instance")
1644	core.PuregoSafeRegister(&xTypeCheckInstanceCast, libs, "g_type_check_instance_cast")
1645	core.PuregoSafeRegister(&xTypeCheckInstanceIsA, libs, "g_type_check_instance_is_a")
1646	core.PuregoSafeRegister(&xTypeCheckInstanceIsFundamentallyA, libs, "g_type_check_instance_is_fundamentally_a")
1647	core.PuregoSafeRegister(&xTypeCheckIsValueType, libs, "g_type_check_is_value_type")
1648	core.PuregoSafeRegister(&xTypeCheckValue, libs, "g_type_check_value")
1649	core.PuregoSafeRegister(&xTypeCheckValueHolds, libs, "g_type_check_value_holds")
1650	core.PuregoSafeRegister(&xTypeChildren, libs, "g_type_children")
1651	core.PuregoSafeRegister(&xTypeClassAdjustPrivateOffset, libs, "g_type_class_adjust_private_offset")
1652	core.PuregoSafeRegister(&xTypeClassGet, libs, "g_type_class_get")
1653	core.PuregoSafeRegister(&xTypeClassPeek, libs, "g_type_class_peek")
1654	core.PuregoSafeRegister(&xTypeClassPeekStatic, libs, "g_type_class_peek_static")
1655	core.PuregoSafeRegister(&xTypeCreateInstance, libs, "g_type_create_instance")
1656	core.PuregoSafeRegister(&xTypeDefaultInterfaceGet, libs, "g_type_default_interface_get")
1657	core.PuregoSafeRegister(&xTypeDefaultInterfacePeek, libs, "g_type_default_interface_peek")
1658	core.PuregoSafeRegister(&xTypeDefaultInterfaceRef, libs, "g_type_default_interface_ref")
1659	core.PuregoSafeRegister(&xTypeDefaultInterfaceUnref, libs, "g_type_default_interface_unref")
1660	core.PuregoSafeRegister(&xTypeDepth, libs, "g_type_depth")
1661	core.PuregoSafeRegister(&xTypeEnsure, libs, "g_type_ensure")
1662	core.PuregoSafeRegister(&xTypeFreeInstance, libs, "g_type_free_instance")
1663	core.PuregoSafeRegister(&xTypeFromName, libs, "g_type_from_name")
1664	core.PuregoSafeRegister(&xTypeFundamental, libs, "g_type_fundamental")
1665	core.PuregoSafeRegister(&xTypeFundamentalNext, libs, "g_type_fundamental_next")
1666	core.PuregoSafeRegister(&xTypeGetInstanceCount, libs, "g_type_get_instance_count")
1667	core.PuregoSafeRegister(&xTypeGetPlugin, libs, "g_type_get_plugin")
1668	core.PuregoSafeRegister(&xTypeGetQdata, libs, "g_type_get_qdata")
1669	core.PuregoSafeRegister(&xTypeGetTypeRegistrationSerial, libs, "g_type_get_type_registration_serial")
1670	core.PuregoSafeRegister(&xTypeInit, libs, "g_type_init")
1671	core.PuregoSafeRegister(&xTypeInitWithDebugFlags, libs, "g_type_init_with_debug_flags")
1672	core.PuregoSafeRegister(&xTypeInterfaceAddPrerequisite, libs, "g_type_interface_add_prerequisite")
1673	core.PuregoSafeRegister(&xTypeInterfaceGetPlugin, libs, "g_type_interface_get_plugin")
1674	core.PuregoSafeRegister(&xTypeInterfaceInstantiatablePrerequisite, libs, "g_type_interface_instantiatable_prerequisite")
1675	core.PuregoSafeRegister(&xTypeInterfacePeek, libs, "g_type_interface_peek")
1676	core.PuregoSafeRegister(&xTypeInterfacePrerequisites, libs, "g_type_interface_prerequisites")
1677	core.PuregoSafeRegister(&xTypeInterfaces, libs, "g_type_interfaces")
1678	core.PuregoSafeRegister(&xTypeIsA, libs, "g_type_is_a")
1679	core.PuregoSafeRegister(&xTypeName, libs, "g_type_name")
1680	core.PuregoSafeRegister(&xTypeNameFromClass, libs, "g_type_name_from_class")
1681	core.PuregoSafeRegister(&xTypeNameFromInstance, libs, "g_type_name_from_instance")
1682	core.PuregoSafeRegister(&xTypeNextBase, libs, "g_type_next_base")
1683	core.PuregoSafeRegister(&xTypeParent, libs, "g_type_parent")
1684	core.PuregoSafeRegister(&xTypeQname, libs, "g_type_qname")
1685	core.PuregoSafeRegister(&xNewTypeQuery, libs, "g_type_query")
1686	core.PuregoSafeRegister(&xTypeRegisterDynamic, libs, "g_type_register_dynamic")
1687	core.PuregoSafeRegister(&xTypeRegisterFundamental, libs, "g_type_register_fundamental")
1688	core.PuregoSafeRegister(&xTypeRegisterStatic, libs, "g_type_register_static")
1689	core.PuregoSafeRegister(&xTypeRegisterStaticSimple, libs, "g_type_register_static_simple")
1690	core.PuregoSafeRegister(&xTypeRemoveClassCacheFunc, libs, "g_type_remove_class_cache_func")
1691	core.PuregoSafeRegister(&xTypeRemoveInterfaceCheck, libs, "g_type_remove_interface_check")
1692	core.PuregoSafeRegister(&xTypeSetQdata, libs, "g_type_set_qdata")
1693	core.PuregoSafeRegister(&xTypeTestFlags, libs, "g_type_test_flags")
1694	core.PuregoSafeRegister(&xTypeValueTablePeek, libs, "g_type_value_table_peek")
1695
1696	core.PuregoSafeRegister(&xTypeClassAddPrivate, libs, "g_type_class_add_private")
1697	core.PuregoSafeRegister(&xTypeClassGetInstancePrivateOffset, libs, "g_type_class_get_instance_private_offset")
1698	core.PuregoSafeRegister(&xTypeClassGetPrivate, libs, "g_type_class_get_private")
1699	core.PuregoSafeRegister(&xTypeClassPeekParent, libs, "g_type_class_peek_parent")
1700	core.PuregoSafeRegister(&xTypeClassUnref, libs, "g_type_class_unref")
1701	core.PuregoSafeRegister(&xTypeClassUnrefUncached, libs, "g_type_class_unref_uncached")
1702
1703	core.PuregoSafeRegister(&xTypeInstanceGetPrivate, libs, "g_type_instance_get_private")
1704
1705	core.PuregoSafeRegister(&xTypeInterfacePeekParent, libs, "g_type_interface_peek_parent")
1706
1707}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close