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