31
31
/* --- defines --- */
33
* G_CLOSURE_NEEDS_MARSHAL:
34
* @closure: a #GClosure
36
* Check if the closure still needs a marshaller. See g_closure_set_marshal().
38
* Returns: %TRUE if a #GClosureMarshal marshaller has not yet been set on
32
41
#define G_CLOSURE_NEEDS_MARSHAL(closure) (((GClosure*) (closure))->marshal == NULL)
43
* G_CLOSURE_N_NOTIFIERS:
46
* Get the total number of notifiers connected with the closure @cl.
47
* The count includes the meta marshaller, the finalize and invalidate notifiers
48
* and the marshal guards. Note that each guard counts as two notifiers.
49
* See g_closure_set_meta_marshal(), g_closure_add_finalize_notifier(),
50
* g_closure_add_invalidate_notifier() and g_closure_add_marshal_guards().
52
* Returns: number of notifiers
33
54
#define G_CLOSURE_N_NOTIFIERS(cl) ((cl)->meta_marshal + ((cl)->n_guards << 1L) + \
34
55
(cl)->n_fnotifiers + (cl)->n_inotifiers)
57
* G_CCLOSURE_SWAP_DATA:
58
* @cclosure: a #GCClosure
60
* Checks whether the user data of the #GCClosure should be passed as the
61
* first parameter to the callback. See g_cclosure_new_swap().
63
* Returns: %TRUE if data has to be swapped.
35
65
#define G_CCLOSURE_SWAP_DATA(cclosure) (((GClosure*) (cclosure))->derivative_flag)
68
* @f: a function pointer.
70
* Cast a function pointer to a #GCallback.
36
72
#define G_CALLBACK(f) ((GCallback) (f))
39
75
/* -- typedefs --- */
40
76
typedef struct _GClosure GClosure;
41
77
typedef struct _GClosureNotifyData GClosureNotifyData;
82
* The type used for callback functions in structure definitions and function
83
* signatures. This doesn't mean that all callback functions must take no
84
* parameters and return void. The required signature of a callback function
85
* is determined by the context in which is used (e.g. the signal to which it
86
* is connected). Use G_CALLBACK() to cast the callback function to a #GCallback.
42
88
typedef void (*GCallback) (void);
91
* @data: data specified when registering the notification callback
92
* @closure: the #GClosure on which the notification is emitted
94
* The type used for the various notification callbacks which can be registered
43
97
typedef void (*GClosureNotify) (gpointer data,
44
98
GClosure *closure);
101
* @closure: the #GClosure to which the marshaller belongs
102
* @return_value: a #GValue to store the return value. May be %NULL if the
103
* callback of @closure doesn't return a value.
104
* @n_param_values: the length of the @param_values array
105
* @param_values: an array of #GValue<!-- -->s holding the arguments on
106
* which to invoke the callback of @closure
107
* @invocation_hint: the invocation hint given as the last argument
108
* to g_closure_invoke()
109
* @marshal_data: additional data specified when registering the marshaller,
110
* see g_closure_set_marshal() and g_closure_set_meta_marshal()
112
* The type used for marshaller functions.
45
114
typedef void (*GClosureMarshal) (GClosure *closure,
46
115
GValue *return_value,
47
116
guint n_param_values,
48
117
const GValue *param_values,
49
118
gpointer invocation_hint,
50
119
gpointer marshal_data);
122
* @closure: the #GClosure
123
* @callback: the callback function
125
* A #GCClosure is a specialization of #GClosure for C function callbacks.
51
127
typedef struct _GCClosure GCClosure;