2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gobject-Signals.html
50 * - GClosure* -> Closure
57 module gobject
.Signals
;
63 import tango
.io
.Stdout
; // use the tango loging?
67 private import gtkc
.gobjecttypes
;
69 private import gtkc
.gobject
;
72 private import glib
.Str
;
73 private import gobject
.Closure
;
74 private import gobject
.Type
;
75 private import gobject
.Value
;
76 private import glib
.Quark
;
83 * The basic concept of the signal system is that of the emission
85 * Signals are introduced per-type and are identified through strings.
86 * Signals introduced for a parent type are available in derived types as well,
87 * so basically they are a per-type facility that is inherited.
88 * A signal emission mainly involves invocation of a certain set of callbacks in
89 * precisely defined manner. There are two main categories of such callbacks,
92 * ones and user provided ones.
93 * The per-object callbacks are most often referred to as "object method
94 * handler" or "default (signal) handler", while user provided callbacks are
95 * usually just called "signal handler".
96 * The object method handler is provided at signal creation time (this most
97 * frequently happens at the end of an object class' creation), while user
98 * provided handlers are frequently connected and disconnected to/from a certain
99 * signal on certain object instances.
100 * A signal emission consists of five stages, unless prematurely stopped:
101 * 1 - Invocation of the object method handler for G_SIGNAL_RUN_FIRST signals
102 * 2 - Invocation of normal user-provided signal handlers (after flag FALSE)
103 * 3 - Invocation of the object method handler for G_SIGNAL_RUN_LAST signals
104 * 4 - Invocation of user provided signal handlers, connected with an after flag of TRUE
105 * 5 - Invocation of the object method handler for G_SIGNAL_RUN_CLEANUP signals
106 * The user-provided signal handlers are called in the order they were
108 * All handlers may prematurely stop a signal emission, and any number of
109 * handlers may be connected, disconnected, blocked or unblocked during
111 * There are certain criteria for skipping user handlers in stages 2 and 4
112 * of a signal emission.
113 * First, user handlers may be blocked, blocked handlers are omitted
114 * during callback invocation, to return from the "blocked" state, a
115 * handler has to get unblocked exactly the same amount of times
116 * it has been blocked before.
117 * Second, upon emission of a G_SIGNAL_DETAILED signal, an additional
118 * "detail" argument passed in to g_signal_emit() has to match the detail
119 * argument of the signal handler currently subject to invocation.
120 * Specification of no detail argument for signal handlers (omission of the
121 * detail part of the signal specification upon connection) serves as a
122 * wildcard and matches any detail argument passed in to emission.
127 public static uint connectData(void* instanc
, char[] detailedSignal
, GCallback cHandler
, Object data
, GClosureNotify destroyData
, GConnectFlags connectFlags
)
129 // gulong g_signal_connect_data (gpointer instance, const gchar *detailed_signal, GCallback c_handler, gpointer data, GClosureNotify destroy_data, GConnectFlags connect_flags);
130 return g_signal_connect_data(instanc
, Str
.toStringz(detailedSignal
), cHandler
, cast(void*)data
, destroyData
, connectFlags
);
148 * Creates a new signal. (This is usually done in the class initializer.)
149 * A signal name consists of segments consisting of ASCII letters and
150 * digits, separated by either the '-' or '_' character. The first
151 * character of a signal name must be a letter. Names which violate these
152 * rules lead to undefined behaviour of the GSignal system.
153 * When registering a signal and looking up a signal, either separator can
154 * be used, but they cannot be mixed.
156 * the name for the signal
158 * the type this signal pertains to. It will also pertain to
159 * types which are derived from this type.
161 * a combination of GSignalFlags specifying detail of when
162 * the default handler is to be invoked. You should at least specify
163 * G_SIGNAL_RUN_FIRST or G_SIGNAL_RUN_LAST.
165 * The offset of the function pointer in the class structure
166 * for this type. Used to invoke a class method generically. Pass 0 to
167 * not associate a class method with this signal.
169 * the accumulator for this signal; may be NULL.
171 * user data for the accumulator.
173 * the function to translate arrays of parameter values to
174 * signal emissions into C language callback invocations.
176 * the type of return value, or G_TYPE_NONE for a signal
177 * without a return value.
179 * the number of parameter types to follow.
181 * a list of types, one for each parameter.
185 public static uint newSignals(char[] signalName
, GType itype
, GSignalFlags signalFlags
, uint classOffset
, GSignalAccumulator accumulator
, void* accuData
, GSignalCMarshaller cMarshaller
, GType returnType
, uint nParams
, ... )
187 // guint g_signal_new (const gchar *signal_name, GType itype, GSignalFlags signal_flags, guint class_offset, GSignalAccumulator accumulator, gpointer accu_data, GSignalCMarshaller c_marshaller, GType return_type, guint n_params, ...);
188 return g_signal_new(Str
.toStringz(signalName
), itype
, signalFlags
, classOffset
, accumulator
, accuData
, cMarshaller
, returnType
, nParams
);
192 * Creates a new signal. (This is usually done in the class initializer.)
193 * See g_signal_new() for details on allowed signal names.
195 * the name for the signal
197 * the type this signal pertains to. It will also pertain to
198 * types which are derived from this type.
200 * a combination of GSignalFlags specifying detail of when
201 * the default handler is to be invoked. You should at least specify
202 * G_SIGNAL_RUN_FIRST or G_SIGNAL_RUN_LAST.
204 * The closure to invoke on signal emission; may be NULL.
206 * the accumulator for this signal; may be NULL.
208 * user data for the accumulator.
210 * the function to translate arrays of parameter values to
211 * signal emissions into C language callback invocations.
213 * the type of return value, or G_TYPE_NONE for a signal
214 * without a return value.
216 * the length of param_types.
218 * an array types, one for each parameter.
222 public static uint newv(char[] signalName
, GType itype
, GSignalFlags signalFlags
, Closure classClosure
, GSignalAccumulator accumulator
, void* accuData
, GSignalCMarshaller cMarshaller
, GType returnType
, uint nParams
, GType
* paramTypes
)
224 // guint g_signal_newv (const gchar *signal_name, GType itype, GSignalFlags signal_flags, GClosure *class_closure, GSignalAccumulator accumulator, gpointer accu_data, GSignalCMarshaller c_marshaller, GType return_type, guint n_params, GType *param_types);
225 return g_signal_newv(Str
.toStringz(signalName
), itype
, signalFlags
, (classClosure
is null) ?
null : classClosure
.getClosureStruct(), accumulator
, accuData
, cMarshaller
, returnType
, nParams
, paramTypes
);
229 * Creates a new signal. (This is usually done in the class initializer.)
230 * See g_signal_new() for details on allowed signal names.
232 * the name for the signal
234 * the type this signal pertains to. It will also pertain to
235 * types which are derived from this type.
237 * a combination of GSignalFlags specifying detail of when
238 * the default handler is to be invoked. You should at least specify
239 * G_SIGNAL_RUN_FIRST or G_SIGNAL_RUN_LAST.
241 * The closure to invoke on signal emission; may be NULL.
243 * the accumulator for this signal; may be NULL.
245 * user data for the accumulator.
247 * the function to translate arrays of parameter values to
248 * signal emissions into C language callback invocations.
250 * the type of return value, or G_TYPE_NONE for a signal
251 * without a return value.
253 * the number of parameter types in args.
255 * va_list of GType, one for each parameter.
259 public static uint newValist(char[] signalName
, GType itype
, GSignalFlags signalFlags
, Closure classClosure
, GSignalAccumulator accumulator
, void* accuData
, GSignalCMarshaller cMarshaller
, GType returnType
, uint nParams
, void* args
)
261 // guint g_signal_new_valist (const gchar *signal_name, GType itype, GSignalFlags signal_flags, GClosure *class_closure, GSignalAccumulator accumulator, gpointer accu_data, GSignalCMarshaller c_marshaller, GType return_type, guint n_params, va_list args);
262 return g_signal_new_valist(Str
.toStringz(signalName
), itype
, signalFlags
, (classClosure
is null) ?
null : classClosure
.getClosureStruct(), accumulator
, accuData
, cMarshaller
, returnType
, nParams
, args
);
266 * Queries the signal system for in-depth information about a
267 * specific signal. This function will fill in a user-provided
268 * structure to hold signal-specific information. If an invalid
269 * signal id is passed in, the signal_id member of the GSignalQuery
270 * is 0. All members filled into the GSignalQuery structure should
271 * be considered constant and have to be left untouched.
273 * The signal id of the signal to query information for.
275 * A user provided structure that is filled in with constant
276 * values upon success.
278 public static void query(uint signalId
, GSignalQuery
* query
)
280 // void g_signal_query (guint signal_id, GSignalQuery *query);
281 g_signal_query(signalId
, query
);
285 * Given the name of the signal and the type of object it connects to, gets
286 * the signal's identifying integer. Emitting the signal by number is
287 * somewhat faster than using the name each time.
288 * Also tries the ancestors of the given type.
289 * See g_signal_new() for details on allowed signal names.
293 * the type that the signal operates on.
295 * the signal's identifying number, or 0 if no signal was found.
297 public static uint lookup(char[] name
, GType itype
)
299 // guint g_signal_lookup (const gchar *name, GType itype);
300 return g_signal_lookup(Str
.toStringz(name
), itype
);
304 * Given the signal's identifier, finds its name.
305 * Two different signals may have the same name, if they have differing types.
307 * the signal's identifying number.
309 * the signal name, or NULL if the signal number was invalid.
311 public static char[] name(uint signalId
)
313 // const gchar* g_signal_name (guint signal_id);
314 return Str
.toString(g_signal_name(signalId
) );
318 * Lists the signals by id that a certain instance or interface type
319 * created. Further information about the signals can be acquired through
322 * Instance or interface type.
324 * Location to store the number of signal ids for itype.
326 * Newly allocated array of signal IDs.
328 public static uint* listIds(GType itype
, uint* nIds
)
330 // guint* g_signal_list_ids (GType itype, guint *n_ids);
331 return g_signal_list_ids(itype
, nIds
);
336 * Note that g_signal_emit() resets the return value to the default
337 * if no handlers are connected, in contrast to g_signal_emitv().
339 * the instance the signal is being emitted on.
345 * parameters to be passed to the signal, followed by a
346 * location for the return value. If the return type of the signal
347 * is G_TYPE_NONE, the return value location can be omitted.
349 public static void emit(void* instanc
, uint signalId
, GQuark detail
, ... )
351 // void g_signal_emit (gpointer instance, guint signal_id, GQuark detail, ...);
352 g_signal_emit(instanc
, signalId
, detail
);
357 * Note that g_signal_emit_by_name() resets the return value to the default
358 * if no handlers are connected, in contrast to g_signal_emitv().
360 * the instance the signal is being emitted on.
362 * a string of the form "signal-name::detail".
364 * parameters to be passed to the signal, followed by a
365 * location for the return value. If the return type of the signal
366 * is G_TYPE_NONE, the return value location can be omitted.
368 public static void emitByName(void* instanc
, char[] detailedSignal
, ... )
370 // void g_signal_emit_by_name (gpointer instance, const gchar *detailed_signal, ...);
371 g_signal_emit_by_name(instanc
, Str
.toStringz(detailedSignal
));
376 * Note that g_signal_emitv() doesn't change return_value if no handlers are
377 * connected, in contrast to g_signal_emit() and g_signal_emit_valist().
378 * instance_and_params:
379 * argument list for the signal emission. The first
380 * element in the array is a GValue for the instance the signal is
381 * being emitted on. The rest are any arguments to be passed to the
388 * Location to store the return value of the signal emission.
390 public static void emitv(Value instanceAndParams
, uint signalId
, GQuark detail
, Value returnValue
)
392 // void g_signal_emitv (const GValue *instance_and_params, guint signal_id, GQuark detail, GValue *return_value);
393 g_signal_emitv((instanceAndParams
is null) ?
null : instanceAndParams
.getValueStruct(), signalId
, detail
, (returnValue
is null) ?
null : returnValue
.getValueStruct());
398 * Note that g_signal_emit_valist() resets the return value to the default
399 * if no handlers are connected, in contrast to g_signal_emitv().
401 * the instance the signal is being emitted on.
407 * a list of parameters to be passed to the signal, followed by a
408 * location for the return value. If the return type of the signal
409 * is G_TYPE_NONE, the return value location can be omitted.
411 public static void emitValist(void* instanc
, uint signalId
, GQuark detail
, void* varArgs
)
413 // void g_signal_emit_valist (gpointer instance, guint signal_id, GQuark detail, va_list var_args);
414 g_signal_emit_valist(instanc
, signalId
, detail
, varArgs
);
421 * This is similar to g_signal_connect_data(), but uses a closure which
422 * ensures that the gobject stays alive during the call to c_handler
423 * by temporarily adding a reference count to gobject.
424 * Note that there is a bug in GObject that makes this function
425 * much less useful than it might seem otherwise. Once gobject is
426 * disposed, the callback will no longer be called, but, the signal
427 * handler is not currently disconnected. If the
428 * instance is itself being freed at the same time than this doesn't
429 * matter, since the signal will automatically be removed, but
430 * if instance persists, then the signal handler will leak. You
431 * should not remove the signal yourself because in a future versions of
432 * GObject, the handler will automatically
434 * It's possible to work around this problem in a way that will
435 * continue to work with future versions of GObject by checking
436 * that the signal handler is still connected before disconnected it:
437 * if (g_signal_handler_is_connected (instance, id))
438 * g_signal_handler_disconnect (instance, id);
440 * the instance to connect to.
442 * a string of the form "signal-name::detail".
444 * the GCallback to connect.
446 * the object to pass as data to c_handler.
448 * a combination of GConnnectFlags.
452 public static uint connectObject(void* instanc
, char[] detailedSignal
, GCallback cHandler
, void* gobject
, GConnectFlags connectFlags
)
454 // gulong g_signal_connect_object (gpointer instance, const gchar *detailed_signal, GCallback c_handler, gpointer gobject, GConnectFlags connect_flags);
455 return g_signal_connect_object(instanc
, Str
.toStringz(detailedSignal
), cHandler
, gobject
, connectFlags
);
460 * Connects a GCallback function to a signal for a particular object. Similar
461 * to g_signal_connect(), but allows to provide a GClosureNotify for the data
462 * which will be called when the signal handler is disconnected and no longer
463 * used. Specify connect_flags if you need ..._after() pr
464 * ..._swapped() variants of this function.
466 * the instance to connect to.
468 * a string of the form "signal-name::detail".
470 * the GCallback to connect.
472 * data to pass to c_handler calls.
474 * a GClosureNotify for data.
476 * a combination of GConnectFlags.
480 public static uint connectData(void* instanc
, char[] detailedSignal
, GCallback cHandler
, void* data
, GClosureNotify destroyData
, GConnectFlags connectFlags
)
482 // gulong g_signal_connect_data (gpointer instance, const gchar *detailed_signal, GCallback c_handler, gpointer data, GClosureNotify destroy_data, GConnectFlags connect_flags);
483 return g_signal_connect_data(instanc
, Str
.toStringz(detailedSignal
), cHandler
, data
, destroyData
, connectFlags
);
487 * Connects a closure to a signal for a particular object.
489 * the instance to connect to.
491 * a string of the form "signal-name::detail".
493 * the closure to connect.
495 * whether the handler should be called before or after the
496 * default handler of the signal.
500 public static uint connectClosure(void* instanc
, char[] detailedSignal
, Closure closure
, int after
)
502 // gulong g_signal_connect_closure (gpointer instance, const gchar *detailed_signal, GClosure *closure, gboolean after);
503 return g_signal_connect_closure(instanc
, Str
.toStringz(detailedSignal
), (closure
is null) ?
null : closure
.getClosureStruct(), after
);
507 * Connects a closure to a signal for a particular object.
509 * the instance to connect to.
511 * the id of the signal.
515 * the closure to connect.
517 * whether the handler should be called before or after the
518 * default handler of the signal.
522 public static uint connectClosureById(void* instanc
, uint signalId
, GQuark detail
, Closure closure
, int after
)
524 // gulong g_signal_connect_closure_by_id (gpointer instance, guint signal_id, GQuark detail, GClosure *closure, gboolean after);
525 return g_signal_connect_closure_by_id(instanc
, signalId
, detail
, (closure
is null) ?
null : closure
.getClosureStruct(), after
);
529 * Blocks a handler of an instance so it will not be called during
530 * any signal emissions unless it is unblocked again. Thus "blocking"
531 * a signal handler means to temporarily deactive it, a signal handler
532 * has to be unblocked exactly the same amount of times it has been
533 * blocked before to become active again.
534 * The handler_id has to be a valid signal handler id, connected to a
535 * signal of instance.
537 * The instance to block the signal handler of.
539 * Handler id of the handler to be blocked.
541 public static void handlerBlock(void* instanc
, uint handlerId
)
543 // void g_signal_handler_block (gpointer instance, gulong handler_id);
544 g_signal_handler_block(instanc
, handlerId
);
548 * Undoes the effect of a previous g_signal_handler_block() call.
549 * A blocked handler is skipped during signal emissions and will not be
550 * invoked, unblocking it (for exactly the amount of times it has been
551 * blocked before) reverts its "blocked" state, so the handler will be
552 * recognized by the signal system and is called upon future or currently
553 * ongoing signal emissions (since the order in which handlers are
554 * called during signal emissions is deterministic, whether the
555 * unblocked handler in question is called as part of a currently
556 * ongoing emission depends on how far that emission has proceeded
558 * The handler_id has to be a valid id of a signal handler that is
559 * connected to a signal of instance and is currently blocked.
561 * The instance to unblock the signal handler of.
563 * Handler id of the handler to be unblocked.
565 public static void handlerUnblock(void* instanc
, uint handlerId
)
567 // void g_signal_handler_unblock (gpointer instance, gulong handler_id);
568 g_signal_handler_unblock(instanc
, handlerId
);
572 * Disconnects a handler from an instance so it will not be called during
573 * any future or currently ongoing emissions of the signal it has been
574 * connected to. The handler_id becomes invalid and may be reused.
575 * The handler_id has to be a valid signal handler id, connected to a
576 * signal of instance.
578 * The instance to remove the signal handler from.
580 * Handler id of the handler to be disconnected.
582 public static void handlerDisconnect(void* instanc
, uint handlerId
)
584 // void g_signal_handler_disconnect (gpointer instance, gulong handler_id);
585 g_signal_handler_disconnect(instanc
, handlerId
);
589 * Finds the first signal handler that matches certain selection criteria.
590 * The criteria mask is passed as an OR-ed combination of GSignalMatchType
591 * flags, and the criteria values are passed as arguments.
592 * The match mask has to be non-0 for successful matches.
593 * If no handler was found, 0 is returned.
595 * The instance owning the signal handler to be found.
597 * Mask indicating which of signal_id, detail, closure, func
598 * and/or data the handler has to match.
600 * Signal the handler has to be connected to.
602 * Signal detail the handler has to be connected to.
604 * The closure the handler will invoke.
606 * The C closure callback of the handler (useless for non-C closures).
608 * The closure data of the handler's closure.
610 * A valid non-0 signal handler id for a successful match.
612 public static uint handlerFind(void* instanc
, GSignalMatchType mask
, uint signalId
, GQuark detail
, Closure closure
, void* func
, void* data
)
614 // gulong g_signal_handler_find (gpointer instance, GSignalMatchType mask, guint signal_id, GQuark detail, GClosure *closure, gpointer func, gpointer data);
615 return g_signal_handler_find(instanc
, mask
, signalId
, detail
, (closure
is null) ?
null : closure
.getClosureStruct(), func
, data
);
619 * Blocks all handlers on an instance that match a certain selection criteria.
620 * The criteria mask is passed as an OR-ed combination of GSignalMatchType
621 * flags, and the criteria values are passed as arguments.
622 * Passing at least one of the G_SIGNAL_MATCH_CLOSURE, G_SIGNAL_MATCH_FUNC
623 * or G_SIGNAL_MATCH_DATA match flags is required for successful matches.
624 * If no handlers were found, 0 is returned, the number of blocked handlers
627 * The instance to block handlers from.
629 * Mask indicating which of signal_id, detail, closure, func
630 * and/or data the handlers have to match.
632 * Signal the handlers have to be connected to.
634 * Signal detail the handlers have to be connected to.
636 * The closure the handlers will invoke.
638 * The C closure callback of the handlers (useless for non-C closures).
640 * The closure data of the handlers' closures.
642 * The amount of handlers that got blocked.
644 public static uint handlersBlockMatched(void* instanc
, GSignalMatchType mask
, uint signalId
, GQuark detail
, Closure closure
, void* func
, void* data
)
646 // guint g_signal_handlers_block_matched (gpointer instance, GSignalMatchType mask, guint signal_id, GQuark detail, GClosure *closure, gpointer func, gpointer data);
647 return g_signal_handlers_block_matched(instanc
, mask
, signalId
, detail
, (closure
is null) ?
null : closure
.getClosureStruct(), func
, data
);
651 * Unblocks all handlers on an instance that match a certain selection
652 * criteria. The criteria mask is passed as an OR-ed combination of
653 * GSignalMatchType flags, and the criteria values are passed as arguments.
654 * Passing at least one of the G_SIGNAL_MATCH_CLOSURE, G_SIGNAL_MATCH_FUNC
655 * or G_SIGNAL_MATCH_DATA match flags is required for successful matches.
656 * If no handlers were found, 0 is returned, the number of unblocked handlers
657 * otherwise. The match criteria should not apply to any handlers that are
658 * not currently blocked.
660 * The instance to unblock handlers from.
662 * Mask indicating which of signal_id, detail, closure, func
663 * and/or data the handlers have to match.
665 * Signal the handlers have to be connected to.
667 * Signal detail the handlers have to be connected to.
669 * The closure the handlers will invoke.
671 * The C closure callback of the handlers (useless for non-C closures).
673 * The closure data of the handlers' closures.
675 * The amount of handlers that got unblocked.
677 public static uint handlersUnblockMatched(void* instanc
, GSignalMatchType mask
, uint signalId
, GQuark detail
, Closure closure
, void* func
, void* data
)
679 // guint g_signal_handlers_unblock_matched (gpointer instance, GSignalMatchType mask, guint signal_id, GQuark detail, GClosure *closure, gpointer func, gpointer data);
680 return g_signal_handlers_unblock_matched(instanc
, mask
, signalId
, detail
, (closure
is null) ?
null : closure
.getClosureStruct(), func
, data
);
684 * Disconnects all handlers on an instance that match a certain selection
685 * criteria. The criteria mask is passed as an OR-ed combination of
686 * GSignalMatchType flags, and the criteria values are passed as arguments.
687 * Passing at least one of the G_SIGNAL_MATCH_CLOSURE, G_SIGNAL_MATCH_FUNC
688 * or G_SIGNAL_MATCH_DATA match flags is required for successful matches.
689 * If no handlers were found, 0 is returned, the number of disconnected
690 * handlers otherwise.
692 * The instance to remove handlers from.
694 * Mask indicating which of signal_id, detail, closure, func
695 * and/or data the handlers have to match.
697 * Signal the handlers have to be connected to.
699 * Signal detail the handlers have to be connected to.
701 * The closure the handlers will invoke.
703 * The C closure callback of the handlers (useless for non-C closures).
705 * The closure data of the handlers' closures.
707 * The amount of handlers that got disconnected.
709 public static uint handlersDisconnectMatched(void* instanc
, GSignalMatchType mask
, uint signalId
, GQuark detail
, Closure closure
, void* func
, void* data
)
711 // guint g_signal_handlers_disconnect_matched (gpointer instance, GSignalMatchType mask, guint signal_id, GQuark detail, GClosure *closure, gpointer func, gpointer data);
712 return g_signal_handlers_disconnect_matched(instanc
, mask
, signalId
, detail
, (closure
is null) ?
null : closure
.getClosureStruct(), func
, data
);
716 * Returns whether handler_id is the id of a handler connected to instance.
718 * The instance where a signal handler is sought.
722 * whether handler_id identifies a handler connected to instance.
724 public static int handlerIsConnected(void* instanc
, uint handlerId
)
726 // gboolean g_signal_handler_is_connected (gpointer instance, gulong handler_id);
727 return g_signal_handler_is_connected(instanc
, handlerId
);
734 * Returns whether there are any handlers connected to instance for the
735 * given signal id and detail.
736 * One example of when you might use this is when the arguments to the
737 * signal are difficult to compute. A class implementor may opt to not emit
738 * the signal if no one is attached anyway, thus saving the cost of building
741 * the object whose signal handlers are sought.
747 * whether blocked handlers should count as match.
749 * TRUE if a handler is connected to the signal,
752 public static int hasHandlerPending(void* instanc
, uint signalId
, GQuark detail
, int mayBeBlocked
)
754 // gboolean g_signal_has_handler_pending (gpointer instance, guint signal_id, GQuark detail, gboolean may_be_blocked);
755 return g_signal_has_handler_pending(instanc
, signalId
, detail
, mayBeBlocked
);
759 * Stops a signal's current emission.
760 * This will prevent the default method from running, if the signal was
761 * G_SIGNAL_RUN_LAST and you connected normally (i.e. without the "after"
763 * Prints a warning if used on a signal which isn't being emitted.
765 * the object whose signal handlers you wish to stop.
767 * the signal identifier, as returned by g_signal_lookup().
769 * the detail which the signal was emitted with.
771 public static void stopEmission(void* instanc
, uint signalId
, GQuark detail
)
773 // void g_signal_stop_emission (gpointer instance, guint signal_id, GQuark detail);
774 g_signal_stop_emission(instanc
, signalId
, detail
);
778 * Stops a signal's current emission.
779 * This is just like g_signal_stop_emission() except it will look up the
782 * the object whose signal handlers you wish to stop.
784 * a string of the form "signal-name::detail".
786 public static void stopEmissionByName(void* instanc
, char[] detailedSignal
)
788 // void g_signal_stop_emission_by_name (gpointer instance, const gchar *detailed_signal);
789 g_signal_stop_emission_by_name(instanc
, Str
.toStringz(detailedSignal
));
793 * Overrides the class closure (i.e. the default handler) for the given signal
794 * for emissions on instances of instance_type. instance_type must be derived
795 * from the type to which the signal belongs.
799 * the instance type on which to override the class closure
804 public static void overrideClassClosure(uint signalId
, GType instanceType
, Closure classClosure
)
806 // void g_signal_override_class_closure (guint signal_id, GType instance_type, GClosure *class_closure);
807 g_signal_override_class_closure(signalId
, instanceType
, (classClosure
is null) ?
null : classClosure
.getClosureStruct());
811 * Calls the original class closure of a signal. This function should only
812 * be called from an overridden class closure; see
813 * g_signal_override_class_closure().
814 * instance_and_params:
815 * the argument list of the signal emission. The first
816 * element in the array is a GValue for the instance the signal is being
817 * emitted on. The rest are any arguments to be passed to the signal.
819 * Location for the return value.
821 public static void chainFromOverridden(Value instanceAndParams
, Value returnValue
)
823 // void g_signal_chain_from_overridden (const GValue *instance_and_params, GValue *return_value);
824 g_signal_chain_from_overridden((instanceAndParams
is null) ?
null : instanceAndParams
.getValueStruct(), (returnValue
is null) ?
null : returnValue
.getValueStruct());
828 * Adds an emission hook for a signal, which will get called for any emission
829 * of that signal, independent of the instance. This is possible only
830 * for signals which don't have G_SIGNAL_NO_HOOKS flag set.
832 * the signal identifier, as returned by g_signal_lookup().
834 * the detail on which to call the hook.
836 * a GSignalEmissionHook function.
838 * user data for hook_func.
840 * a GDestroyNotify for hook_data.
842 * the hook id, for later use with g_signal_remove_emission_hook().
844 public static uint addEmissionHook(uint signalId
, GQuark detail
, GSignalEmissionHook hookFunc
, void* hookData
, GDestroyNotify dataDestroy
)
846 // gulong g_signal_add_emission_hook (guint signal_id, GQuark detail, GSignalEmissionHook hook_func, gpointer hook_data, GDestroyNotify data_destroy);
847 return g_signal_add_emission_hook(signalId
, detail
, hookFunc
, hookData
, dataDestroy
);
851 * Deletes an emission hook.
853 * the id of the signal
855 * the id of the emission hook, as returned by
856 * g_signal_add_emission_hook()
858 public static void removeEmissionHook(uint signalId
, uint hookId
)
860 // void g_signal_remove_emission_hook (guint signal_id, gulong hook_id);
861 g_signal_remove_emission_hook(signalId
, hookId
);
865 * Internal function to parse a signal name into its signal_id
868 * a string of the form "signal-name::detail".
870 * The interface/instance type that introduced "signal-name".
872 * Location to store the signal id.
874 * Location to store the detail quark.
875 * force_detail_quark:
876 * TRUE forces creation of a GQuark for the detail.
878 * Whether the signal name could successfully be parsed and signal_id_p and detail_p contain valid return values.
880 public static int parseName(char[] detailedSignal
, GType itype
, uint* signalIdP
, Quark detailP
, int forceDetailQuark
)
882 // gboolean g_signal_parse_name (const gchar *detailed_signal, GType itype, guint *signal_id_p, GQuark *detail_p, gboolean force_detail_quark);
883 return g_signal_parse_name(Str
.toStringz(detailedSignal
), itype
, signalIdP
, (detailP
is null) ?
null : detailP
.getQuarkStruct(), forceDetailQuark
);
887 * Returns the invocation hint of the innermost signal emission of instance.
889 * the instance to query
891 * the invocation hint of the innermost signal emission.
893 public static GSignalInvocationHint
* getInvocationHint(void* instanc
)
895 // GSignalInvocationHint* g_signal_get_invocation_hint (gpointer instance);
896 return g_signal_get_invocation_hint(instanc
);
900 * Creates a new closure which invokes the function found at the offset
901 * struct_offset in the class structure of the interface or classed type
902 * identified by itype.
904 * the GType identifier of an interface or classed type
906 * the offset of the member function of itype's class
907 * structure which is to be invoked by the new closure
911 public static Closure
typeCclosureNew(GType itype
, uint structOffset
)
913 // GClosure* g_signal_type_cclosure_new (GType itype, guint struct_offset);
914 return new Closure( g_signal_type_cclosure_new(itype
, structOffset
) );
918 * A predefined GSignalAccumulator for signals that return a
919 * boolean values. The behavior that this accumulator gives is
920 * that a return of TRUE stops the signal emission: no further
921 * callbacks will be invoked, while a return of FALSE allows
922 * the emission to coninue. The idea here is that a TRUE return
923 * indicates that the callback handled the signal,
924 * and no further handling is needed.
926 * standard GSignalAccumulator parameter
928 * standard GSignalAccumulator parameter
930 * standard GSignalAccumulator parameter
932 * standard GSignalAccumulator parameter
934 * standard GSignalAccumulator result
936 * [12] Although signals can deal with any kind of instantiatable type,
937 * i'm referring to those types as "object types" in the following, simply
938 * because that is the context most users will encounter signals in.
940 public static int accumulatorTrueHandled(GSignalInvocationHint
* ihint
, Value returnAccu
, Value handlerReturn
, void* dummy
)
942 // gboolean g_signal_accumulator_true_handled (GSignalInvocationHint *ihint, GValue *return_accu, const GValue *handler_return, gpointer dummy);
943 return g_signal_accumulator_true_handled(ihint
, (returnAccu
is null) ?
null : returnAccu
.getValueStruct(), (handlerReturn
is null) ?
null : handlerReturn
.getValueStruct(), dummy
);