source: appstream-generator/build/girepo/gobject/Signals.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

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