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