1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = gobject-Signals.html
27  * outPack = gobject
28  * outFile = Signals
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = Signals
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_signal_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- gobject.Closure
48  * 	- gobject.Value
49  * 	- glib.Quark
50  * structWrap:
51  * 	- GClosure* -> Closure
52  * 	- GQuark* -> Quark
53  * 	- GValue* -> Value
54  * module aliases:
55  * local aliases:
56  * overrides:
57  */
58 
59 module gobject.Signals;
60 
61 public  import gtkc.gobjecttypes;
62 
63 private import gtkc.gobject;
64 private import glib.ConstructionException;
65 private import gobject.ObjectG;
66 
67 
68 private import glib.Str;
69 private import gobject.Closure;
70 private import gobject.Value;
71 private import glib.Quark;
72 
73 
74 
75 
76 /**
77  * Description
78  * The basic concept of the signal system is that of the
79  * emission of a signal. Signals are introduced
80  * per-type and are identified through strings. Signals introduced
81  * for a parent type are available in derived types as well, so
82  * basically they are a per-type facility that is inherited. A signal
83  * emission mainly involves invocation of a certain set of callbacks
84  * in precisely defined manner. There are two main categories of such
85  * callbacks, per-object
86  * [10]
87  * ones and user provided ones.
88  * The per-object callbacks are most often referred to as "object method
89  * handler" or "default (signal) handler", while user provided callbacks are
90  * usually just called "signal handler".
91  * The object method handler is provided at signal creation time (this most
92  * frequently happens at the end of an object class' creation), while user
93  * provided handlers are frequently connected and disconnected to/from a certain
94  * signal on certain object instances.
95  * A signal emission consists of five stages, unless prematurely stopped:
96  * 	1 - Invocation of the object method handler for G_SIGNAL_RUN_FIRST signals
97  * 	2 - Invocation of normal user-provided signal handlers (after flag FALSE)
98  * 	3 - Invocation of the object method handler for G_SIGNAL_RUN_LAST signals
99  * 	4 - Invocation of user provided signal handlers, connected with an after flag of TRUE
100  * 	5 - Invocation of the object method handler for G_SIGNAL_RUN_CLEANUP signals
101  * The user-provided signal handlers are called in the order they were
102  * connected in.
103  * All handlers may prematurely stop a signal emission, and any number of
104  * handlers may be connected, disconnected, blocked or unblocked during
105  * a signal emission.
106  * There are certain criteria for skipping user handlers in stages 2 and 4
107  * of a signal emission.
108  * First, user handlers may be blocked, blocked handlers are omitted
109  * during callback invocation, to return from the "blocked" state, a
110  * handler has to get unblocked exactly the same amount of times
111  * it has been blocked before.
112  * Second, upon emission of a G_SIGNAL_DETAILED signal, an additional
113  * "detail" argument passed in to g_signal_emit() has to match the detail
114  * argument of the signal handler currently subject to invocation.
115  * Specification of no detail argument for signal handlers (omission of the
116  * detail part of the signal specification upon connection) serves as a
117  * wildcard and matches any detail argument passed in to emission.
118  */
119 public class Signals
120 {
121 	
122 	/** */
123 	public static gulong connectData(void* instanc, string detailedSignal, GCallback cHandler, Object data, GClosureNotify destroyData, GConnectFlags connectFlags)
124 	{
125 		// gulong g_signal_connect_data (gpointer instance,  const gchar *detailed_signal,  GCallback c_handler,  gpointer data,  GClosureNotify destroy_data,  GConnectFlags connect_flags);
126 		return g_signal_connect_data(instanc, Str.toStringz(detailedSignal), cHandler, cast(void*)data, destroyData, connectFlags);
127 	}
128 	
129 	
130 	/**
131 	 */
132 	
133 	/**
134 	 * Creates a new signal. (This is usually done in the class initializer.)
135 	 * See g_signal_new() for details on allowed signal names.
136 	 * Params:
137 	 * signalName = the name for the signal
138 	 * itype = the type this signal pertains to. It will also pertain to
139 	 * types which are derived from this type
140 	 * signalFlags = a combination of GSignalFlags specifying detail of when
141 	 * the default handler is to be invoked. You should at least specify
142 	 * G_SIGNAL_RUN_FIRST or G_SIGNAL_RUN_LAST
143 	 * classClosure = The closure to invoke on signal emission; may be NULL
144 	 * accumulator = the accumulator for this signal; may be NULL
145 	 * accuData = user data for the accumulator
146 	 * cMarshaller = the function to translate arrays of parameter values to
147 	 * signal emissions into C language callback invocations
148 	 * returnType = the type of return value, or G_TYPE_NONE for a signal
149 	 * without a return value
150 	 * paramTypes = an array of types, one for each parameter
151 	 * Returns: the signal id
152 	 */
153 	public static uint newv(string signalName, GType itype, GSignalFlags signalFlags, Closure classClosure, GSignalAccumulator accumulator, void* accuData, GSignalCMarshaller cMarshaller, GType returnType, GType[] paramTypes)
154 	{
155 		// guint g_signal_newv (const gchar *signal_name,  GType itype,  GSignalFlags signal_flags,  GClosure *class_closure,  GSignalAccumulator accumulator,  gpointer accu_data,  GSignalCMarshaller c_marshaller,  GType return_type,  guint n_params,  GType *param_types);
156 		return g_signal_newv(Str.toStringz(signalName), itype, signalFlags, (classClosure is null) ? null : classClosure.getClosureStruct(), accumulator, accuData, cMarshaller, returnType, cast(int) paramTypes.length, paramTypes.ptr);
157 	}
158 	
159 	/**
160 	 * Creates a new signal. (This is usually done in the class initializer.)
161 	 * See g_signal_new() for details on allowed signal names.
162 	 * Params:
163 	 * signalName = the name for the signal
164 	 * itype = the type this signal pertains to. It will also pertain to
165 	 * types which are derived from this type.
166 	 * signalFlags = a combination of GSignalFlags specifying detail of when
167 	 * the default handler is to be invoked. You should at least specify
168 	 * G_SIGNAL_RUN_FIRST or G_SIGNAL_RUN_LAST.
169 	 * classClosure = The closure to invoke on signal emission; may be NULL.
170 	 * accumulator = the accumulator for this signal; may be NULL.
171 	 * accuData = user data for the accumulator.
172 	 * cMarshaller = the function to translate arrays of parameter values to
173 	 * signal emissions into C language callback invocations.
174 	 * returnType = the type of return value, or G_TYPE_NONE for a signal
175 	 * without a return value.
176 	 * nParams = the number of parameter types in args.
177 	 * args = va_list of GType, one for each parameter.
178 	 * Returns: the signal id
179 	 */
180 	public static uint newValist(string signalName, GType itype, GSignalFlags signalFlags, Closure classClosure, GSignalAccumulator accumulator, void* accuData, GSignalCMarshaller cMarshaller, GType returnType, uint nParams, void* args)
181 	{
182 		// guint g_signal_new_valist (const gchar *signal_name,  GType itype,  GSignalFlags signal_flags,  GClosure *class_closure,  GSignalAccumulator accumulator,  gpointer accu_data,  GSignalCMarshaller c_marshaller,  GType return_type,  guint n_params,  va_list args);
183 		return g_signal_new_valist(Str.toStringz(signalName), itype, signalFlags, (classClosure is null) ? null : classClosure.getClosureStruct(), accumulator, accuData, cMarshaller, returnType, nParams, args);
184 	}
185 	
186 	/**
187 	 * Queries the signal system for in-depth information about a
188 	 * specific signal. This function will fill in a user-provided
189 	 * structure to hold signal-specific information. If an invalid
190 	 * signal id is passed in, the signal_id member of the GSignalQuery
191 	 * is 0. All members filled into the GSignalQuery structure should
192 	 * be considered constant and have to be left untouched.
193 	 * Params:
194 	 * signalId = The signal id of the signal to query information for.
195 	 * query = A user provided structure that is filled in with constant
196 	 * values upon success.
197 	 */
198 	public static void query(uint signalId, GSignalQuery* query)
199 	{
200 		// void g_signal_query (guint signal_id,  GSignalQuery *query);
201 		g_signal_query(signalId, query);
202 	}
203 	
204 	/**
205 	 * Given the name of the signal and the type of object it connects to, gets
206 	 * the signal's identifying integer. Emitting the signal by number is
207 	 * somewhat faster than using the name each time.
208 	 * Also tries the ancestors of the given type.
209 	 * See g_signal_new() for details on allowed signal names.
210 	 * Params:
211 	 * name = the signal's name.
212 	 * itype = the type that the signal operates on.
213 	 * Returns: the signal's identifying number, or 0 if no signal was found.
214 	 */
215 	public static uint lookup(string name, GType itype)
216 	{
217 		// guint g_signal_lookup (const gchar *name,  GType itype);
218 		return g_signal_lookup(Str.toStringz(name), itype);
219 	}
220 	
221 	/**
222 	 * Given the signal's identifier, finds its name.
223 	 * Two different signals may have the same name, if they have differing types.
224 	 * Params:
225 	 * signalId = the signal's identifying number.
226 	 * Returns: the signal name, or NULL if the signal number was invalid.
227 	 */
228 	public static string name(uint signalId)
229 	{
230 		// const gchar * g_signal_name (guint signal_id);
231 		return Str.toString(g_signal_name(signalId));
232 	}
233 	
234 	/**
235 	 * Lists the signals by id that a certain instance or interface type
236 	 * created. Further information about the signals can be acquired through
237 	 * g_signal_query().
238 	 * Params:
239 	 * itype = Instance or interface type.
240 	 * Returns: Newly allocated array of signal IDs.
241 	 */
242 	public static uint[] listIds(GType itype)
243 	{
244 		// guint * g_signal_list_ids (GType itype,  guint *n_ids);
245 		uint nIds;
246 		auto p = g_signal_list_ids(itype, &nIds);
247 		
248 		if(p is null)
249 		{
250 			return null;
251 		}
252 		
253 		return p[0 .. nIds];
254 	}
255 	
256 	/**
257 	 * Emits a signal.
258 	 * Note that g_signal_emitv() doesn't change return_value if no handlers are
259 	 * connected, in contrast to g_signal_emit() and g_signal_emit_valist().
260 	 * Params:
261 	 * instanceAndParams = argument list for the signal emission. The first
262 	 * element in the array is a GValue for the instance the signal is
263 	 * being emitted on. The rest are any arguments to be passed to the
264 	 * signal.
265 	 * signalId = the signal id
266 	 * detail = the detail
267 	 * returnValue = Location to store the return value of the signal emission.
268 	 */
269 	public static void emitv(Value instanceAndParams, uint signalId, GQuark detail, Value returnValue)
270 	{
271 		// void g_signal_emitv (const GValue *instance_and_params,  guint signal_id,  GQuark detail,  GValue *return_value);
272 		g_signal_emitv((instanceAndParams is null) ? null : instanceAndParams.getValueStruct(), signalId, detail, (returnValue is null) ? null : returnValue.getValueStruct());
273 	}
274 	
275 	/**
276 	 * Emits a signal.
277 	 * Note that g_signal_emit_valist() resets the return value to the default
278 	 * if no handlers are connected, in contrast to g_signal_emitv().
279 	 * Params:
280 	 * signalId = the signal id
281 	 * detail = the detail
282 	 * varArgs = a list of parameters to be passed to the signal, followed by a
283 	 * location for the return value. If the return type of the signal
284 	 * is G_TYPE_NONE, the return value location can be omitted.
285 	 */
286 	public static void emitValist(void* instanc, uint signalId, GQuark detail, void* varArgs)
287 	{
288 		// void g_signal_emit_valist (gpointer instance,  guint signal_id,  GQuark detail,  va_list var_args);
289 		g_signal_emit_valist(instanc, signalId, detail, varArgs);
290 	}
291 	
292 	/**
293 	 * This is similar to g_signal_connect_data(), but uses a closure which
294 	 * ensures that the gobject stays alive during the call to c_handler
295 	 * by temporarily adding a reference count to gobject.
296 	 * Note that there is a bug in GObject that makes this function
297 	 * much less useful than it might seem otherwise. Once gobject is
298 	 * disposed, the callback will no longer be called, but, the signal
299 	 * handler is not currently disconnected. If the
300 	 * instance is itself being freed at the same time than this doesn't
301 	 * matter, since the signal will automatically be removed, but
302 	 * if instance persists, then the signal handler will leak. You
303 	 * should not remove the signal yourself because in a future versions of
304 	 * GObject, the handler will automatically
305 	 * be disconnected.
306 	 * It's possible to work around this problem in a way that will
307 	 * continue to work with future versions of GObject by checking
308 	 * Params:
309 	 * detailedSignal = a string of the form "signal-name::detail".
310 	 * cHandler = the GCallback to connect.
311 	 * gobject = the object to pass as data to c_handler.
312 	 * connectFlags = a combination of GConnnectFlags.
313 	 * Returns: the handler id.
314 	 */
315 	public static gulong connectObject(void* instanc, string detailedSignal, GCallback cHandler, void* gobject, GConnectFlags connectFlags)
316 	{
317 		// gulong g_signal_connect_object (gpointer instance,  const gchar *detailed_signal,  GCallback c_handler,  gpointer gobject,  GConnectFlags connect_flags);
318 		return g_signal_connect_object(instanc, Str.toStringz(detailedSignal), cHandler, gobject, connectFlags);
319 	}
320 	
321 	/**
322 	 * Connects a GCallback function to a signal for a particular object. Similar
323 	 * to g_signal_connect(), but allows to provide a GClosureNotify for the data
324 	 * which will be called when the signal handler is disconnected and no longer
325 	 * used. Specify connect_flags if you need ..._after() or
326 	 * ..._swapped() variants of this function.
327 	 * Params:
328 	 * detailedSignal = a string of the form "signal-name::detail".
329 	 * cHandler = the GCallback to connect.
330 	 * data = data to pass to c_handler calls.
331 	 * destroyData = a GClosureNotify for data.
332 	 * connectFlags = a combination of GConnectFlags.
333 	 * Returns: the handler id
334 	 */
335 	public static gulong connectData(void* instanc, string detailedSignal, GCallback cHandler, void* data, GClosureNotify destroyData, GConnectFlags connectFlags)
336 	{
337 		// gulong g_signal_connect_data (gpointer instance,  const gchar *detailed_signal,  GCallback c_handler,  gpointer data,  GClosureNotify destroy_data,  GConnectFlags connect_flags);
338 		return g_signal_connect_data(instanc, Str.toStringz(detailedSignal), cHandler, data, destroyData, connectFlags);
339 	}
340 	
341 	/**
342 	 * Connects a closure to a signal for a particular object.
343 	 * Params:
344 	 * detailedSignal = a string of the form "signal-name::detail".
345 	 * closure = the closure to connect.
346 	 * after = whether the handler should be called before or after the
347 	 * default handler of the signal.
348 	 * Returns: the handler id
349 	 */
350 	public static gulong connectClosure(void* instanc, string detailedSignal, Closure closure, int after)
351 	{
352 		// gulong g_signal_connect_closure (gpointer instance,  const gchar *detailed_signal,  GClosure *closure,  gboolean after);
353 		return g_signal_connect_closure(instanc, Str.toStringz(detailedSignal), (closure is null) ? null : closure.getClosureStruct(), after);
354 	}
355 	
356 	/**
357 	 * Connects a closure to a signal for a particular object.
358 	 * Params:
359 	 * signalId = the id of the signal.
360 	 * detail = the detail.
361 	 * closure = the closure to connect.
362 	 * after = whether the handler should be called before or after the
363 	 * default handler of the signal.
364 	 * Returns: the handler id
365 	 */
366 	public static gulong connectClosureById(void* instanc, uint signalId, GQuark detail, Closure closure, int after)
367 	{
368 		// gulong g_signal_connect_closure_by_id (gpointer instance,  guint signal_id,  GQuark detail,  GClosure *closure,  gboolean after);
369 		return g_signal_connect_closure_by_id(instanc, signalId, detail, (closure is null) ? null : closure.getClosureStruct(), after);
370 	}
371 	
372 	/**
373 	 * Blocks a handler of an instance so it will not be called during any
374 	 * signal emissions unless it is unblocked again. Thus "blocking" a
375 	 * signal handler means to temporarily deactive it, a signal handler
376 	 * has to be unblocked exactly the same amount of times it has been
377 	 * blocked before to become active again.
378 	 * The handler_id has to be a valid signal handler id, connected to a
379 	 * signal of instance.
380 	 * Params:
381 	 * handlerId = Handler id of the handler to be blocked.
382 	 */
383 	public static void handlerBlock(void* instanc, gulong handlerId)
384 	{
385 		// void g_signal_handler_block (gpointer instance,  gulong handler_id);
386 		g_signal_handler_block(instanc, handlerId);
387 	}
388 	
389 	/**
390 	 * Undoes the effect of a previous g_signal_handler_block() call. A
391 	 * blocked handler is skipped during signal emissions and will not be
392 	 * invoked, unblocking it (for exactly the amount of times it has been
393 	 * blocked before) reverts its "blocked" state, so the handler will be
394 	 * recognized by the signal system and is called upon future or
395 	 * currently ongoing signal emissions (since the order in which
396 	 * handlers are called during signal emissions is deterministic,
397 	 * whether the unblocked handler in question is called as part of a
398 	 * currently ongoing emission depends on how far that emission has
399 	 * proceeded yet).
400 	 * The handler_id has to be a valid id of a signal handler that is
401 	 * connected to a signal of instance and is currently blocked.
402 	 * Params:
403 	 * handlerId = Handler id of the handler to be unblocked.
404 	 */
405 	public static void handlerUnblock(void* instanc, gulong handlerId)
406 	{
407 		// void g_signal_handler_unblock (gpointer instance,  gulong handler_id);
408 		g_signal_handler_unblock(instanc, handlerId);
409 	}
410 	
411 	/**
412 	 * Disconnects a handler from an instance so it will not be called during
413 	 * any future or currently ongoing emissions of the signal it has been
414 	 * connected to. The handler_id becomes invalid and may be reused.
415 	 * The handler_id has to be a valid signal handler id, connected to a
416 	 * signal of instance.
417 	 * Params:
418 	 * handlerId = Handler id of the handler to be disconnected.
419 	 */
420 	public static void handlerDisconnect(void* instanc, gulong handlerId)
421 	{
422 		// void g_signal_handler_disconnect (gpointer instance,  gulong handler_id);
423 		g_signal_handler_disconnect(instanc, handlerId);
424 	}
425 	
426 	/**
427 	 * Finds the first signal handler that matches certain selection criteria.
428 	 * The criteria mask is passed as an OR-ed combination of GSignalMatchType
429 	 * flags, and the criteria values are passed as arguments.
430 	 * The match mask has to be non-0 for successful matches.
431 	 * If no handler was found, 0 is returned.
432 	 * Params:
433 	 * mask = Mask indicating which of signal_id, detail, closure, func
434 	 * and/or data the handler has to match.
435 	 * signalId = Signal the handler has to be connected to.
436 	 * detail = Signal detail the handler has to be connected to.
437 	 * closure = The closure the handler will invoke.
438 	 * func = The C closure callback of the handler (useless for non-C closures).
439 	 * data = The closure data of the handler's closure.
440 	 * Returns: A valid non-0 signal handler id for a successful match.
441 	 */
442 	public static gulong handlerFind(void* instanc, GSignalMatchType mask, uint signalId, GQuark detail, Closure closure, void* func, void* data)
443 	{
444 		// gulong g_signal_handler_find (gpointer instance,  GSignalMatchType mask,  guint signal_id,  GQuark detail,  GClosure *closure,  gpointer func,  gpointer data);
445 		return g_signal_handler_find(instanc, mask, signalId, detail, (closure is null) ? null : closure.getClosureStruct(), func, data);
446 	}
447 	
448 	/**
449 	 * Blocks all handlers on an instance that match a certain selection criteria.
450 	 * The criteria mask is passed as an OR-ed combination of GSignalMatchType
451 	 * flags, and the criteria values are passed as arguments.
452 	 * Passing at least one of the G_SIGNAL_MATCH_CLOSURE, G_SIGNAL_MATCH_FUNC
453 	 * or G_SIGNAL_MATCH_DATA match flags is required for successful matches.
454 	 * If no handlers were found, 0 is returned, the number of blocked handlers
455 	 * otherwise.
456 	 * Params:
457 	 * mask = Mask indicating which of signal_id, detail, closure, func
458 	 * and/or data the handlers have to match.
459 	 * signalId = Signal the handlers have to be connected to.
460 	 * detail = Signal detail the handlers have to be connected to.
461 	 * closure = The closure the handlers will invoke.
462 	 * func = The C closure callback of the handlers (useless for non-C closures).
463 	 * data = The closure data of the handlers' closures.
464 	 * Returns: The number of handlers that matched.
465 	 */
466 	public static uint handlersBlockMatched(void* instanc, GSignalMatchType mask, uint signalId, GQuark detail, Closure closure, void* func, void* data)
467 	{
468 		// guint g_signal_handlers_block_matched (gpointer instance,  GSignalMatchType mask,  guint signal_id,  GQuark detail,  GClosure *closure,  gpointer func,  gpointer data);
469 		return g_signal_handlers_block_matched(instanc, mask, signalId, detail, (closure is null) ? null : closure.getClosureStruct(), func, data);
470 	}
471 	
472 	/**
473 	 * Unblocks all handlers on an instance that match a certain selection
474 	 * criteria. The criteria mask is passed as an OR-ed combination of
475 	 * GSignalMatchType flags, and the criteria values are passed as arguments.
476 	 * Passing at least one of the G_SIGNAL_MATCH_CLOSURE, G_SIGNAL_MATCH_FUNC
477 	 * or G_SIGNAL_MATCH_DATA match flags is required for successful matches.
478 	 * If no handlers were found, 0 is returned, the number of unblocked handlers
479 	 * otherwise. The match criteria should not apply to any handlers that are
480 	 * not currently blocked.
481 	 * Params:
482 	 * mask = Mask indicating which of signal_id, detail, closure, func
483 	 * and/or data the handlers have to match.
484 	 * signalId = Signal the handlers have to be connected to.
485 	 * detail = Signal detail the handlers have to be connected to.
486 	 * closure = The closure the handlers will invoke.
487 	 * func = The C closure callback of the handlers (useless for non-C closures).
488 	 * data = The closure data of the handlers' closures.
489 	 * Returns: The number of handlers that matched.
490 	 */
491 	public static uint handlersUnblockMatched(void* instanc, GSignalMatchType mask, uint signalId, GQuark detail, Closure closure, void* func, void* data)
492 	{
493 		// guint g_signal_handlers_unblock_matched (gpointer instance,  GSignalMatchType mask,  guint signal_id,  GQuark detail,  GClosure *closure,  gpointer func,  gpointer data);
494 		return g_signal_handlers_unblock_matched(instanc, mask, signalId, detail, (closure is null) ? null : closure.getClosureStruct(), func, data);
495 	}
496 	
497 	/**
498 	 * Disconnects all handlers on an instance that match a certain
499 	 * selection criteria. The criteria mask is passed as an OR-ed
500 	 * combination of GSignalMatchType flags, and the criteria values are
501 	 * passed as arguments. Passing at least one of the
502 	 * G_SIGNAL_MATCH_CLOSURE, G_SIGNAL_MATCH_FUNC or
503 	 * G_SIGNAL_MATCH_DATA match flags is required for successful
504 	 * matches. If no handlers were found, 0 is returned, the number of
505 	 * disconnected handlers otherwise.
506 	 * Params:
507 	 * mask = Mask indicating which of signal_id, detail, closure, func
508 	 * and/or data the handlers have to match.
509 	 * signalId = Signal the handlers have to be connected to.
510 	 * detail = Signal detail the handlers have to be connected to.
511 	 * closure = The closure the handlers will invoke.
512 	 * func = The C closure callback of the handlers (useless for non-C closures).
513 	 * data = The closure data of the handlers' closures.
514 	 * Returns: The number of handlers that matched.
515 	 */
516 	public static uint handlersDisconnectMatched(void* instanc, GSignalMatchType mask, uint signalId, GQuark detail, Closure closure, void* func, void* data)
517 	{
518 		// guint g_signal_handlers_disconnect_matched  (gpointer instance,  GSignalMatchType mask,  guint signal_id,  GQuark detail,  GClosure *closure,  gpointer func,  gpointer data);
519 		return g_signal_handlers_disconnect_matched(instanc, mask, signalId, detail, (closure is null) ? null : closure.getClosureStruct(), func, data);
520 	}
521 	
522 	/**
523 	 * Returns whether handler_id is the id of a handler connected to instance.
524 	 * Params:
525 	 * handlerId = the handler id.
526 	 * Returns: whether handler_id identifies a handler connected to instance.
527 	 */
528 	public static int handlerIsConnected(void* instanc, gulong handlerId)
529 	{
530 		// gboolean g_signal_handler_is_connected (gpointer instance,  gulong handler_id);
531 		return g_signal_handler_is_connected(instanc, handlerId);
532 	}
533 	
534 	/**
535 	 * Returns whether there are any handlers connected to instance for the
536 	 * given signal id and detail.
537 	 * One example of when you might use this is when the arguments to the
538 	 * signal are difficult to compute. A class implementor may opt to not
539 	 * emit the signal if no one is attached anyway, thus saving the cost
540 	 * of building the arguments.
541 	 * Params:
542 	 * signalId = the signal id.
543 	 * detail = the detail.
544 	 * mayBeBlocked = whether blocked handlers should count as match.
545 	 * Returns: TRUE if a handler is connected to the signal, FALSE otherwise.
546 	 */
547 	public static int hasHandlerPending(void* instanc, uint signalId, GQuark detail, int mayBeBlocked)
548 	{
549 		// gboolean g_signal_has_handler_pending (gpointer instance,  guint signal_id,  GQuark detail,  gboolean may_be_blocked);
550 		return g_signal_has_handler_pending(instanc, signalId, detail, mayBeBlocked);
551 	}
552 	
553 	/**
554 	 * Stops a signal's current emission.
555 	 * This will prevent the default method from running, if the signal was
556 	 * G_SIGNAL_RUN_LAST and you connected normally (i.e. without the "after"
557 	 * flag).
558 	 * Prints a warning if used on a signal which isn't being emitted.
559 	 * Params:
560 	 * signalId = the signal identifier, as returned by g_signal_lookup().
561 	 * detail = the detail which the signal was emitted with.
562 	 */
563 	public static void stopEmission(void* instanc, uint signalId, GQuark detail)
564 	{
565 		// void g_signal_stop_emission (gpointer instance,  guint signal_id,  GQuark detail);
566 		g_signal_stop_emission(instanc, signalId, detail);
567 	}
568 	
569 	/**
570 	 * Stops a signal's current emission.
571 	 * This is just like g_signal_stop_emission() except it will look up the
572 	 * signal id for you.
573 	 * Params:
574 	 * detailedSignal = a string of the form "signal-name::detail".
575 	 */
576 	public static void stopEmissionByName(void* instanc, string detailedSignal)
577 	{
578 		// void g_signal_stop_emission_by_name (gpointer instance,  const gchar *detailed_signal);
579 		g_signal_stop_emission_by_name(instanc, Str.toStringz(detailedSignal));
580 	}
581 	
582 	/**
583 	 * Overrides the class closure (i.e. the default handler) for the given signal
584 	 * for emissions on instances of instance_type. instance_type must be derived
585 	 * from the type to which the signal belongs.
586 	 * See g_signal_chain_from_overridden() and
587 	 * g_signal_chain_from_overridden_handler() for how to chain up to the
588 	 * parent class closure from inside the overridden one.
589 	 * Params:
590 	 * signalId = the signal id
591 	 * instanceType = the instance type on which to override the class closure
592 	 * for the signal.
593 	 * classClosure = the closure.
594 	 */
595 	public static void overrideClassClosure(uint signalId, GType instanceType, Closure classClosure)
596 	{
597 		// void g_signal_override_class_closure (guint signal_id,  GType instance_type,  GClosure *class_closure);
598 		g_signal_override_class_closure(signalId, instanceType, (classClosure is null) ? null : classClosure.getClosureStruct());
599 	}
600 	
601 	/**
602 	 * Calls the original class closure of a signal. This function should only
603 	 * be called from an overridden class closure; see
604 	 * g_signal_override_class_closure() and
605 	 * g_signal_override_class_handler().
606 	 * Params:
607 	 * instanceAndParams = the argument list of the signal emission. The first
608 	 * element in the array is a GValue for the instance the signal is being
609 	 * emitted on. The rest are any arguments to be passed to the signal.
610 	 * returnValue = Location for the return value.
611 	 */
612 	public static void chainFromOverridden(Value instanceAndParams, Value returnValue)
613 	{
614 		// void g_signal_chain_from_overridden (const GValue *instance_and_params,  GValue *return_value);
615 		g_signal_chain_from_overridden((instanceAndParams is null) ? null : instanceAndParams.getValueStruct(), (returnValue is null) ? null : returnValue.getValueStruct());
616 	}
617 	
618 	/**
619 	 * Overrides the class closure (i.e. the default handler) for the
620 	 * given signal for emissions on instances of instance_type with
621 	 * callabck class_handler. instance_type must be derived from the
622 	 * type to which the signal belongs.
623 	 * See g_signal_chain_from_overridden() and
624 	 * g_signal_chain_from_overridden_handler() for how to chain up to the
625 	 * parent class closure from inside the overridden one.
626 	 * Since 2.18
627 	 * Params:
628 	 * signalName = the name for the signal
629 	 * instanceType = the instance type on which to override the class handler
630 	 * for the signal.
631 	 * classHandler = the handler.
632 	 */
633 	public static void overrideClassHandler(string signalName, GType instanceType, GCallback classHandler)
634 	{
635 		// void g_signal_override_class_handler (const gchar *signal_name,  GType instance_type,  GCallback class_handler);
636 		g_signal_override_class_handler(Str.toStringz(signalName), instanceType, classHandler);
637 	}
638 	
639 	/**
640 	 * Adds an emission hook for a signal, which will get called for any emission
641 	 * of that signal, independent of the instance. This is possible only
642 	 * for signals which don't have G_SIGNAL_NO_HOOKS flag set.
643 	 * Params:
644 	 * signalId = the signal identifier, as returned by g_signal_lookup().
645 	 * detail = the detail on which to call the hook.
646 	 * hookFunc = a GSignalEmissionHook function.
647 	 * hookData = user data for hook_func.
648 	 * dataDestroy = a GDestroyNotify for hook_data.
649 	 * Returns: the hook id, for later use with g_signal_remove_emission_hook().
650 	 */
651 	public static gulong addEmissionHook(uint signalId, GQuark detail, GSignalEmissionHook hookFunc, void* hookData, GDestroyNotify dataDestroy)
652 	{
653 		// gulong g_signal_add_emission_hook (guint signal_id,  GQuark detail,  GSignalEmissionHook hook_func,  gpointer hook_data,  GDestroyNotify data_destroy);
654 		return g_signal_add_emission_hook(signalId, detail, hookFunc, hookData, dataDestroy);
655 	}
656 	
657 	/**
658 	 * Deletes an emission hook.
659 	 * Params:
660 	 * signalId = the id of the signal
661 	 * hookId = the id of the emission hook, as returned by
662 	 * g_signal_add_emission_hook()
663 	 */
664 	public static void removeEmissionHook(uint signalId, gulong hookId)
665 	{
666 		// void g_signal_remove_emission_hook (guint signal_id,  gulong hook_id);
667 		g_signal_remove_emission_hook(signalId, hookId);
668 	}
669 	
670 	/**
671 	 * Internal function to parse a signal name into its signal_id
672 	 * and detail quark.
673 	 * Params:
674 	 * detailedSignal = a string of the form "signal-name::detail".
675 	 * itype = The interface/instance type that introduced "signal-name".
676 	 * signalIdP = Location to store the signal id.
677 	 * detailP = Location to store the detail quark.
678 	 * forceDetailQuark = TRUE forces creation of a GQuark for the detail.
679 	 * Returns: Whether the signal name could successfully be parsed and signal_id_p and detail_p contain valid return values.
680 	 */
681 	public static int parseName(string detailedSignal, GType itype, out uint signalIdP, Quark detailP, int forceDetailQuark)
682 	{
683 		// gboolean g_signal_parse_name (const gchar *detailed_signal,  GType itype,  guint *signal_id_p,  GQuark *detail_p,  gboolean force_detail_quark);
684 		return g_signal_parse_name(Str.toStringz(detailedSignal), itype, &signalIdP, (detailP is null) ? null : detailP.getQuarkStruct(), forceDetailQuark);
685 	}
686 	
687 	/**
688 	 * Returns the invocation hint of the innermost signal emission of instance.
689 	 * Returns: the invocation hint of the innermost signal emission.
690 	 */
691 	public static GSignalInvocationHint* getInvocationHint(void* instanc)
692 	{
693 		// GSignalInvocationHint * g_signal_get_invocation_hint (gpointer instance);
694 		return g_signal_get_invocation_hint(instanc);
695 	}
696 	
697 	/**
698 	 * Creates a new closure which invokes the function found at the offset
699 	 * struct_offset in the class structure of the interface or classed type
700 	 * identified by itype.
701 	 * Params:
702 	 * itype = the GType identifier of an interface or classed type
703 	 * structOffset = the offset of the member function of itype's class
704 	 * structure which is to be invoked by the new closure
705 	 * Returns: a new GCClosure
706 	 */
707 	public static Closure typeCclosureNew(GType itype, uint structOffset)
708 	{
709 		// GClosure * g_signal_type_cclosure_new (GType itype,  guint struct_offset);
710 		auto p = g_signal_type_cclosure_new(itype, structOffset);
711 		
712 		if(p is null)
713 		{
714 			return null;
715 		}
716 		
717 		return ObjectG.getDObject!(Closure)(cast(GClosure*) p);
718 	}
719 	
720 	/**
721 	 * A predefined GSignalAccumulator for signals intended to be used as a
722 	 * hook for application code to provide a particular value. Usually
723 	 * only one such value is desired and multiple handlers for the same
724 	 * signal don't make much sense (except for the case of the default
725 	 * handler defined in the class structure, in which case you will
726 	 * usually want the signal connection to override the class handler).
727 	 * This accumulator will use the return value from the first signal
728 	 * handler that is run as the return value for the signal and not run
729 	 * any further handlers (ie: the first handler "wins").
730 	 * Since 2.28
731 	 * Params:
732 	 * ihint = standard GSignalAccumulator parameter
733 	 * returnAccu = standard GSignalAccumulator parameter
734 	 * handlerReturn = standard GSignalAccumulator parameter
735 	 * dummy = standard GSignalAccumulator parameter
736 	 * Returns: standard GSignalAccumulator result
737 	 */
738 	public static int accumulatorFirstWins(GSignalInvocationHint* ihint, Value returnAccu, Value handlerReturn, void* dummy)
739 	{
740 		// gboolean g_signal_accumulator_first_wins (GSignalInvocationHint *ihint,  GValue *return_accu,  const GValue *handler_return,  gpointer dummy);
741 		return g_signal_accumulator_first_wins(ihint, (returnAccu is null) ? null : returnAccu.getValueStruct(), (handlerReturn is null) ? null : handlerReturn.getValueStruct(), dummy);
742 	}
743 	
744 	/**
745 	 * A predefined GSignalAccumulator for signals that return a
746 	 * boolean values. The behavior that this accumulator gives is
747 	 * that a return of TRUE stops the signal emission: no further
748 	 * callbacks will be invoked, while a return of FALSE allows
749 	 * the emission to continue. The idea here is that a TRUE return
750 	 * indicates that the callback handled the signal,
751 	 * and no further handling is needed.
752 	 * Since 2.4
753 	 * [10] Although signals can deal with any kind of instantiatable
754 	 * type, i'm referring to those types as "object types" in the following,
755 	 * simply because that is the context most users will encounter signals in.
756 	 * Params:
757 	 * ihint = standard GSignalAccumulator parameter
758 	 * returnAccu = standard GSignalAccumulator parameter
759 	 * handlerReturn = standard GSignalAccumulator parameter
760 	 * dummy = standard GSignalAccumulator parameter
761 	 * Returns: standard GSignalAccumulator result
762 	 */
763 	public static int accumulatorTrueHandled(GSignalInvocationHint* ihint, Value returnAccu, Value handlerReturn, void* dummy)
764 	{
765 		// gboolean g_signal_accumulator_true_handled (GSignalInvocationHint *ihint,  GValue *return_accu,  const GValue *handler_return,  gpointer dummy);
766 		return g_signal_accumulator_true_handled(ihint, (returnAccu is null) ? null : returnAccu.getValueStruct(), (handlerReturn is null) ? null : handlerReturn.getValueStruct(), dummy);
767 	}
768 }