1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 Handle run-time type creation.
7 <!-- ##### SECTION Long_Description ##### -->
9 Gtk's type system is extensible. Because of that, types have to be
13 <!-- ##### SECTION See_Also ##### -->
18 <!-- ##### TYPEDEF GtkType ##### -->
20 @GtkType is unique integer identifying the type. The guts of the
21 information about the type is held in a private struct named
26 <!-- ##### ENUM GtkFundamentalType ##### -->
28 @GtkFundamentalType is an enumerated type which lists all the possible
29 fundamental types (e.g. char, uchar, int, long, float, etc).
55 <!-- ##### MACRO GTK_TYPE_NUM_BUILTINS ##### -->
62 <!-- ##### MACRO GTK_TYPE_FLAT_FIRST ##### -->
64 The first "flat" (no struct) enumerated type value.
69 <!-- ##### MACRO GTK_TYPE_FLAT_LAST ##### -->
71 The last "flat" (no struct) enumerated type value.
76 <!-- ##### MACRO GTK_TYPE_STRUCTURED_FIRST ##### -->
78 The first structured enumerated type value.
83 <!-- ##### MACRO GTK_TYPE_STRUCTURED_LAST ##### -->
85 The last structured enumerated type value.
90 <!-- ##### MACRO GTK_TYPE_FUNDAMENTAL_LAST ##### -->
92 The highest-numbered structured or flat enumerated type value.
97 <!-- ##### MACRO GTK_TYPE_FUNDAMENTAL_MAX ##### -->
99 The highest maximum fundamental enumerated type value.
104 <!-- ##### MACRO GTK_STRUCT_OFFSET ##### -->
106 Use in place of offsetof(), which is used if it exists.
109 @struct: The type of the structure.
110 @field: The field within the structure.
113 <!-- ##### MACRO GTK_CHECK_CAST ##### -->
115 Cast the object in @tobj into @cast. If GTK_NO_CHECK_CASTS is
116 defined, just cast it. Otherwise, check to see if we can cast @tobj
120 @tobj: a pointer to a GtkObject.
121 @cast_type: a Gtk type.
125 <!-- ##### MACRO GTK_CHECK_CLASS_CAST ##### -->
127 Cast the object in @tobj into @cast. If GTK_NO_CHECK_CASTS is
128 defined, just cast it. Otherwise, check to see if we can cast @tobj
132 @tclass: a pointer to a GtkClassInitFunc
133 @cast_type: a Gtk type.
137 <!-- ##### MACRO GTK_CHECK_TYPE ##### -->
139 Determines whether @type_object is a type of @otype.
142 @type_object: A GtkTypeObject object.
146 <!-- ##### MACRO GTK_CHECK_CLASS_TYPE ##### -->
148 Determines whether @type_class is a type of @otype.
151 @type_class: A GtkTypeClass class.
155 <!-- ##### MACRO GTK_TYPE_IDENTIFIER ##### -->
157 Hide the name of gtk_identifier_get_type
162 <!-- ##### FUNCTION gtk_identifier_get_type ##### -->
164 Get the type of GtkIdentifier.
167 @Returns: GtkType -- the enumerated type of something.
170 <!-- ##### MACRO GTK_TYPE_MAKE ##### -->
172 Combine a fundemantal type and a sequence number to create a gtk type.
179 <!-- ##### MACRO GTK_FUNDAMENTAL_TYPE ##### -->
181 Convert a gtk type into a fundamental type
187 <!-- ##### MACRO GTK_TYPE_SEQNO ##### -->
189 Convert a gtk type into its sequence number
195 <!-- ##### MACRO GTK_SIGNAL_FUNC ##### -->
197 Just a macroized cast into a GtkSignalFunc
203 <!-- ##### USER_FUNCTION GtkClassInitFunc ##### -->
205 Define a function pointer.
211 <!-- ##### USER_FUNCTION GtkObjectInitFunc ##### -->
213 Define a function pointer.
220 <!-- ##### USER_FUNCTION GtkSignalFunc ##### -->
222 Define a function pointer.
227 <!-- ##### USER_FUNCTION GtkFunction ##### -->
229 Define a function pointer.
236 <!-- ##### USER_FUNCTION GtkDestroyNotify ##### -->
238 Define a function pointer.
244 <!-- ##### USER_FUNCTION GtkCallbackMarshal ##### -->
246 Define a function pointer.
255 <!-- ##### USER_FUNCTION GtkSignalMarshaller ##### -->
257 Define a function pointer.
266 <!-- ##### USER_FUNCTION GtkArgGetFunc ##### -->
268 Define a function pointer. Deprecated.
276 <!-- ##### USER_FUNCTION GtkArgSetFunc ##### -->
278 Define a function pointer. Deprecated.
286 <!-- ##### STRUCT GtkTypeObject ##### -->
288 A GtkTypeObject defines the minimum structure requirements
289 for type instances. Type instances returned from gtk_type_new ()
290 and initialized through a GtkObjectInitFunc need to directly inherit
291 from this structure or at least copy its fields one by one.
296 <!-- ##### STRUCT GtkArg ##### -->
298 This is a structure that we use to pass in typed values (and names).
304 <!-- ##### MACRO GTK_VALUE_CHAR ##### -->
306 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_CHAR
312 <!-- ##### MACRO GTK_VALUE_UCHAR ##### -->
314 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_UCHAR
320 <!-- ##### MACRO GTK_VALUE_BOOL ##### -->
322 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_BOOL
328 <!-- ##### MACRO GTK_VALUE_INT ##### -->
330 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_INT
336 <!-- ##### MACRO GTK_VALUE_UINT ##### -->
338 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_UINT
344 <!-- ##### MACRO GTK_VALUE_LONG ##### -->
346 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_LONG
352 <!-- ##### MACRO GTK_VALUE_ULONG ##### -->
354 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_ULONG
360 <!-- ##### MACRO GTK_VALUE_FLOAT ##### -->
362 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_FLOAT
368 <!-- ##### MACRO GTK_VALUE_DOUBLE ##### -->
370 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_DOUBLE
376 <!-- ##### MACRO GTK_VALUE_STRING ##### -->
378 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_STRING
384 <!-- ##### MACRO GTK_VALUE_ENUM ##### -->
386 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_ENUM
392 <!-- ##### MACRO GTK_VALUE_FLAGS ##### -->
394 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_FLAGS
400 <!-- ##### MACRO GTK_VALUE_BOXED ##### -->
402 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_BOXED
408 <!-- ##### MACRO GTK_VALUE_POINTER ##### -->
410 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_POINTER
416 <!-- ##### MACRO GTK_VALUE_OBJECT ##### -->
418 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_OBJECT
424 <!-- ##### MACRO GTK_VALUE_SIGNAL ##### -->
426 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_SIGNAL
432 <!-- ##### MACRO GTK_VALUE_ARGS ##### -->
434 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_ARGS
440 <!-- ##### MACRO GTK_VALUE_CALLBACK ##### -->
442 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_CALLBACK
448 <!-- ##### MACRO GTK_VALUE_C_CALLBACK ##### -->
450 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_C_CALLBACK
456 <!-- ##### MACRO GTK_VALUE_FOREIGN ##### -->
458 Use to get the value of a GtkArg whose GtkType is GTK_TYPE_C_FOREIGN
464 <!-- ##### MACRO GTK_RETLOC_CHAR ##### -->
466 If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_CHAR
472 <!-- ##### MACRO GTK_RETLOC_UCHAR ##### -->
474 If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_UCHAR
480 <!-- ##### MACRO GTK_RETLOC_BOOL ##### -->
482 If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_BOOL
488 <!-- ##### MACRO GTK_RETLOC_INT ##### -->
490 If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_INT
496 <!-- ##### MACRO GTK_RETLOC_UINT ##### -->
498 If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_UINT
504 <!-- ##### MACRO GTK_RETLOC_LONG ##### -->
506 If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_LONG
512 <!-- ##### MACRO GTK_RETLOC_ULONG ##### -->
514 If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_ULONG
520 <!-- ##### MACRO GTK_RETLOC_FLOAT ##### -->
522 If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_FLOAT
528 <!-- ##### MACRO GTK_RETLOC_DOUBLE ##### -->
530 If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_DOUBLE
536 <!-- ##### MACRO GTK_RETLOC_STRING ##### -->
538 If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_STRING
544 <!-- ##### MACRO GTK_RETLOC_ENUM ##### -->
546 If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_ENUM
552 <!-- ##### MACRO GTK_RETLOC_FLAGS ##### -->
554 If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_FLAGS
560 <!-- ##### MACRO GTK_RETLOC_BOXED ##### -->
562 If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_BOXED
568 <!-- ##### MACRO GTK_RETLOC_POINTER ##### -->
570 If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_POINTER
576 <!-- ##### MACRO GTK_RETLOC_OBJECT ##### -->
578 If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_OBJECT
584 <!-- ##### STRUCT GtkTypeInfo ##### -->
586 Holds information about the type. @gtk_type_name returns the name.
587 @object_size is somehow set to the number of bytes that an instance of
588 the object will occupy. @class_init_func holds the type's
589 initialization function. @object_init_func holds the initialization
590 function for an instance of the object. @reserved_1 is used for
591 GtkEnumValue to hold the enumerated values.
601 @base_class_init_func:
603 <!-- ##### STRUCT GtkTypeQuery ##### -->
605 A structure used to return values from @gtk_type_query.
613 <!-- ##### STRUCT GtkTypeClass ##### -->
615 The base structure for a Gtk Type. Every type inherits this as a base structure.
619 <!-- ##### STRUCT GtkEnumValue ##### -->
621 A structure which contains a single enum value, and its name, and it's
629 <!-- ##### FUNCTION gtk_type_init ##### -->
631 Initialize the data structures associated with gtk types.
636 <!-- ##### FUNCTION gtk_type_unique ##### -->
638 Create a new, unique type.
641 @parent_type: if zero, a fundamental type is created.
642 @type_info: must not be null, and @type_info->type_name must also not be null.
643 @Returns: the new GtkType.
646 <!-- ##### FUNCTION gtk_type_set_chunk_alloc ##### -->
648 Set the mem_chunk size so it will hold @n_chunks of the objects of that @type.
651 @type: There must be an unlocked TypeNode associated with this type otherwise nothing happens.
655 <!-- ##### FUNCTION gtk_type_name ##### -->
660 @Returns: a pointer to the name of a type, or NULL if it has none.
663 <!-- ##### FUNCTION gtk_type_from_name ##### -->
665 Get the internal representation of a type given its name.
668 @name: the name of a gtk type
672 <!-- ##### FUNCTION gtk_type_parent ##### -->
678 @Returns: the GtkType of the parent
681 <!-- ##### FUNCTION gtk_type_class ##### -->
683 Return a gpointer pointing to the class of @type or NULL if there was
684 any trouble identifying @type. Initialize the class if necessary.
688 @Returns: gpointer to the klass.
691 <!-- ##### FUNCTION gtk_type_parent_class ##### -->
693 Return the class of the parent. Initialize the class if necessary.
694 Return NULL if anything goes wrong.
698 @Returns: gpointer to the klass.
701 <!-- ##### FUNCTION gtk_type_children_types ##### -->
703 Return the pointer to the type's children's types.
707 @Returns: pointer to a GList
710 <!-- ##### FUNCTION gtk_type_new ##### -->
712 Create a new object of a given type, and return a gpointer to it.
713 Returns NULL if you give it an invalid type. It allocates the object
714 out of the type's memory chunk if there is a memory chunk. The object
715 has all the proper initializers called.
719 @Returns: gpointer to a GtkTypeObject
722 <!-- ##### FUNCTION gtk_type_free ##### -->
724 Given the type of an object and a pointer to it, the object is freed.
728 @mem: gpointer to the object
731 <!-- ##### FUNCTION gtk_type_describe_heritage ##### -->
733 Print the types @type inherits from.
739 <!-- ##### FUNCTION gtk_type_describe_tree ##### -->
741 Given a @type, describe all of its children, and their children. Only
742 show the size if @show_size is true.
749 <!-- ##### FUNCTION gtk_type_is_a ##### -->
751 Look in the type hierarchy to see if @type has @is_a_type among its
752 ancestors. Do so with a simple lookup, not a loop.
760 <!-- ##### FUNCTION gtk_type_check_object_cast ##### -->
762 Given a pointer to a GtkTypeObject @type_object, and a GtkType @cast_type,
763 make sure that it's okay to cast @type_object into a @cast_type.
766 @type_object: GtkTypeObject*
768 @Returns: the same GtkTypeObject* as @type_object
771 <!-- ##### FUNCTION gtk_type_check_class_cast ##### -->
773 Given a GtkTypeClass pointer @klass, and a GtkType @cast_type, make
774 sure that it's okay to cast something of that @klass into a @cast_type.
777 @klass: GtkTypeClass*
779 @Returns: Always return @klass.
782 <!-- ##### FUNCTION gtk_type_register_enum ##### -->
784 Register a new set of enum @values and give them the name in
788 @type_name: must not be null.
789 @values: GtkEnumValue*
793 <!-- ##### FUNCTION gtk_type_register_flags ##### -->
795 Register a new set of flags @values and give them the name in
799 @type_name: must not be null.
800 @values: GtkFlagValue*
804 <!-- ##### FUNCTION gtk_type_enum_get_values ##### -->
806 If @enum_type has values, then return a pointer to all of them.
810 @Returns: GtkEnumValue*
813 <!-- ##### FUNCTION gtk_type_flags_get_values ##### -->
815 If @flags_type has values, then return a pointer to all of them.
819 @Returns: GtkFlagValue*
822 <!-- ##### FUNCTION gtk_type_enum_find_value ##### -->
824 Return a pointer to one of @enum_type's GtkEnumValues's whose name (or nickname) matches @value_name.
829 @Returns: GtkEnumValue*
832 <!-- ##### FUNCTION gtk_type_flags_find_value ##### -->
834 Return a pointer to one of @flag_type's GtkFlagValue's whose name (or nickname) matches @value_name.
839 @Returns: GtkFlagValue*
842 <!-- ##### FUNCTION gtk_type_set_varargs_type ##### -->
844 Set the varargs type for a fundamental type @foreign_type.
847 @foreign_type: Must be a GtkType with a sequence number of zero. Must not be a
849 @varargs_type: Must be a GtkType which is either structured or flag, or NONE.
852 <!-- ##### FUNCTION gtk_type_get_varargs_type ##### -->
854 Get the varargs type associated with @foreign_type
857 @foreign_type: GtkType
861 <!-- ##### FUNCTION gtk_type_query ##### -->
863 Given a type, return various interesting parameters of the type.
867 @Returns: GtkTypeQuery*