1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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.
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.
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.
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/.
27 #ifndef __GTK_SIGNAL_H__
28 #define __GTK_SIGNAL_H__
32 #include <gtk/gtkenums.h>
33 #include <gtk/gtkobject.h>
34 #include <gtk/gtkmarshal.h>
38 #endif /* __cplusplus */
41 #define GTK_SIGNAL_OFFSET(struct, field) (GTK_STRUCT_OFFSET (struct, field))
44 typedef void (*GtkSignalMarshal) (GtkObject *object,
50 typedef void (*GtkSignalDestroy) (gpointer data);
51 typedef gboolean (*GtkEmissionHook) (GtkObject *object,
57 typedef struct _GtkSignalQuery GtkSignalQuery;
59 struct _GtkSignalQuery
63 const gchar *signal_name;
64 guint is_user_signal : 1;
65 GtkSignalRunType signal_flags;
68 const GtkType *params;
72 /* Application-level methods */
73 guint gtk_signal_lookup (const gchar *name,
75 gchar* gtk_signal_name (guint signal_id);
76 guint gtk_signal_n_emissions (GtkObject *object,
78 guint gtk_signal_n_emissions_by_name (GtkObject *object,
80 void gtk_signal_emit_stop (GtkObject *object,
82 void gtk_signal_emit_stop_by_name (GtkObject *object,
84 guint gtk_signal_connect (GtkObject *object,
88 guint gtk_signal_connect_after (GtkObject *object,
92 guint gtk_signal_connect_object (GtkObject *object,
95 GtkObject *slot_object);
96 guint gtk_signal_connect_object_after (GtkObject *object,
99 GtkObject *slot_object);
100 guint gtk_signal_connect_full (GtkObject *object,
103 GtkCallbackMarshal marshal,
105 GtkDestroyNotify destroy_func,
109 void gtk_signal_connect_object_while_alive (GtkObject *object,
112 GtkObject *alive_object);
113 void gtk_signal_connect_while_alive (GtkObject *object,
117 GtkObject *alive_object);
119 void gtk_signal_disconnect (GtkObject *object,
121 void gtk_signal_disconnect_by_func (GtkObject *object,
124 void gtk_signal_disconnect_by_data (GtkObject *object,
126 void gtk_signal_handler_block (GtkObject *object,
128 void gtk_signal_handler_block_by_func (GtkObject *object,
131 void gtk_signal_handler_block_by_data (GtkObject *object,
133 void gtk_signal_handler_unblock (GtkObject *object,
135 void gtk_signal_handler_unblock_by_func (GtkObject *object,
138 void gtk_signal_handler_unblock_by_data (GtkObject *object,
140 guint gtk_signal_handler_pending (GtkObject *object,
142 gboolean may_be_blocked);
143 guint gtk_signal_handler_pending_by_func (GtkObject *object,
145 gboolean may_be_blocked,
148 guint gtk_signal_add_emission_hook (guint signal_id,
149 GtkEmissionHook hook_func,
151 guint gtk_signal_add_emission_hook_full (guint signal_id,
152 GtkEmissionHook hook_func,
154 GDestroyNotify destroy);
155 void gtk_signal_remove_emission_hook (guint signal_id,
158 /* Report internal information about a signal. The caller has the
159 * responsibility to invoke a subsequent g_free (returned_data); but
160 * must not modify data pointed to by the members of GtkSignalQuery
162 GtkSignalQuery* gtk_signal_query (guint signal_id);
165 /* Widget-level methods */
166 void gtk_signal_init (void);
167 guint gtk_signal_new (const gchar *name,
168 GtkSignalRunType signal_flags,
170 guint function_offset,
171 GtkSignalMarshaller marshaller,
175 guint gtk_signal_newv (const gchar *name,
176 GtkSignalRunType signal_flags,
178 guint function_offset,
179 GtkSignalMarshaller marshaller,
183 void gtk_signal_emit (GtkObject *object,
186 void gtk_signal_emit_by_name (GtkObject *object,
189 void gtk_signal_emitv (GtkObject *object,
192 void gtk_signal_emitv_by_name (GtkObject *object,
195 /* Non-public methods */
196 void gtk_signal_handlers_destroy (GtkObject *object);
197 void gtk_signal_set_funcs (GtkSignalMarshal marshal_func,
198 GtkSignalDestroy destroy_func);
204 #endif /* __cplusplus */
207 #endif /* __GTK_SIGNAL_H__ */