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

📄 gclosure.sgml

📁 This GLib version 2.16.1. GLib is the low-level core library that forms the basis for projects such
💻 SGML
📖 第 1 页 / 共 2 页
字号:
MyClosure *my_closure_new (gpointer data){  GClosure *closure;  MyClosure *my_closure;    closure = g_closure_new_simple (sizeof (MyClosure), data);  my_closure = (MyClosure *) closure;  / initialize extra data here */  g_closure_add_finalize_notifier (closure, notify_data,                                   my_closure_finalize);  return my_closure;}</programlisting></informalexample>@sizeof_closure: the size of the structure to allocate, must be at least <literal>sizeof (GClosure)</literal>@data: data to store in the @data field of the newly allocated #GClosure@Returns: a newly allocated #GClosure<!-- ##### FUNCTION g_closure_set_marshal ##### --><para>Sets the marshaller of @closure. The <literal>marshal_data</literal>of @marshal provides a way for a meta marshaller to provide additionalinformation to the marshaller. (See g_closure_set_meta_marshal().) ForGObject's C predefined marshallers (the g_cclosure_marshal_*()functions), what it provides is a callback function to use instead of@closure->callback.</para>@closure: a #GClosure@marshal: a #GClosureMarshal function<!-- ##### FUNCTION g_closure_add_marshal_guards ##### --><para>Adds a pair of notifiers which get invoked before and after the closure callback, respectively. This is typically used to protect the extra argumentsfor the duration of the callback. See g_object_watch_closure() for anexample of marshal guards.</para>@closure: a #GClosure@pre_marshal_data: data to pass to @pre_marshal_notify@pre_marshal_notify: a function to call before the closure callback@post_marshal_data: data to pass to @post_marshal_notify@post_marshal_notify: a function to call after the closure callback<!-- ##### FUNCTION g_closure_set_meta_marshal ##### --><para>Sets the meta marshaller of @closure. A meta marshaller wraps @closure->marshal and modifies the way it is called in some fashion. The most common use of this facility is for C callbacks. The same marshallers (generated by <link linkend="glib-genmarshal">glib-genmarshal</link>) are used everywhere,but the way that we get the callback function differs. In most cases we want to use @closure->callback, but in other cases we want to use some different technique to retrieve the callback function.</para><para>For example, class closures for signals (see g_signal_type_cclosure_new()) retrieve the callback function from a fixed offset in the class structure. The meta marshaller retrieves the right callback and passes it to the marshaller as the @marshal_data argument.</para>@closure: a #GClosure@marshal_data: context-dependent data to pass to @meta_marshal@meta_marshal: a #GClosureMarshal function<!-- ##### FUNCTION g_source_set_closure ##### --><para>Set the callback for a source as a #GClosure.</para><para>If the source is not one of the standard GLib types, the @closure_callbackand @closure_marshal fields of the #GSourceFuncs structure must have beenfilled in with pointers to appropriate functions.</para>@source: the source@closure: a #GClosure<!-- ##### MACRO G_TYPE_IO_CHANNEL ##### --><para>The #GType for #GIOChannel.</para><!-- ##### MACRO G_TYPE_IO_CONDITION ##### --><para>The #GType for #GIOCondition.</para><!-- ##### FUNCTION g_cclosure_marshal_VOID__VOID ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 1@param_values: a #GValue array holding only the instance@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__BOOLEAN ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, gboolean arg1, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the #gboolean parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__CHAR ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, gchar arg1, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the #gchar parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__UCHAR ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, guchar arg1, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the #guchar parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__INT ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the #gint parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__UINT ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, guint arg1, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the #guint parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__LONG ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, glong arg1, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the #glong parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__ULONG ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, gulong arg1, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the #gulong parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__ENUM ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal> where the #gint parameter denotes an enumeration type..</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the enumeration parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__FLAGS ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal> where the #gint parameter denotes a flags typedenotes a flags type.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the flags parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__FLOAT ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, gfloat arg1, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the #gfloat parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__DOUBLE ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, gdouble arg1, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the #gdouble parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__STRING ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, const gchar *arg1, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the #gchar* parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__PARAM ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, GParamSpec *arg1, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the #GParamSpec* parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__BOXED ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, GBoxed *arg1, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the #GBoxed* parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__POINTER ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, gpointer arg1, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the #gpointer parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__OBJECT ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, GOBject *arg1, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 2@param_values: a #GValue array holding the instance and the #GObject* parameter@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_STRING__OBJECT_POINTER ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, GObject *arg1, gpointer arg2, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 3@param_values: a #GValue array holding instance, arg1 and arg2@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_VOID__UINT_POINTER ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>void (*callback) (gpointer instance, guint arg1, gpointer arg2, gpointer user_data)</literal>.</para>@closure: the #GClosure to which the marshaller belongs@return_value: ignored@n_param_values: 3@param_values: a #GValue array holding instance, arg1 and arg2@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### FUNCTION g_cclosure_marshal_BOOLEAN__FLAGS ##### --><para>A marshaller for a #GCClosure with a callback of type<literal>gboolean (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal> where the #gint parameterdenotes a flags type.</para>@closure: the #GClosure to which the marshaller belongs@return_value: a #GValue which can store the returned #gboolean@n_param_values: 2@param_values: a #GValue array holding instance and arg1@invocation_hint: the invocation hint given as the the last argument  to g_closure_invoke()@marshal_data: additional data specified when registering the marshaller<!-- ##### MACRO g_cclosure_marshal_BOOL__FLAGS ##### --><para>Another name for g_cclosure_marshal_BOOLEAN__FLAGS().</para>

⌨️ 快捷键说明

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