destroy all signals that the finalized obejct type introduced.
[platform/upstream/glib.git] / gobject / gsignal.h
1 /* GObject - GLib Type, Object, Parameter and Signal Library
2  * Copyright (C) 2000 Red Hat, Inc.
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
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.
18  */
19 #ifndef __G_SIGNAL_H__
20 #define __G_SIGNAL_H__
21
22
23 #include        <gobject/gclosure.h>
24 #include        <gobject/gvalue.h>
25 #include        <gobject/gparam.h>
26
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31
32
33 /* --- typedefs --- */
34 typedef struct _GSignalQuery             GSignalQuery;
35 typedef struct _GSignalInvocationHint    GSignalInvocationHint;
36 typedef GClosureMarshal                  GSignalCMarshaller;
37 typedef gboolean (*GSignalEmissionHook) (GSignalInvocationHint *ihint,
38                                          guint                  n_param_values,
39                                          const GValue          *param_values);
40 typedef gboolean (*GSignalAccumulator)  (GSignalInvocationHint *ihint,
41                                          GValue                *return_accu,
42                                          const GValue          *return_value);
43
44
45 /* --- run & match types --- */
46 typedef enum
47 {
48   G_SIGNAL_RUN_FIRST    = 1 << 0,
49   G_SIGNAL_RUN_LAST     = 1 << 1,
50   G_SIGNAL_RUN_CLEANUP  = 1 << 2,
51   G_SIGNAL_NO_RECURSE   = 1 << 3,
52   G_SIGNAL_DETAILED     = 1 << 4,
53   G_SIGNAL_ACTION       = 1 << 5,
54   G_SIGNAL_NO_HOOKS     = 1 << 6
55 #define G_SIGNAL_FLAGS_MASK  0x7f
56 } GSignalFlags;
57 typedef enum
58 {
59   G_SIGNAL_MATCH_ID        = 1 << 0,
60   G_SIGNAL_MATCH_DETAIL    = 1 << 1,
61   G_SIGNAL_MATCH_CLOSURE   = 1 << 2,
62   G_SIGNAL_MATCH_FUNC      = 1 << 3,
63   G_SIGNAL_MATCH_DATA      = 1 << 4,
64   G_SIGNAL_MATCH_UNBLOCKED = 1 << 5
65 #define G_SIGNAL_MATCH_MASK  0x3f
66 } GSignalMatchType;
67
68
69 /* --- signal information --- */
70 struct _GSignalInvocationHint
71 {
72   guint         signal_id;
73   GQuark        detail;
74   GSignalFlags  run_type;
75 };
76 struct _GSignalQuery
77 {
78   guint         signal_id;
79   const gchar  *signal_name;
80   GType         itype;
81   GSignalFlags  signal_flags;
82   GType         return_type;
83   guint         n_params;
84   const GType  *param_types;
85 };
86
87
88 /* --- signals --- */
89 guint   g_signal_newv                         (const gchar       *signal_name,
90                                                GType              itype,
91                                                GSignalFlags        signal_flags,
92                                                GClosure          *class_closure,
93                                                GSignalAccumulator accumulator,
94                                                GSignalCMarshaller c_marshaller,
95                                                GType              return_type,
96                                                guint              n_params,
97                                                GType             *param_types);
98 void    g_signal_emitv                        (const GValue      *instance_and_params,
99                                                guint              signal_id,
100                                                GQuark             detail,
101                                                GValue            *return_value);
102 guint   g_signal_lookup                       (const gchar       *name,
103                                                GType              itype);
104 gchar*  g_signal_name                         (guint              signal_id);
105 void    g_signal_query                        (guint              signal_id,
106                                                GSignalQuery      *query);
107 guint*  g_signal_list_ids                     (GType              itype,
108                                                guint             *n_ids);
109
110 /* --- signal emissions --- */
111 void    g_signal_stop_emission                (gpointer           instance,
112                                                guint              signal_id,
113                                                GQuark             detail);
114 guint   g_signal_add_emission_hook_full       (guint              signal_id,
115                                                GClosure          *closure);
116 void    g_signal_remove_emission_hook         (guint              signal_id,
117                                                guint              hook_id);
118
119
120 /* --- signal handlers --- */
121 gboolean g_signal_has_handler_pending         (gpointer           instance,
122                                                guint              signal_id,
123                                                GQuark             detail,
124                                                gboolean           may_be_blocked);
125 guint    g_signal_connect_closure             (gpointer           instance,
126                                                guint              signal_id,
127                                                GQuark             detail,
128                                                GClosure          *closure,
129                                                gboolean           after);
130 void     g_signal_handler_block               (gpointer           instance,
131                                                guint              handler_id);
132 void     g_signal_handler_unblock             (gpointer           instance,
133                                                guint              handler_id);
134 void     g_signal_handler_disconnect          (gpointer           instance,
135                                                guint              handler_id);
136 guint    g_signal_handler_find                (gpointer           instance,
137                                                GSignalMatchType   mask,
138                                                guint              signal_id,
139                                                GQuark             detail,
140                                                GClosure          *closure,
141                                                gpointer           func,
142                                                gpointer           data);
143 guint    g_signal_handlers_block_matched      (gpointer           instance,
144                                                GSignalMatchType   mask,
145                                                guint              signal_id,
146                                                GQuark             detail,
147                                                GClosure          *closure,
148                                                gpointer           func,
149                                                gpointer           data);
150 guint    g_signal_handlers_unblock_matched    (gpointer           instance,
151                                                GSignalMatchType   mask,
152                                                guint              signal_id,
153                                                GQuark             detail,
154                                                GClosure          *closure,
155                                                gpointer           func,
156                                                gpointer           data);
157 guint    g_signal_handlers_disconnect_matched (gpointer           instance,
158                                                GSignalMatchType   mask,
159                                                guint              signal_id,
160                                                GQuark             detail,
161                                                GClosure          *closure,
162                                                gpointer           func,
163                                                gpointer           data);
164
165
166 /*< private >*/
167 void    g_signal_handlers_destroy             (gpointer           instance);
168 void    g_signals_destroy                     (GType              itype);
169
170
171 #ifdef __cplusplus
172 }
173 #endif /* __cplusplus */
174
175 #endif /* __G_SIGNAL_H__ */