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 Lesser 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 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser 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-2000. 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_DISABLE_DEPRECATED
28
29#ifndef __GTK_SIGNAL_H__
30#define __GTK_SIGNAL_H__
31
32#include <gtk/gtkenums.h>
33#include <gtk/gtktypeutils.h>
34#include <gtk/gtkobject.h>
35#include <gtk/gtkmarshal.h>
36
37G_BEGIN_DECLS
38
39#define gtk_signal_default_marshaller g_cclosure_marshal_VOID__VOID
40
41
42/* --- compat defines --- */
43#define GTK_SIGNAL_OFFSET G_STRUCT_OFFSET
44#define gtk_signal_lookup(name,object_type) \
45 g_signal_lookup ((name), (object_type))
46#define gtk_signal_name(signal_id) \
47 g_signal_name (signal_id)
48#define gtk_signal_emit_stop(object,signal_id) \
49 g_signal_stop_emission ((object), (signal_id), 0)
50#define gtk_signal_connect(object,name,func,func_data) \
51 gtk_signal_connect_full ((object), (name), (func), NULL, (func_data), NULL, 0, 0)
52#define gtk_signal_connect_after(object,name,func,func_data) \
53 gtk_signal_connect_full ((object), (name), (func), NULL, (func_data), NULL, 0, 1)
54#define gtk_signal_connect_object(object,name,func,slot_object) \
55 gtk_signal_connect_full ((object), (name), (func), NULL, (slot_object), NULL, 1, 0)
56#define gtk_signal_connect_object_after(object,name,func,slot_object) \
57 gtk_signal_connect_full ((object), (name), (func), NULL, (slot_object), NULL, 1, 1)
58#define gtk_signal_disconnect(object,handler_id) \
59 g_signal_handler_disconnect ((object), (handler_id))
60#define gtk_signal_handler_block(object,handler_id) \
61 g_signal_handler_block ((object), (handler_id))
62#define gtk_signal_handler_unblock(object,handler_id) \
63 g_signal_handler_unblock ((object), (handler_id))
64#define gtk_signal_disconnect_by_func(object,func,data) \
65 gtk_signal_compat_matched ((object), (func), (data), \
66 (GSignalMatchType)(G_SIGNAL_MATCH_FUNC | \
67 G_SIGNAL_MATCH_DATA), 0)
68#define gtk_signal_disconnect_by_data(object,data) \
69 gtk_signal_compat_matched ((object), 0, (data), G_SIGNAL_MATCH_DATA, 0)
70#define gtk_signal_handler_block_by_func(object,func,data) \
71 gtk_signal_compat_matched ((object), (func), (data), \
72 (GSignalMatchType)(G_SIGNAL_MATCH_FUNC | \
73 G_SIGNAL_MATCH_DATA), 1)
74#define gtk_signal_handler_block_by_data(object,data) \
75 gtk_signal_compat_matched ((object), 0, (data), G_SIGNAL_MATCH_DATA, 1)
76#define gtk_signal_handler_unblock_by_func(object,func,data) \
77 gtk_signal_compat_matched ((object), (func), (data), \
78 (GSignalMatchType)(G_SIGNAL_MATCH_FUNC | \
79 G_SIGNAL_MATCH_DATA), 2)
80#define gtk_signal_handler_unblock_by_data(object,data) \
81 gtk_signal_compat_matched ((object), 0, (data), G_SIGNAL_MATCH_DATA, 2)
82#define gtk_signal_handler_pending(object,signal_id,may_be_blocked) \
83 g_signal_has_handler_pending ((object), (signal_id), 0, (may_be_blocked))
84#define gtk_signal_handler_pending_by_func(object,signal_id,may_be_blocked,func,data) \
85 (g_signal_handler_find ((object), \
86 (GSignalMatchType)(G_SIGNAL_MATCH_ID | \
87 G_SIGNAL_MATCH_FUNC | \
88 G_SIGNAL_MATCH_DATA | \
89 ((may_be_blocked) ? 0 : G_SIGNAL_MATCH_UNBLOCKED)),\
90 (signal_id), 0, 0, (func), (data)) != 0)
91
92
93/* --- compat functions --- */
94guint gtk_signal_newv (const gchar *name,
95 GtkSignalRunType signal_flags,
96 GType object_type,
97 guint function_offset,
98 GSignalCMarshaller marshaller,
99 GType return_val,
100 guint n_args,
101 GType *args);
102guint gtk_signal_new (const gchar *name,
103 GtkSignalRunType signal_flags,
104 GType object_type,
105 guint function_offset,
106 GSignalCMarshaller marshaller,
107 GType return_val,
108 guint n_args,
109 ...);
110void gtk_signal_emit_stop_by_name (GtkObject *object,
111 const gchar *name);
112void gtk_signal_connect_object_while_alive (GtkObject *object,
113 const gchar *name,
114 GCallback func,
115 GtkObject *alive_object);
116void gtk_signal_connect_while_alive (GtkObject *object,
117 const gchar *name,
118 GCallback func,
119 gpointer func_data,
120 GtkObject *alive_object);
121gulong gtk_signal_connect_full (GtkObject *object,
122 const gchar *name,
123 GCallback func,
124 GtkCallbackMarshal unsupported,
125 gpointer data,
126 GDestroyNotify destroy_func,
127 gint object_signal,
128 gint after);
129void gtk_signal_emitv (GtkObject *object,
130 guint signal_id,
131 GtkArg *args);
132void gtk_signal_emit (GtkObject *object,
133 guint signal_id,
134 ...);
135void gtk_signal_emit_by_name (GtkObject *object,
136 const gchar *name,
137 ...);
138void gtk_signal_emitv_by_name (GtkObject *object,
139 const gchar *name,
140 GtkArg *args);
141void gtk_signal_compat_matched (GtkObject *object,
142 GCallback func,
143 gpointer data,
144 GSignalMatchType match,
145 guint action);
146
147G_END_DECLS
148
149#endif /* __GTK_SIGNAL_H__ */
150
151#endif /* GTK_DISABLE_DEPRECATED */
152