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 module gobject.Signals;
26 
27 private import glib.Str;
28 private import glib.c.functions;
29 private import gobject.Closure;
30 private import gobject.DClosure;
31 private import gobject.ObjectG;
32 private import gobject.TypeInstance;
33 private import gobject.Value;
34 private import gobject.c.functions;
35 public  import gobject.c.types;
36 private import std.traits;
37 
38 
39 /** */
40 public struct Signals
41 {
42 	/**
43 	 * Connects a callback to a signal for a particular object.
44 	 *
45 	 * The handler will be called before the default handler of the signal.
46 	 *
47 	 * Params:
48 	 *     instance       = the instance to connect to.
49 	 *     detailedSignal = a string of the form "signal-name::detail".
50 	 *     callback       = the callback to connect.
51 	 *     connectFlags   = a combination of ConnectFlags.
52 	 *
53 	 * Returns: the handler ID, of type gulong (always greater than 0 for successful connections)
54 	 */
55 	public static gulong connect(T)(ObjectG instance, string detailedSignal, T callback, ConnectFlags connectFlags = cast(ConnectFlags)0)
56 	if ( isCallable!T && !is(T == GCallback) )
57 	{
58 		bool after = (connectFlags & ConnectFlags.AFTER) != false;
59 		bool swap = (connectFlags & ConnectFlags.SWAPPED) != false;
60 
61 		DClosure closure = new DClosure(callback, swap);
62 		gulong id = Signals.connectClosure(instance, detailedSignal, closure, after);
63 
64 		instance.signals[id] = closure;
65 		return id;
66 	}
67 
68 	deprecated public static gulong connectData(void* instanc, string detailedSignal, GCallback cHandler, Object data, GClosureNotify destroyData, GConnectFlags connectFlags)
69 	{
70 		return g_signal_connect_data(instanc, Str.toStringz(detailedSignal), cHandler, cast(void*)data, destroyData, connectFlags);
71 	}
72 
73 	/**
74 	 * Disconnects a handler from an instance so it will not be called during
75 	 * any future or currently ongoing emissions of the signal it has been
76 	 * connected to. The @handler_id becomes invalid and may be reused.
77 	 *
78 	 * The @handler_id has to be a valid signal handler id, connected to a
79 	 * signal of @instance.
80 	 *
81 	 * Params:
82 	 *     instance = The instance to remove the signal handler from.
83 	 *     handlerId = Handler id of the handler to be disconnected.
84 	 */
85 	public static void handlerDisconnect(ObjectG instance, gulong handlerId)
86 	{
87 		instance.signals.remove(handlerId);
88 		g_signal_handler_disconnect((instance is null) ? null : instance.getObjectGStruct(), handlerId);
89 	}
90 
91 	/**
92 	 * Connects a GCallback function to a signal for a particular object.
93 	 *
94 	 * The handler will be called before the default handler of the signal.
95 	 *
96 	 * See [memory management of signal handlers][signal-memory-management] for
97 	 * details on how to handle the return value and memory management of @data.
98 	 *
99 	 * Params:
100 	 *     instance       = the instance to connect to.
101 	 *     detailedSignal = a string of the form "signal-name::detail".
102 	 *     cHandler       = the GCallback to connect.
103 	 *     data           = data to pass to cHandler calls.
104 	 *
105 	 * Returns: the handler ID, of type gulong (always greater than 0 for successful connections)
106 	 */
107 	public static gulong connect(ObjectG instanc, string detailedSignal, GCallback cHandler, void* data)
108 	{
109 		return g_signal_connect_data((instanc is null) ? null : instanc.getObjectGStruct(), Str.toStringz(detailedSignal), cHandler, data, null, cast(ConnectFlags)0);
110 	}
111 
112 	/**
113 	 */
114 
115 	/**
116 	 * A predefined #GSignalAccumulator for signals intended to be used as a
117 	 * hook for application code to provide a particular value.  Usually
118 	 * only one such value is desired and multiple handlers for the same
119 	 * signal don't make much sense (except for the case of the default
120 	 * handler defined in the class structure, in which case you will
121 	 * usually want the signal connection to override the class handler).
122 	 *
123 	 * This accumulator will use the return value from the first signal
124 	 * handler that is run as the return value for the signal and not run
125 	 * any further handlers (ie: the first handler "wins").
126 	 *
127 	 * Params:
128 	 *     ihint = standard #GSignalAccumulator parameter
129 	 *     returnAccu = standard #GSignalAccumulator parameter
130 	 *     handlerReturn = standard #GSignalAccumulator parameter
131 	 *     dummy = standard #GSignalAccumulator parameter
132 	 *
133 	 * Returns: standard #GSignalAccumulator result
134 	 *
135 	 * Since: 2.28
136 	 */
137 	public static bool accumulatorFirstWins(GSignalInvocationHint* ihint, Value returnAccu, Value handlerReturn, void* dummy)
138 	{
139 		return g_signal_accumulator_first_wins(ihint, (returnAccu is null) ? null : returnAccu.getValueStruct(), (handlerReturn is null) ? null : handlerReturn.getValueStruct(), dummy) != 0;
140 	}
141 
142 	/**
143 	 * A predefined #GSignalAccumulator for signals that return a
144 	 * boolean values. The behavior that this accumulator gives is
145 	 * that a return of %TRUE stops the signal emission: no further
146 	 * callbacks will be invoked, while a return of %FALSE allows
147 	 * the emission to continue. The idea here is that a %TRUE return
148 	 * indicates that the callback handled the signal, and no further
149 	 * handling is needed.
150 	 *
151 	 * Params:
152 	 *     ihint = standard #GSignalAccumulator parameter
153 	 *     returnAccu = standard #GSignalAccumulator parameter
154 	 *     handlerReturn = standard #GSignalAccumulator parameter
155 	 *     dummy = standard #GSignalAccumulator parameter
156 	 *
157 	 * Returns: standard #GSignalAccumulator result
158 	 *
159 	 * Since: 2.4
160 	 */
161 	public static bool accumulatorTrueHandled(GSignalInvocationHint* ihint, Value returnAccu, Value handlerReturn, void* dummy)
162 	{
163 		return g_signal_accumulator_true_handled(ihint, (returnAccu is null) ? null : returnAccu.getValueStruct(), (handlerReturn is null) ? null : handlerReturn.getValueStruct(), dummy) != 0;
164 	}
165 
166 	/**
167 	 * Adds an emission hook for a signal, which will get called for any emission
168 	 * of that signal, independent of the instance. This is possible only
169 	 * for signals which don't have #G_SIGNAL_NO_HOOKS flag set.
170 	 *
171 	 * Params:
172 	 *     signalId = the signal identifier, as returned by g_signal_lookup().
173 	 *     detail = the detail on which to call the hook.
174 	 *     hookFunc = a #GSignalEmissionHook function.
175 	 *     hookData = user data for @hook_func.
176 	 *     dataDestroy = a #GDestroyNotify for @hook_data.
177 	 *
178 	 * Returns: the hook id, for later use with g_signal_remove_emission_hook().
179 	 */
180 	public static gulong addEmissionHook(uint signalId, GQuark detail, GSignalEmissionHook hookFunc, void* hookData, GDestroyNotify dataDestroy)
181 	{
182 		return g_signal_add_emission_hook(signalId, detail, hookFunc, hookData, dataDestroy);
183 	}
184 
185 	/**
186 	 * Calls the original class closure of a signal. This function should only
187 	 * be called from an overridden class closure; see
188 	 * g_signal_override_class_closure() and
189 	 * g_signal_override_class_handler().
190 	 *
191 	 * Params:
192 	 *     instanceAndParams = the argument list of the signal emission.
193 	 *         The first element in the array is a #GValue for the instance the signal
194 	 *         is being emitted on. The rest are any arguments to be passed to the signal.
195 	 *     returnValue = Location for the return value.
196 	 */
197 	public static void chainFromOverridden(Value[] instanceAndParams, Value returnValue)
198 	{
199 		GValue[] instanceAndParamsArray = new GValue[instanceAndParams.length];
200 		for ( int i = 0; i < instanceAndParams.length; i++ )
201 		{
202 			instanceAndParamsArray[i] = *(instanceAndParams[i].getValueStruct());
203 		}
204 
205 		g_signal_chain_from_overridden(instanceAndParamsArray.ptr, (returnValue is null) ? null : returnValue.getValueStruct());
206 	}
207 
208 	/**
209 	 * Connects a closure to a signal for a particular object.
210 	 *
211 	 * Params:
212 	 *     instance_ = the instance to connect to.
213 	 *     detailedSignal = a string of the form "signal-name::detail".
214 	 *     closure = the closure to connect.
215 	 *     after = whether the handler should be called before or after the
216 	 *         default handler of the signal.
217 	 *
218 	 * Returns: the handler ID (always greater than 0 for successful connections)
219 	 */
220 	public static gulong connectClosure(ObjectG instance_, string detailedSignal, Closure closure, bool after)
221 	{
222 		return g_signal_connect_closure((instance_ is null) ? null : instance_.getObjectGStruct(), Str.toStringz(detailedSignal), (closure is null) ? null : closure.getClosureStruct(), after);
223 	}
224 
225 	/**
226 	 * Connects a closure to a signal for a particular object.
227 	 *
228 	 * Params:
229 	 *     instance_ = the instance to connect to.
230 	 *     signalId = the id of the signal.
231 	 *     detail = the detail.
232 	 *     closure = the closure to connect.
233 	 *     after = whether the handler should be called before or after the
234 	 *         default handler of the signal.
235 	 *
236 	 * Returns: the handler ID (always greater than 0 for successful connections)
237 	 */
238 	public static gulong connectClosureById(ObjectG instance_, uint signalId, GQuark detail, Closure closure, bool after)
239 	{
240 		return g_signal_connect_closure_by_id((instance_ is null) ? null : instance_.getObjectGStruct(), signalId, detail, (closure is null) ? null : closure.getClosureStruct(), after);
241 	}
242 
243 	/**
244 	 * Connects a #GCallback function to a signal for a particular object. Similar
245 	 * to g_signal_connect(), but allows to provide a #GClosureNotify for the data
246 	 * which will be called when the signal handler is disconnected and no longer
247 	 * used. Specify @connect_flags if you need `..._after()` or
248 	 * `..._swapped()` variants of this function.
249 	 *
250 	 * Params:
251 	 *     instance_ = the instance to connect to.
252 	 *     detailedSignal = a string of the form "signal-name::detail".
253 	 *     cHandler = the #GCallback to connect.
254 	 *     data = data to pass to @c_handler calls.
255 	 *     destroyData = a #GClosureNotify for @data.
256 	 *     connectFlags = a combination of #GConnectFlags.
257 	 *
258 	 * Returns: the handler ID (always greater than 0 for successful connections)
259 	 */
260 	public static gulong connectData(ObjectG instance_, string detailedSignal, GCallback cHandler, void* data, GClosureNotify destroyData, GConnectFlags connectFlags)
261 	{
262 		return g_signal_connect_data((instance_ is null) ? null : instance_.getObjectGStruct(), Str.toStringz(detailedSignal), cHandler, data, destroyData, connectFlags);
263 	}
264 
265 	/**
266 	 * This is similar to g_signal_connect_data(), but uses a closure which
267 	 * ensures that the @gobject stays alive during the call to @c_handler
268 	 * by temporarily adding a reference count to @gobject.
269 	 *
270 	 * When the @gobject is destroyed the signal handler will be automatically
271 	 * disconnected.  Note that this is not currently threadsafe (ie:
272 	 * emitting a signal while @gobject is being destroyed in another thread
273 	 * is not safe).
274 	 *
275 	 * Params:
276 	 *     instance_ = the instance to connect to.
277 	 *     detailedSignal = a string of the form "signal-name::detail".
278 	 *     cHandler = the #GCallback to connect.
279 	 *     gobject = the object to pass as data
280 	 *         to @c_handler.
281 	 *     connectFlags = a combination of #GConnectFlags.
282 	 *
283 	 * Returns: the handler id.
284 	 */
285 	public static gulong connectObject(TypeInstance instance_, string detailedSignal, GCallback cHandler, ObjectG gobject, GConnectFlags connectFlags)
286 	{
287 		return g_signal_connect_object((instance_ is null) ? null : instance_.getTypeInstanceStruct(), Str.toStringz(detailedSignal), cHandler, (gobject is null) ? null : gobject.getObjectGStruct(), connectFlags);
288 	}
289 
290 	/**
291 	 * Emits a signal.
292 	 *
293 	 * Note that g_signal_emit_valist() resets the return value to the default
294 	 * if no handlers are connected, in contrast to g_signal_emitv().
295 	 *
296 	 * Params:
297 	 *     instance_ = the instance the signal is being
298 	 *         emitted on.
299 	 *     signalId = the signal id
300 	 *     detail = the detail
301 	 *     varArgs = a list of parameters to be passed to the signal, followed by a
302 	 *         location for the return value. If the return type of the signal
303 	 *         is #G_TYPE_NONE, the return value location can be omitted.
304 	 */
305 	public static void emitValist(TypeInstance instance_, uint signalId, GQuark detail, void* varArgs)
306 	{
307 		g_signal_emit_valist((instance_ is null) ? null : instance_.getTypeInstanceStruct(), signalId, detail, varArgs);
308 	}
309 
310 	/**
311 	 * Emits a signal.
312 	 *
313 	 * Note that g_signal_emitv() doesn't change @return_value if no handlers are
314 	 * connected, in contrast to g_signal_emit() and g_signal_emit_valist().
315 	 *
316 	 * Params:
317 	 *     instanceAndParams = argument list for the signal emission.
318 	 *         The first element in the array is a #GValue for the instance the signal
319 	 *         is being emitted on. The rest are any arguments to be passed to the signal.
320 	 *     signalId = the signal id
321 	 *     detail = the detail
322 	 *     returnValue = Location to
323 	 *         store the return value of the signal emission. This must be provided if the
324 	 *         specified signal returns a value, but may be ignored otherwise.
325 	 */
326 	public static void emitv(Value[] instanceAndParams, uint signalId, GQuark detail, ref Value returnValue)
327 	{
328 		GValue[] instanceAndParamsArray = new GValue[instanceAndParams.length];
329 		for ( int i = 0; i < instanceAndParams.length; i++ )
330 		{
331 			instanceAndParamsArray[i] = *(instanceAndParams[i].getValueStruct());
332 		}
333 
334 		g_signal_emitv(instanceAndParamsArray.ptr, signalId, detail, (returnValue is null) ? null : returnValue.getValueStruct());
335 	}
336 
337 	/**
338 	 * Returns the invocation hint of the innermost signal emission of instance.
339 	 *
340 	 * Params:
341 	 *     instance_ = the instance to query
342 	 *
343 	 * Returns: the invocation hint of the innermost
344 	 *     signal emission, or %NULL if not found.
345 	 */
346 	public static GSignalInvocationHint* getInvocationHint(ObjectG instance_)
347 	{
348 		return g_signal_get_invocation_hint((instance_ is null) ? null : instance_.getObjectGStruct());
349 	}
350 
351 	/**
352 	 * Blocks a handler of an instance so it will not be called during any
353 	 * signal emissions unless it is unblocked again. Thus "blocking" a
354 	 * signal handler means to temporarily deactivate it, a signal handler
355 	 * has to be unblocked exactly the same amount of times it has been
356 	 * blocked before to become active again.
357 	 *
358 	 * The @handler_id has to be a valid signal handler id, connected to a
359 	 * signal of @instance.
360 	 *
361 	 * Params:
362 	 *     instance_ = The instance to block the signal handler of.
363 	 *     handlerId = Handler id of the handler to be blocked.
364 	 */
365 	public static void handlerBlock(ObjectG instance_, gulong handlerId)
366 	{
367 		g_signal_handler_block((instance_ is null) ? null : instance_.getObjectGStruct(), handlerId);
368 	}
369 
370 	/**
371 	 * Finds the first signal handler that matches certain selection criteria.
372 	 * The criteria mask is passed as an OR-ed combination of #GSignalMatchType
373 	 * flags, and the criteria values are passed as arguments.
374 	 * The match @mask has to be non-0 for successful matches.
375 	 * If no handler was found, 0 is returned.
376 	 *
377 	 * Params:
378 	 *     instance_ = The instance owning the signal handler to be found.
379 	 *     mask = Mask indicating which of @signal_id, @detail, @closure, @func
380 	 *         and/or @data the handler has to match.
381 	 *     signalId = Signal the handler has to be connected to.
382 	 *     detail = Signal detail the handler has to be connected to.
383 	 *     closure = The closure the handler will invoke.
384 	 *     func = The C closure callback of the handler (useless for non-C closures).
385 	 *     data = The closure data of the handler's closure.
386 	 *
387 	 * Returns: A valid non-0 signal handler id for a successful match.
388 	 */
389 	public static gulong handlerFind(ObjectG instance_, GSignalMatchType mask, uint signalId, GQuark detail, Closure closure, void* func, void* data)
390 	{
391 		return g_signal_handler_find((instance_ is null) ? null : instance_.getObjectGStruct(), mask, signalId, detail, (closure is null) ? null : closure.getClosureStruct(), func, data);
392 	}
393 
394 	/**
395 	 * Returns whether @handler_id is the ID of a handler connected to @instance.
396 	 *
397 	 * Params:
398 	 *     instance_ = The instance where a signal handler is sought.
399 	 *     handlerId = the handler ID.
400 	 *
401 	 * Returns: whether @handler_id identifies a handler connected to @instance.
402 	 */
403 	public static bool handlerIsConnected(ObjectG instance_, gulong handlerId)
404 	{
405 		return g_signal_handler_is_connected((instance_ is null) ? null : instance_.getObjectGStruct(), handlerId) != 0;
406 	}
407 
408 	/**
409 	 * Undoes the effect of a previous g_signal_handler_block() call.  A
410 	 * blocked handler is skipped during signal emissions and will not be
411 	 * invoked, unblocking it (for exactly the amount of times it has been
412 	 * blocked before) reverts its "blocked" state, so the handler will be
413 	 * recognized by the signal system and is called upon future or
414 	 * currently ongoing signal emissions (since the order in which
415 	 * handlers are called during signal emissions is deterministic,
416 	 * whether the unblocked handler in question is called as part of a
417 	 * currently ongoing emission depends on how far that emission has
418 	 * proceeded yet).
419 	 *
420 	 * The @handler_id has to be a valid id of a signal handler that is
421 	 * connected to a signal of @instance and is currently blocked.
422 	 *
423 	 * Params:
424 	 *     instance_ = The instance to unblock the signal handler of.
425 	 *     handlerId = Handler id of the handler to be unblocked.
426 	 */
427 	public static void handlerUnblock(ObjectG instance_, gulong handlerId)
428 	{
429 		g_signal_handler_unblock((instance_ is null) ? null : instance_.getObjectGStruct(), handlerId);
430 	}
431 
432 	/**
433 	 * Blocks all handlers on an instance that match a certain selection criteria.
434 	 * The criteria mask is passed as an OR-ed combination of #GSignalMatchType
435 	 * flags, and the criteria values are passed as arguments.
436 	 * Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
437 	 * or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
438 	 * If no handlers were found, 0 is returned, the number of blocked handlers
439 	 * otherwise.
440 	 *
441 	 * Params:
442 	 *     instance_ = The instance to block handlers from.
443 	 *     mask = Mask indicating which of @signal_id, @detail, @closure, @func
444 	 *         and/or @data the handlers have to match.
445 	 *     signalId = Signal the handlers have to be connected to.
446 	 *     detail = Signal detail the handlers have to be connected to.
447 	 *     closure = The closure the handlers will invoke.
448 	 *     func = The C closure callback of the handlers (useless for non-C closures).
449 	 *     data = The closure data of the handlers' closures.
450 	 *
451 	 * Returns: The number of handlers that matched.
452 	 */
453 	public static uint handlersBlockMatched(ObjectG instance_, GSignalMatchType mask, uint signalId, GQuark detail, Closure closure, void* func, void* data)
454 	{
455 		return g_signal_handlers_block_matched((instance_ is null) ? null : instance_.getObjectGStruct(), mask, signalId, detail, (closure is null) ? null : closure.getClosureStruct(), func, data);
456 	}
457 
458 	/**
459 	 * Destroy all signal handlers of a type instance. This function is
460 	 * an implementation detail of the #GObject dispose implementation,
461 	 * and should not be used outside of the type system.
462 	 *
463 	 * Params:
464 	 *     instance_ = The instance whose signal handlers are destroyed
465 	 */
466 	public static void handlersDestroy(ObjectG instance_)
467 	{
468 		g_signal_handlers_destroy((instance_ is null) ? null : instance_.getObjectGStruct());
469 	}
470 
471 	/**
472 	 * Disconnects all handlers on an instance that match a certain
473 	 * selection criteria. The criteria mask is passed as an OR-ed
474 	 * combination of #GSignalMatchType flags, and the criteria values are
475 	 * passed as arguments.  Passing at least one of the
476 	 * %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC or
477 	 * %G_SIGNAL_MATCH_DATA match flags is required for successful
478 	 * matches.  If no handlers were found, 0 is returned, the number of
479 	 * disconnected handlers otherwise.
480 	 *
481 	 * Params:
482 	 *     instance_ = The instance to remove handlers from.
483 	 *     mask = Mask indicating which of @signal_id, @detail, @closure, @func
484 	 *         and/or @data the handlers have to match.
485 	 *     signalId = Signal the handlers have to be connected to.
486 	 *     detail = Signal detail the handlers have to be connected to.
487 	 *     closure = The closure the handlers will invoke.
488 	 *     func = The C closure callback of the handlers (useless for non-C closures).
489 	 *     data = The closure data of the handlers' closures.
490 	 *
491 	 * Returns: The number of handlers that matched.
492 	 */
493 	public static uint handlersDisconnectMatched(ObjectG instance_, GSignalMatchType mask, uint signalId, GQuark detail, Closure closure, void* func, void* data)
494 	{
495 		return g_signal_handlers_disconnect_matched((instance_ is null) ? null : instance_.getObjectGStruct(), mask, signalId, detail, (closure is null) ? null : closure.getClosureStruct(), func, data);
496 	}
497 
498 	/**
499 	 * Unblocks all handlers on an instance that match a certain selection
500 	 * criteria. The criteria mask is passed as an OR-ed combination of
501 	 * #GSignalMatchType flags, and the criteria values are passed as arguments.
502 	 * Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
503 	 * or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
504 	 * If no handlers were found, 0 is returned, the number of unblocked handlers
505 	 * otherwise. The match criteria should not apply to any handlers that are
506 	 * not currently blocked.
507 	 *
508 	 * Params:
509 	 *     instance_ = The instance to unblock handlers from.
510 	 *     mask = Mask indicating which of @signal_id, @detail, @closure, @func
511 	 *         and/or @data the handlers have to match.
512 	 *     signalId = Signal the handlers have to be connected to.
513 	 *     detail = Signal detail the handlers have to be connected to.
514 	 *     closure = The closure the handlers will invoke.
515 	 *     func = The C closure callback of the handlers (useless for non-C closures).
516 	 *     data = The closure data of the handlers' closures.
517 	 *
518 	 * Returns: The number of handlers that matched.
519 	 */
520 	public static uint handlersUnblockMatched(ObjectG instance_, GSignalMatchType mask, uint signalId, GQuark detail, Closure closure, void* func, void* data)
521 	{
522 		return g_signal_handlers_unblock_matched((instance_ is null) ? null : instance_.getObjectGStruct(), mask, signalId, detail, (closure is null) ? null : closure.getClosureStruct(), func, data);
523 	}
524 
525 	/**
526 	 * Returns whether there are any handlers connected to @instance for the
527 	 * given signal id and detail.
528 	 *
529 	 * If @detail is 0 then it will only match handlers that were connected
530 	 * without detail.  If @detail is non-zero then it will match handlers
531 	 * connected both without detail and with the given detail.  This is
532 	 * consistent with how a signal emitted with @detail would be delivered
533 	 * to those handlers.
534 	 *
535 	 * Since 2.46 this also checks for a non-default class closure being
536 	 * installed, as this is basically always what you want.
537 	 *
538 	 * One example of when you might use this is when the arguments to the
539 	 * signal are difficult to compute. A class implementor may opt to not
540 	 * emit the signal if no one is attached anyway, thus saving the cost
541 	 * of building the arguments.
542 	 *
543 	 * Params:
544 	 *     instance_ = the object whose signal handlers are sought.
545 	 *     signalId = the signal id.
546 	 *     detail = the detail.
547 	 *     mayBeBlocked = whether blocked handlers should count as match.
548 	 *
549 	 * Returns: %TRUE if a handler is connected to the signal, %FALSE
550 	 *     otherwise.
551 	 */
552 	public static bool hasHandlerPending(ObjectG instance_, uint signalId, GQuark detail, bool mayBeBlocked)
553 	{
554 		return g_signal_has_handler_pending((instance_ is null) ? null : instance_.getObjectGStruct(), signalId, detail, mayBeBlocked) != 0;
555 	}
556 
557 	/**
558 	 * Lists the signals by id that a certain instance or interface type
559 	 * created. Further information about the signals can be acquired through
560 	 * g_signal_query().
561 	 *
562 	 * Params:
563 	 *     itype = Instance or interface type.
564 	 *
565 	 * Returns: Newly allocated array of signal IDs.
566 	 */
567 	public static uint[] listIds(GType itype)
568 	{
569 		uint nIds;
570 
571 		auto __p = g_signal_list_ids(itype, &nIds);
572 
573 		return __p[0 .. nIds];
574 	}
575 
576 	/**
577 	 * Given the name of the signal and the type of object it connects to, gets
578 	 * the signal's identifying integer. Emitting the signal by number is
579 	 * somewhat faster than using the name each time.
580 	 *
581 	 * Also tries the ancestors of the given type.
582 	 *
583 	 * The type class passed as @itype must already have been instantiated (for
584 	 * example, using g_type_class_ref()) for this function to work, as signals are
585 	 * always installed during class initialization.
586 	 *
587 	 * See g_signal_new() for details on allowed signal names.
588 	 *
589 	 * Params:
590 	 *     name = the signal's name.
591 	 *     itype = the type that the signal operates on.
592 	 *
593 	 * Returns: the signal's identifying number, or 0 if no signal was found.
594 	 */
595 	public static uint lookup(string name, GType itype)
596 	{
597 		return g_signal_lookup(Str.toStringz(name), itype);
598 	}
599 
600 	/**
601 	 * Given the signal's identifier, finds its name.
602 	 *
603 	 * Two different signals may have the same name, if they have differing types.
604 	 *
605 	 * Params:
606 	 *     signalId = the signal's identifying number.
607 	 *
608 	 * Returns: the signal name, or %NULL if the signal number was invalid.
609 	 */
610 	public static string name(uint signalId)
611 	{
612 		return Str.toString(g_signal_name(signalId));
613 	}
614 
615 	/**
616 	 * Creates a new signal. (This is usually done in the class initializer.)
617 	 *
618 	 * See g_signal_new() for details on allowed signal names.
619 	 *
620 	 * If c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as
621 	 * the marshaller for this signal.
622 	 *
623 	 * Params:
624 	 *     signalName = the name for the signal
625 	 *     itype = the type this signal pertains to. It will also pertain to
626 	 *         types which are derived from this type.
627 	 *     signalFlags = a combination of #GSignalFlags specifying detail of when
628 	 *         the default handler is to be invoked. You should at least specify
629 	 *         %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
630 	 *     classClosure = The closure to invoke on signal emission; may be %NULL.
631 	 *     accumulator = the accumulator for this signal; may be %NULL.
632 	 *     accuData = user data for the @accumulator.
633 	 *     cMarshaller = the function to translate arrays of parameter
634 	 *         values to signal emissions into C language callback invocations or %NULL.
635 	 *     returnType = the type of return value, or #G_TYPE_NONE for a signal
636 	 *         without a return value.
637 	 *     nParams = the number of parameter types in @args.
638 	 *     args = va_list of #GType, one for each parameter.
639 	 *
640 	 * Returns: the signal id
641 	 */
642 	public static uint newValist(string signalName, GType itype, GSignalFlags signalFlags, Closure classClosure, GSignalAccumulator accumulator, void* accuData, GSignalCMarshaller cMarshaller, GType returnType, uint nParams, void* args)
643 	{
644 		return g_signal_new_valist(Str.toStringz(signalName), itype, signalFlags, (classClosure is null) ? null : classClosure.getClosureStruct(), accumulator, accuData, cMarshaller, returnType, nParams, args);
645 	}
646 
647 	/**
648 	 * Creates a new signal. (This is usually done in the class initializer.)
649 	 *
650 	 * See g_signal_new() for details on allowed signal names.
651 	 *
652 	 * If c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as
653 	 * the marshaller for this signal.
654 	 *
655 	 * Params:
656 	 *     signalName = the name for the signal
657 	 *     itype = the type this signal pertains to. It will also pertain to
658 	 *         types which are derived from this type
659 	 *     signalFlags = a combination of #GSignalFlags specifying detail of when
660 	 *         the default handler is to be invoked. You should at least specify
661 	 *         %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST
662 	 *     classClosure = The closure to invoke on signal emission;
663 	 *         may be %NULL
664 	 *     accumulator = the accumulator for this signal; may be %NULL
665 	 *     accuData = user data for the @accumulator
666 	 *     cMarshaller = the function to translate arrays of
667 	 *         parameter values to signal emissions into C language callback
668 	 *         invocations or %NULL
669 	 *     returnType = the type of return value, or #G_TYPE_NONE for a signal
670 	 *         without a return value
671 	 *     paramTypes = an array of types, one for
672 	 *         each parameter (may be %NULL if @n_params is zero)
673 	 *
674 	 * Returns: the signal id
675 	 */
676 	public static uint newv(string signalName, GType itype, GSignalFlags signalFlags, Closure classClosure, GSignalAccumulator accumulator, void* accuData, GSignalCMarshaller cMarshaller, GType returnType, GType[] paramTypes)
677 	{
678 		return g_signal_newv(Str.toStringz(signalName), itype, signalFlags, (classClosure is null) ? null : classClosure.getClosureStruct(), accumulator, accuData, cMarshaller, returnType, cast(uint)paramTypes.length, paramTypes.ptr);
679 	}
680 
681 	/**
682 	 * Overrides the class closure (i.e. the default handler) for the given signal
683 	 * for emissions on instances of @instance_type. @instance_type must be derived
684 	 * from the type to which the signal belongs.
685 	 *
686 	 * See g_signal_chain_from_overridden() and
687 	 * g_signal_chain_from_overridden_handler() for how to chain up to the
688 	 * parent class closure from inside the overridden one.
689 	 *
690 	 * Params:
691 	 *     signalId = the signal id
692 	 *     instanceType = the instance type on which to override the class closure
693 	 *         for the signal.
694 	 *     classClosure = the closure.
695 	 */
696 	public static void overrideClassClosure(uint signalId, GType instanceType, Closure classClosure)
697 	{
698 		g_signal_override_class_closure(signalId, instanceType, (classClosure is null) ? null : classClosure.getClosureStruct());
699 	}
700 
701 	/**
702 	 * Overrides the class closure (i.e. the default handler) for the
703 	 * given signal for emissions on instances of @instance_type with
704 	 * callback @class_handler. @instance_type must be derived from the
705 	 * type to which the signal belongs.
706 	 *
707 	 * See g_signal_chain_from_overridden() and
708 	 * g_signal_chain_from_overridden_handler() for how to chain up to the
709 	 * parent class closure from inside the overridden one.
710 	 *
711 	 * Params:
712 	 *     signalName = the name for the signal
713 	 *     instanceType = the instance type on which to override the class handler
714 	 *         for the signal.
715 	 *     classHandler = the handler.
716 	 *
717 	 * Since: 2.18
718 	 */
719 	public static void overrideClassHandler(string signalName, GType instanceType, GCallback classHandler)
720 	{
721 		g_signal_override_class_handler(Str.toStringz(signalName), instanceType, classHandler);
722 	}
723 
724 	/**
725 	 * Internal function to parse a signal name into its @signal_id
726 	 * and @detail quark.
727 	 *
728 	 * Params:
729 	 *     detailedSignal = a string of the form "signal-name::detail".
730 	 *     itype = The interface/instance type that introduced "signal-name".
731 	 *     signalIdP = Location to store the signal id.
732 	 *     detailP = Location to store the detail quark.
733 	 *     forceDetailQuark = %TRUE forces creation of a #GQuark for the detail.
734 	 *
735 	 * Returns: Whether the signal name could successfully be parsed and @signal_id_p and @detail_p contain valid return values.
736 	 */
737 	public static bool parseName(string detailedSignal, GType itype, out uint signalIdP, out GQuark detailP, bool forceDetailQuark)
738 	{
739 		return g_signal_parse_name(Str.toStringz(detailedSignal), itype, &signalIdP, &detailP, forceDetailQuark) != 0;
740 	}
741 
742 	/**
743 	 * Queries the signal system for in-depth information about a
744 	 * specific signal. This function will fill in a user-provided
745 	 * structure to hold signal-specific information. If an invalid
746 	 * signal id is passed in, the @signal_id member of the #GSignalQuery
747 	 * is 0. All members filled into the #GSignalQuery structure should
748 	 * be considered constant and have to be left untouched.
749 	 *
750 	 * Params:
751 	 *     signalId = The signal id of the signal to query information for.
752 	 *     query = A user provided structure that is
753 	 *         filled in with constant values upon success.
754 	 */
755 	public static void query(uint signalId, out GSignalQuery query)
756 	{
757 		g_signal_query(signalId, &query);
758 	}
759 
760 	/**
761 	 * Deletes an emission hook.
762 	 *
763 	 * Params:
764 	 *     signalId = the id of the signal
765 	 *     hookId = the id of the emission hook, as returned by
766 	 *         g_signal_add_emission_hook()
767 	 */
768 	public static void removeEmission(uint signalId, gulong hookId)
769 	{
770 		g_signal_remove_emission_hook(signalId, hookId);
771 	}
772 
773 	/**
774 	 * Change the #GSignalCVaMarshaller used for a given signal.  This is a
775 	 * specialised form of the marshaller that can often be used for the
776 	 * common case of a single connected signal handler and avoids the
777 	 * overhead of #GValue.  Its use is optional.
778 	 *
779 	 * Params:
780 	 *     signalId = the signal id
781 	 *     instanceType = the instance type on which to set the marshaller.
782 	 *     vaMarshaller = the marshaller to set.
783 	 *
784 	 * Since: 2.32
785 	 */
786 	public static void setVaMarshaller(uint signalId, GType instanceType, GSignalCVaMarshaller vaMarshaller)
787 	{
788 		g_signal_set_va_marshaller(signalId, instanceType, vaMarshaller);
789 	}
790 
791 	/**
792 	 * Stops a signal's current emission.
793 	 *
794 	 * This will prevent the default method from running, if the signal was
795 	 * %G_SIGNAL_RUN_LAST and you connected normally (i.e. without the "after"
796 	 * flag).
797 	 *
798 	 * Prints a warning if used on a signal which isn't being emitted.
799 	 *
800 	 * Params:
801 	 *     instance_ = the object whose signal handlers you wish to stop.
802 	 *     signalId = the signal identifier, as returned by g_signal_lookup().
803 	 *     detail = the detail which the signal was emitted with.
804 	 */
805 	public static void stopEmission(ObjectG instance_, uint signalId, GQuark detail)
806 	{
807 		g_signal_stop_emission((instance_ is null) ? null : instance_.getObjectGStruct(), signalId, detail);
808 	}
809 
810 	/**
811 	 * Stops a signal's current emission.
812 	 *
813 	 * This is just like g_signal_stop_emission() except it will look up the
814 	 * signal id for you.
815 	 *
816 	 * Params:
817 	 *     instance_ = the object whose signal handlers you wish to stop.
818 	 *     detailedSignal = a string of the form "signal-name::detail".
819 	 */
820 	public static void stopEmissionByName(ObjectG instance_, string detailedSignal)
821 	{
822 		g_signal_stop_emission_by_name((instance_ is null) ? null : instance_.getObjectGStruct(), Str.toStringz(detailedSignal));
823 	}
824 
825 	/**
826 	 * Creates a new closure which invokes the function found at the offset
827 	 * @struct_offset in the class structure of the interface or classed type
828 	 * identified by @itype.
829 	 *
830 	 * Params:
831 	 *     itype = the #GType identifier of an interface or classed type
832 	 *     structOffset = the offset of the member function of @itype's class
833 	 *         structure which is to be invoked by the new closure
834 	 *
835 	 * Returns: a floating reference to a new #GCClosure
836 	 */
837 	public static Closure typeCclosureNew(GType itype, uint structOffset)
838 	{
839 		auto __p = g_signal_type_cclosure_new(itype, structOffset);
840 
841 		if(__p is null)
842 		{
843 			return null;
844 		}
845 
846 		return ObjectG.getDObject!(Closure)(cast(GClosure*) __p);
847 	}
848 
849 	/**
850 	 * Disconnects a handler from @instance so it will not be called during
851 	 * any future or currently ongoing emissions of the signal it has been
852 	 * connected to. The @handler_id_ptr is then set to zero, which is never a valid handler ID value (see g_signal_connect()).
853 	 *
854 	 * If the handler ID is 0 then this function does nothing.
855 	 *
856 	 * There is also a macro version of this function so that the code
857 	 * will be inlined.
858 	 *
859 	 * Params:
860 	 *     handlerIdPtr = A pointer to a handler ID (of type #gulong) of the handler to be disconnected.
861 	 *     instance_ = The instance to remove the signal handler from.
862 	 *         This pointer may be %NULL or invalid, if the handler ID is zero.
863 	 *
864 	 * Since: 2.62
865 	 */
866 	public static void clearSignalHandler(gulong* handlerIdPtr, ObjectG instance_)
867 	{
868 		g_clear_signal_handler(handlerIdPtr, (instance_ is null) ? null : instance_.getObjectGStruct());
869 	}
870 }