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