[14481] | 1 | /* GTK - The GIMP Toolkit |
---|
| 2 | * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
---|
| 3 | * |
---|
| 4 | * This library is free software; you can redistribute it and/or |
---|
| 5 | * modify it under the terms of the GNU Library General Public |
---|
| 6 | * License as published by the Free Software Foundation; either |
---|
| 7 | * version 2 of the License, or (at your option) any later version. |
---|
| 8 | * |
---|
| 9 | * This library is distributed in the hope that it will be useful, |
---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 12 | * Library General Public License for more details. |
---|
| 13 | * |
---|
| 14 | * You should have received a copy of the GNU Library General Public |
---|
| 15 | * License along with this library; if not, write to the |
---|
| 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
| 17 | * Boston, MA 02111-1307, USA. |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | /* |
---|
| 21 | * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS |
---|
| 22 | * file for a list of people on the GTK+ Team. See the ChangeLog |
---|
| 23 | * files for a list of changes. These files are distributed with |
---|
| 24 | * GTK+ at ftp://ftp.gtk.org/pub/gtk/. |
---|
| 25 | */ |
---|
| 26 | |
---|
| 27 | #ifndef __GTK_SIGNAL_H__ |
---|
| 28 | #define __GTK_SIGNAL_H__ |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | #include <gdk/gdk.h> |
---|
| 32 | #include <gtk/gtkenums.h> |
---|
| 33 | #include <gtk/gtkobject.h> |
---|
| 34 | #include <gtk/gtkmarshal.h> |
---|
| 35 | |
---|
| 36 | #ifdef __cplusplus |
---|
| 37 | extern "C" { |
---|
| 38 | #endif /* __cplusplus */ |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | #define GTK_SIGNAL_OFFSET(struct, field) (GTK_STRUCT_OFFSET (struct, field)) |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | typedef void (*GtkSignalMarshal) (GtkObject *object, |
---|
| 45 | gpointer data, |
---|
| 46 | guint nparams, |
---|
| 47 | GtkArg *args, |
---|
| 48 | GtkType *arg_types, |
---|
| 49 | GtkType return_type); |
---|
| 50 | typedef void (*GtkSignalDestroy) (gpointer data); |
---|
| 51 | typedef gboolean (*GtkEmissionHook) (GtkObject *object, |
---|
| 52 | guint signal_id, |
---|
| 53 | guint n_params, |
---|
| 54 | GtkArg *params, |
---|
| 55 | gpointer data); |
---|
| 56 | |
---|
| 57 | typedef struct _GtkSignalQuery GtkSignalQuery; |
---|
| 58 | |
---|
| 59 | struct _GtkSignalQuery |
---|
| 60 | { |
---|
| 61 | GtkType object_type; |
---|
| 62 | guint signal_id; |
---|
| 63 | const gchar *signal_name; |
---|
| 64 | guint is_user_signal : 1; |
---|
| 65 | GtkSignalRunType signal_flags; |
---|
| 66 | GtkType return_val; |
---|
| 67 | guint nparams; |
---|
| 68 | const GtkType *params; |
---|
| 69 | }; |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | /* Application-level methods */ |
---|
| 73 | guint gtk_signal_lookup (const gchar *name, |
---|
| 74 | GtkType object_type); |
---|
| 75 | gchar* gtk_signal_name (guint signal_id); |
---|
| 76 | guint gtk_signal_n_emissions (GtkObject *object, |
---|
| 77 | guint signal_id); |
---|
| 78 | guint gtk_signal_n_emissions_by_name (GtkObject *object, |
---|
| 79 | const gchar *name); |
---|
| 80 | void gtk_signal_emit_stop (GtkObject *object, |
---|
| 81 | guint signal_id); |
---|
| 82 | void gtk_signal_emit_stop_by_name (GtkObject *object, |
---|
| 83 | const gchar *name); |
---|
| 84 | guint gtk_signal_connect (GtkObject *object, |
---|
| 85 | const gchar *name, |
---|
| 86 | GtkSignalFunc func, |
---|
| 87 | gpointer func_data); |
---|
| 88 | guint gtk_signal_connect_after (GtkObject *object, |
---|
| 89 | const gchar *name, |
---|
| 90 | GtkSignalFunc func, |
---|
| 91 | gpointer func_data); |
---|
| 92 | guint gtk_signal_connect_object (GtkObject *object, |
---|
| 93 | const gchar *name, |
---|
| 94 | GtkSignalFunc func, |
---|
| 95 | GtkObject *slot_object); |
---|
| 96 | guint gtk_signal_connect_object_after (GtkObject *object, |
---|
| 97 | const gchar *name, |
---|
| 98 | GtkSignalFunc func, |
---|
| 99 | GtkObject *slot_object); |
---|
| 100 | guint gtk_signal_connect_full (GtkObject *object, |
---|
| 101 | const gchar *name, |
---|
| 102 | GtkSignalFunc func, |
---|
| 103 | GtkCallbackMarshal marshal, |
---|
| 104 | gpointer data, |
---|
| 105 | GtkDestroyNotify destroy_func, |
---|
| 106 | gint object_signal, |
---|
| 107 | gint after); |
---|
| 108 | |
---|
| 109 | void gtk_signal_connect_object_while_alive (GtkObject *object, |
---|
| 110 | const gchar *signal, |
---|
| 111 | GtkSignalFunc func, |
---|
| 112 | GtkObject *alive_object); |
---|
| 113 | void gtk_signal_connect_while_alive (GtkObject *object, |
---|
| 114 | const gchar *signal, |
---|
| 115 | GtkSignalFunc func, |
---|
| 116 | gpointer func_data, |
---|
| 117 | GtkObject *alive_object); |
---|
| 118 | |
---|
| 119 | void gtk_signal_disconnect (GtkObject *object, |
---|
| 120 | guint handler_id); |
---|
| 121 | void gtk_signal_disconnect_by_func (GtkObject *object, |
---|
| 122 | GtkSignalFunc func, |
---|
| 123 | gpointer data); |
---|
| 124 | void gtk_signal_disconnect_by_data (GtkObject *object, |
---|
| 125 | gpointer data); |
---|
| 126 | void gtk_signal_handler_block (GtkObject *object, |
---|
| 127 | guint handler_id); |
---|
| 128 | void gtk_signal_handler_block_by_func (GtkObject *object, |
---|
| 129 | GtkSignalFunc func, |
---|
| 130 | gpointer data); |
---|
| 131 | void gtk_signal_handler_block_by_data (GtkObject *object, |
---|
| 132 | gpointer data); |
---|
| 133 | void gtk_signal_handler_unblock (GtkObject *object, |
---|
| 134 | guint handler_id); |
---|
| 135 | void gtk_signal_handler_unblock_by_func (GtkObject *object, |
---|
| 136 | GtkSignalFunc func, |
---|
| 137 | gpointer data); |
---|
| 138 | void gtk_signal_handler_unblock_by_data (GtkObject *object, |
---|
| 139 | gpointer data); |
---|
| 140 | guint gtk_signal_handler_pending (GtkObject *object, |
---|
| 141 | guint signal_id, |
---|
| 142 | gboolean may_be_blocked); |
---|
| 143 | guint gtk_signal_handler_pending_by_func (GtkObject *object, |
---|
| 144 | guint signal_id, |
---|
| 145 | gboolean may_be_blocked, |
---|
| 146 | GtkSignalFunc func, |
---|
| 147 | gpointer data); |
---|
| 148 | gint gtk_signal_handler_pending_by_id (GtkObject *object, |
---|
| 149 | guint handler_id, |
---|
| 150 | gboolean may_be_blocked); |
---|
| 151 | guint gtk_signal_add_emission_hook (guint signal_id, |
---|
| 152 | GtkEmissionHook hook_func, |
---|
| 153 | gpointer data); |
---|
| 154 | guint gtk_signal_add_emission_hook_full (guint signal_id, |
---|
| 155 | GtkEmissionHook hook_func, |
---|
| 156 | gpointer data, |
---|
| 157 | GDestroyNotify destroy); |
---|
| 158 | void gtk_signal_remove_emission_hook (guint signal_id, |
---|
| 159 | guint hook_id); |
---|
| 160 | |
---|
| 161 | /* Report internal information about a signal. The caller has the |
---|
| 162 | * responsibility to invoke a subsequent g_free (returned_data); but |
---|
| 163 | * must not modify data pointed to by the members of GtkSignalQuery |
---|
| 164 | */ |
---|
| 165 | GtkSignalQuery* gtk_signal_query (guint signal_id); |
---|
| 166 | |
---|
| 167 | |
---|
| 168 | /* Widget-level methods */ |
---|
| 169 | void gtk_signal_init (void); |
---|
| 170 | guint gtk_signal_new (const gchar *name, |
---|
| 171 | GtkSignalRunType signal_flags, |
---|
| 172 | GtkType object_type, |
---|
| 173 | guint function_offset, |
---|
| 174 | GtkSignalMarshaller marshaller, |
---|
| 175 | GtkType return_val, |
---|
| 176 | guint nparams, |
---|
| 177 | ...); |
---|
| 178 | guint gtk_signal_newv (const gchar *name, |
---|
| 179 | GtkSignalRunType signal_flags, |
---|
| 180 | GtkType object_type, |
---|
| 181 | guint function_offset, |
---|
| 182 | GtkSignalMarshaller marshaller, |
---|
| 183 | GtkType return_val, |
---|
| 184 | guint nparams, |
---|
| 185 | GtkType *params); |
---|
| 186 | void gtk_signal_emit (GtkObject *object, |
---|
| 187 | guint signal_id, |
---|
| 188 | ...); |
---|
| 189 | void gtk_signal_emit_by_name (GtkObject *object, |
---|
| 190 | const gchar *name, |
---|
| 191 | ...); |
---|
| 192 | void gtk_signal_emitv (GtkObject *object, |
---|
| 193 | guint signal_id, |
---|
| 194 | GtkArg *params); |
---|
| 195 | void gtk_signal_emitv_by_name (GtkObject *object, |
---|
| 196 | const gchar *name, |
---|
| 197 | GtkArg *params); |
---|
| 198 | /* Non-public methods */ |
---|
| 199 | void gtk_signal_handlers_destroy (GtkObject *object); |
---|
| 200 | void gtk_signal_set_funcs (GtkSignalMarshal marshal_func, |
---|
| 201 | GtkSignalDestroy destroy_func); |
---|
| 202 | |
---|
| 203 | |
---|
| 204 | |
---|
| 205 | #ifdef __cplusplus |
---|
| 206 | } |
---|
| 207 | #endif /* __cplusplus */ |
---|
| 208 | |
---|
| 209 | |
---|
| 210 | #endif /* __GTK_SIGNAL_H__ */ |
---|