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