00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
00022 #error "Only <glib-object.h> can be included directly."
00023 #endif
00024
00025 #ifndef __G_CLOSURE_H__
00026 #define __G_CLOSURE_H__
00027
00028 #include <_ansi.h>
00029 #include <gobject/gtype.h>
00030
00031 G_BEGIN_DECLS
00032
00033
00034 #define G_CLOSURE_NEEDS_MARSHAL(closure) (((GClosure*) (closure))->marshal == NULL)
00035 #define G_CLOSURE_N_NOTIFIERS(cl) ((cl)->meta_marshal + ((cl)->n_guards << 1L) + \
00036 (cl)->n_fnotifiers + (cl)->n_inotifiers)
00037 #define G_CCLOSURE_SWAP_DATA(cclosure) (((GClosure*) (closure))->derivative_flag)
00038 #define G_CALLBACK(f) ((GCallback) (f))
00039
00040
00041
00042 typedef struct _GClosure GClosure;
00043 typedef struct _GClosureNotifyData GClosureNotifyData;
00044 typedef void (*GCallback) (void);
00045 typedef void (*GClosureNotify) (gpointer data,
00046 GClosure *closure);
00047 typedef void (*GClosureMarshal) (GClosure *closure,
00048 GValue *return_value,
00049 guint n_param_values,
00050 const GValue *param_values,
00051 gpointer invocation_hint,
00052 gpointer marshal_data);
00053 typedef struct _GCClosure GCClosure;
00054
00055
00056
00057 struct _GClosureNotifyData
00058 {
00059 gpointer data;
00060 GClosureNotify notify;
00061 };
00062 struct _GClosure
00063 {
00064
00065 volatile guint ref_count : 15;
00066 volatile guint meta_marshal : 1;
00067 volatile guint n_guards : 1;
00068 volatile guint n_fnotifiers : 2;
00069 volatile guint n_inotifiers : 8;
00070 volatile guint in_inotify : 1;
00071 volatile guint floating : 1;
00072
00073 volatile guint derivative_flag : 1;
00074
00075 volatile guint in_marshal : 1;
00076 volatile guint is_invalid : 1;
00077
00078 void (*marshal) (GClosure *closure,
00079 GValue *return_value,
00080 guint n_param_values,
00081 const GValue *param_values,
00082 gpointer invocation_hint,
00083 gpointer marshal_data);
00084 gpointer data;
00085
00086 GClosureNotifyData *notifiers;
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 };
00099
00100
00101 struct _GCClosure
00102 {
00103 GClosure closure;
00104 gpointer callback;
00105 };
00106
00107
00108
00109 IMPORT_C GClosure* g_cclosure_new (GCallback callback_func,
00110 gpointer user_data,
00111 GClosureNotify destroy_data);
00112 IMPORT_C GClosure* g_cclosure_new_swap (GCallback callback_func,
00113 gpointer user_data,
00114 GClosureNotify destroy_data);
00115 IMPORT_C GClosure* g_signal_type_cclosure_new (GType itype,
00116 guint struct_offset);
00117
00118
00119
00120 IMPORT_C GClosure* g_closure_ref (GClosure *closure);
00121 IMPORT_C void g_closure_sink (GClosure *closure);
00122 IMPORT_C void g_closure_unref (GClosure *closure);
00123
00124 IMPORT_C GClosure* g_closure_new_simple (guint sizeof_closure,
00125 gpointer data);
00126 IMPORT_C void g_closure_add_finalize_notifier (GClosure *closure,
00127 gpointer notify_data,
00128 GClosureNotify notify_func);
00129 IMPORT_C void g_closure_remove_finalize_notifier (GClosure *closure,
00130 gpointer notify_data,
00131 GClosureNotify notify_func);
00132 IMPORT_C void g_closure_add_invalidate_notifier (GClosure *closure,
00133 gpointer notify_data,
00134 GClosureNotify notify_func);
00135 IMPORT_C void g_closure_remove_invalidate_notifier (GClosure *closure,
00136 gpointer notify_data,
00137 GClosureNotify notify_func);
00138 IMPORT_C void g_closure_add_marshal_guards (GClosure *closure,
00139 gpointer pre_marshal_data,
00140 GClosureNotify pre_marshal_notify,
00141 gpointer post_marshal_data,
00142 GClosureNotify post_marshal_notify);
00143 IMPORT_C void g_closure_set_marshal (GClosure *closure,
00144 GClosureMarshal marshal);
00145 IMPORT_C void g_closure_set_meta_marshal (GClosure *closure,
00146 gpointer marshal_data,
00147 GClosureMarshal meta_marshal);
00148 IMPORT_C void g_closure_invalidate (GClosure *closure);
00149 IMPORT_C void g_closure_invoke (GClosure *closure,
00150 GValue *return_value,
00151 guint n_param_values,
00152 const GValue *param_values,
00153 gpointer invocation_hint);
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166 G_END_DECLS
00167
00168 #endif