⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gtype.h

📁 windows平台下开发gtk程序所需要的库和头文件等
💻 H
📖 第 1 页 / 共 4 页
字号:
typedef struct _GTypeQuery		GTypeQuery;/* Basic Type Structures *//** * GTypeClass: *  * An opaque structure used as the base of all classes. */struct _GTypeClass{  /*< private >*/  GType g_type;};/** * GTypeInstance: *  * An opaque structure used as the base of all type instances. */struct _GTypeInstance{  /*< private >*/  GTypeClass *g_class;};/** * GTypeInterface: *  * An opaque structure used as the base of all interface types. */struct _GTypeInterface{  /*< private >*/  GType g_type;         /* iface type */  GType g_instance_type;};/** * GTypeQuery: * @type: the #GType value of the type. * @type_name: the name of the type. * @class_size: the size of the class structure. * @instance_size: the size of the instance structure. *  * A structure holding information for a specific type. It is * filled in by the g_type_query() function. */struct _GTypeQuery{  GType		type;  const gchar  *type_name;  guint		class_size;  guint		instance_size;};/* Casts, checks and accessors for structured types * usage of these macros is reserved to type implementations only *//*< protected >*//** * G_TYPE_CHECK_INSTANCE: * @instance: Location of a #GTypeInstance structure. *  * Checks if @instance is a valid #GTypeInstance structure, * otherwise issues a warning and returns %FALSE. *  * This macro should only be used in type implementations. * * Returns: %TRUE on success. */#define G_TYPE_CHECK_INSTANCE(instance)				(_G_TYPE_CHI ((GTypeInstance*) (instance)))/** * G_TYPE_CHECK_INSTANCE_CAST: * @instance: Location of a #GTypeInstance structure. * @g_type: The type to be returned. * @c_type: The corresponding C type of @g_type. *  * Checks that @instance is an instance of the type identified by @g_type * and issues a warning if this is not the case. Returns @instance casted  * to a pointer to @c_type. *  * This macro should only be used in type implementations. */#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type)    (_G_TYPE_CIC ((instance), (g_type), c_type))/** * G_TYPE_CHECK_INSTANCE_TYPE: * @instance: Location of a #GTypeInstance structure. * @g_type: The type to be checked *  * Checks if @instance is an instance of the type identified by @g_type. *  * This macro should only be used in type implementations. * * Returns: %TRUE on success. */#define G_TYPE_CHECK_INSTANCE_TYPE(instance, g_type)            (_G_TYPE_CIT ((instance), (g_type)))/** * G_TYPE_INSTANCE_GET_CLASS: * @instance: Location of the #GTypeInstance structure. * @g_type: The #GType of the class to be returned. * @c_type: The C type of the class structure. *  * Get the class structure of a given @instance, casted * to a specified ancestor type @g_type of the instance. *  * Note that while calling a GInstanceInitFunc(), the class pointer gets * modified, so it might not always return the expected pointer. *  * This macro should only be used in type implementations. * * Returns: a pointer to the class structure */#define G_TYPE_INSTANCE_GET_CLASS(instance, g_type, c_type)     (_G_TYPE_IGC ((instance), (g_type), c_type))/** * G_TYPE_INSTANCE_GET_INTERFACE: * @instance: Location of the #GTypeInstance structure. * @g_type: The #GType of the interface to be returned. * @c_type: The C type of the interface structure. *  * Get the interface structure for interface @g_type of a given @instance. *  * This macro should only be used in type implementations. * * Returns: a pointer to the interface structure */#define G_TYPE_INSTANCE_GET_INTERFACE(instance, g_type, c_type) (_G_TYPE_IGI ((instance), (g_type), c_type))/** * G_TYPE_CHECK_CLASS_CAST: * @g_class: Location of a #GTypeClass structure. * @g_type: The type to be returned. * @c_type: The corresponding C type of class structure of @g_type. *  * Checks that @g_class is a class structure of the type identified by @g_type * and issues a warning if this is not the case. Returns @g_class casted  * to a pointer to @c_type. *  * This macro should only be used in type implementations. */#define G_TYPE_CHECK_CLASS_CAST(g_class, g_type, c_type)        (_G_TYPE_CCC ((g_class), (g_type), c_type))/** * G_TYPE_CHECK_CLASS_TYPE: * @g_class: Location of a #GTypeClass structure. * @g_type: The type to be checked. *  * Checks if @g_class is a class structure of the type identified by  * @g_type. *  * This macro should only be used in type implementations. * * Returns: %TRUE on success. */#define G_TYPE_CHECK_CLASS_TYPE(g_class, g_type)                (_G_TYPE_CCT ((g_class), (g_type)))/** * G_TYPE_CHECK_VALUE: * @value: a #GValue *  * Checks if @value has been initialized to hold values * of a value type. *  * This macro should only be used in type implementations. * * Returns: %TRUE on success. */#define G_TYPE_CHECK_VALUE(value)				(_G_TYPE_CHV ((value)))/** * G_TYPE_CHECK_VALUE_TYPE: * @value: a #GValue * @g_type: The type to be checked. *  * Checks if @value has been initialized to hold values * of type @g_type.  *  * This macro should only be used in type implementations. * * Returns: %TRUE on success. */#define G_TYPE_CHECK_VALUE_TYPE(value, g_type)			(_G_TYPE_CVH ((value), (g_type)))/** * G_TYPE_FROM_INSTANCE: * @instance: Location of a valid #GTypeInstance structure. *  * Get the type identifier from a given @instance structure.  *  * This macro should only be used in type implementations. * * Returns: the #GType */#define G_TYPE_FROM_INSTANCE(instance)                          (G_TYPE_FROM_CLASS (((GTypeInstance*) (instance))->g_class))/** * G_TYPE_FROM_CLASS: * @g_class: Location of a valid #GTypeClass structure. *  * Get the type identifier from a given @class structure. *  * This macro should only be used in type implementations. * * Returns: the #GType */#define G_TYPE_FROM_CLASS(g_class)                              (((GTypeClass*) (g_class))->g_type)/** * G_TYPE_FROM_INTERFACE: * @g_iface: Location of a valid #GTypeInterface structure. *  * Get the type identifier from a given @interface structure. *  * This macro should only be used in type implementations. * * Returns: the #GType */#define G_TYPE_FROM_INTERFACE(g_iface)                          (((GTypeInterface*) (g_iface))->g_type)/** * G_TYPE_INSTANCE_GET_PRIVATE: * @instance: the instance of a type deriving from @private_type. * @g_type: the type identifying which private data to retrieve. * @c_type: The C type for the private structure. *  * Gets the private structure for a particular type. * The private structure must have been registered in the * class_init function with g_type_class_add_private(). *  * This macro should only be used in type implementations. *  * Since: 2.4 * Returns: a pointer to the private data structure. */#define G_TYPE_INSTANCE_GET_PRIVATE(instance, g_type, c_type)   ((c_type*) g_type_instance_get_private ((GTypeInstance*) (instance), (g_type)))/** * GTypeDebugFlags: * @G_TYPE_DEBUG_NONE: Print no messages. * @G_TYPE_DEBUG_OBJECTS: Print messages about object bookkeeping. * @G_TYPE_DEBUG_SIGNALS: Print messages about signal emissions. * @G_TYPE_DEBUG_MASK: Mask covering all debug flags. *  * The <type>GTypeDebugFlags</type> enumeration values can be passed to * g_type_init_with_debug_flags() to trigger debugging messages during runtime. * Note that the messages can also be triggered by setting the * <envar>GOBJECT_DEBUG</envar> environment variable to a ':'-separated list of  * "objects" and "signals". */typedef enum	/*< skip >*/{  G_TYPE_DEBUG_NONE	= 0,  G_TYPE_DEBUG_OBJECTS	= 1 << 0,  G_TYPE_DEBUG_SIGNALS	= 1 << 1,  G_TYPE_DEBUG_MASK	= 0x03} GTypeDebugFlags;/* --- prototypes --- */void                  g_type_init                    (void);void                  g_type_init_with_debug_flags   (GTypeDebugFlags  debug_flags);G_CONST_RETURN gchar* g_type_name                    (GType            type);GQuark                g_type_qname                   (GType            type);GType                 g_type_from_name               (const gchar     *name);GType                 g_type_parent                  (GType            type);guint                 g_type_depth                   (GType            type);GType                 g_type_next_base               (GType            leaf_type,						      GType            root_type);gboolean              g_type_is_a                    (GType            type,						      GType            is_a_type);gpointer              g_type_class_ref               (GType            type);gpointer              g_type_class_peek              (GType            type);gpointer              g_type_class_peek_static       (GType            type);void                  g_type_class_unref             (gpointer         g_class);gpointer              g_type_class_peek_parent       (gpointer         g_class);gpointer              g_type_interface_peek          (gpointer         instance_class,						      GType            iface_type);gpointer              g_type_interface_peek_parent   (gpointer         g_iface);gpointer              g_type_default_interface_ref   (GType            g_type);gpointer              g_type_default_interface_peek  (GType            g_type);void                  g_type_default_interface_unref (gpointer         g_iface);/* g_free() the returned arrays */GType*                g_type_children                (GType            type,						      guint           *n_children);GType*                g_type_interfaces              (GType            type,						      guint           *n_interfaces);/* per-type _static_ data */void                  g_type_set_qdata               (GType            type,						      GQuark           quark,						      gpointer         data);gpointer              g_type_get_qdata               (GType            type,						      GQuark           quark);void		      g_type_query		     (GType	       type,						      GTypeQuery      *query);/* --- type registration --- *//** * GBaseInitFunc: * @g_class: The #GTypeClass structure to initialize. *  * A callback function used by the type system to do base initialization * of the class structures of derived types. It is called as part of the * initialization process of all derived classes and should reallocate * or reset all dynamic class members copied over from the parent class. * For example, class members (such as strings) that are not sufficiently * handled by a plain memory copy of the parent class into the derived class * have to be altered. See GClassInitFunc() for a discussion of the class * intialization process. */typedef void   (*GBaseInitFunc)              (gpointer         g_class);/** * GBaseFinalizeFunc: * @g_class: The #GTypeClass structure to finalize. *  * A callback function used by the type system to finalize those portions * of a derived types class structure that were setup from the corresponding * GBaseInitFunc() function. Class finalization basically works the inverse * way in which class intialization is performed. * See GClassInitFunc() for a discussion of the class intialization process. */typedef void   (*GBaseFinalizeFunc)          (gpointer         g_class);/** * GClassInitFunc: * @g_class: The #GTypeClass structure to initialize. * @class_data: The @class_data member supplied via the #GTypeInfo structure. *  * A callback function used by the type system to initialize the class * of a specific type. This function should initialize all static class * members. * The initialization process of a class involves: * <itemizedlist> * <listitem><para> * 	1 - Copying common members from the parent class over to the * 	derived class structure. * </para></listitem> * <listitem><para> * 	2 -  Zero initialization of the remaining members not copied * 	over from the parent class. * </para></listitem> * <listitem><para> * 	3 - Invocation of the GBaseInitFunc() initializers of all parent * 	types and the class' type. * </para></listitem> * <listitem><para> * 	4 - Invocation of the class' GClassInitFunc() initializer. * </para></listitem> * </itemizedlist> * Since derived classes are partially initialized through a memory copy * of the parent class, the general rule is that GBaseInitFunc() and * GBaseFinalizeFunc() should take care of necessary reinitialization * and release of those class members that were introduced by the type * that specified these GBaseInitFunc()/GBaseFinalizeFunc(). * GClassInitFunc() should only care about initializing static * class members, while dynamic class members (such as allocated strings * or reference counted resources) are better handled by a GBaseInitFunc() * for this type, so proper initialization of the dynamic class members * is performed for class initialization of derived types as well. * An example may help to correspond the intend of the different class * initializers: *  * |[ * typedef struct { *   GObjectClass parent_class; *   gint         static_integer; *   gchar       *dynamic_string; * } TypeAClass; * static void * type_a_base_class_init (TypeAClass *class) * { *   class->dynamic_string = g_strdup ("some string"); * } * static void * type_a_base_class_finalize (TypeAClass *class) * { *   g_free (class->dynamic_string); * } * static void * type_a_class_init (TypeAClass *class) * { *   class->static_integer = 42; * } *  * typedef struct {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -