1 /* GObject - GLib Type, Object, Parameter and Signal Library
2 * Copyright (C) 2000 Red Hat, Inc.
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.
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.
14 * You should have received a copy of the GNU Lesser General
15 * Public 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.
19 #ifndef __G_SIGNAL_H__
20 #define __G_SIGNAL_H__
23 #include <gobject/gclosure.h>
24 #include <gobject/gvalue.h>
25 #include <gobject/gparam.h>
30 #endif /* __cplusplus */
34 #define G_SIGNAL_HINT_ID(hint) ((hint) >> 8)
35 #define G_SIGNAL_HINT_RUN_TYPE(hint) ((hint) & 0xff)
38 /* --- run & match types --- */
41 G_SIGNAL_RUN_FIRST = 1 << 0,
42 G_SIGNAL_RUN_LAST = 1 << 1,
43 G_SIGNAL_RUN_CLEANUP = 1 << 2,
44 G_SIGNAL_NO_RECURSE = 1 << 3,
45 G_SIGNAL_ACTION = 1 << 4,
46 G_SIGNAL_NO_HOOKS = 1 << 5
50 G_SIGNAL_MATCH_ID = 1 << 0,
51 G_SIGNAL_MATCH_CLOSURE = 1 << 1,
52 G_SIGNAL_MATCH_FUNC = 1 << 2,
53 G_SIGNAL_MATCH_DATA = 1 << 3,
54 G_SIGNAL_MATCH_UNBLOCKED = 1 << 4,
55 G_SIGNAL_MATCH_MASK = 0x1f
59 /* --- signal queries --- */
60 typedef struct _GSignalQuery GSignalQuery;
64 const gchar *signal_name;
66 GSignalType signal_flags;
69 const GType *param_types;
73 /* --- function types --- */
74 typedef gboolean (*GSignalEmissionHook) (guint signal_id,
76 const GValue *values);
77 typedef gboolean (*GSignalAccumulator) (guint signal_id,
79 const GValue *return_value);
80 typedef GClosureMarshal GSignalCMarshaller;
84 guint g_signal_newv (const gchar *signal_name,
86 GSignalType signal_flags,
87 GClosure *class_closure,
88 GSignalAccumulator accumulator,
89 GSignalCMarshaller c_marshaller,
93 void g_signal_emitv (const GValue *instance_and_params,
95 GValue *return_value);
96 guint g_signal_lookup (const gchar *name,
98 gchar* g_signal_name (guint signal_id);
99 void g_signal_query (guint signal_id,
100 GSignalQuery *query);
103 /* --- signal handlers --- */
104 guint g_signal_connect_closure (gpointer instance,
108 void g_signal_handler_disconnect (gpointer instance,
110 void g_signal_handler_block (gpointer instance,
112 void g_signal_handler_unblock (gpointer instance,
114 guint g_signal_handler_find (gpointer instance,
115 GSignalMatchType mask,
120 gboolean g_signal_has_handler_pending (gpointer instance,
122 gboolean may_be_blocked);
125 /* --- signal emissions --- */
126 void g_signal_stop_emission (gpointer instance,
128 guint g_signal_add_emission_hook_full (guint signal_id,
130 void g_signal_remove_emission_hook (guint signal_id,
134 void g_signal_handlers_destroy (gpointer instance);
135 void g_signals_destroy (GType itype);
140 #endif /* __cplusplus */
142 #endif /* __G_SIGNAL_H__ */