/usr/include/d/gtkd-3/gtk/Gesture.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 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | /*
* 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 gtk.Gesture;
private import gdk.Device;
private import gdk.Event;
private import gdk.Window;
private import glib.ListG;
private import gobject.ObjectG;
private import gobject.Signals;
private import gtk.EventController;
private import gtk.c.functions;
public import gtk.c.types;
public import gtkc.gtktypes;
private import std.algorithm;
/**
* #GtkGesture is the base object for gesture recognition, although this
* object is quite generalized to serve as a base for multi-touch gestures,
* it is suitable to implement single-touch and pointer-based gestures (using
* the special %NULL #GdkEventSequence value for these).
*
* The number of touches that a #GtkGesture need to be recognized is controlled
* by the #GtkGesture:n-points property, if a gesture is keeping track of less
* or more than that number of sequences, it won't check wether the gesture
* is recognized.
*
* As soon as the gesture has the expected number of touches, the gesture will
* run the #GtkGesture::check signal regularly on input events until the gesture
* is recognized, the criteria to consider a gesture as "recognized" is left to
* #GtkGesture subclasses.
*
* A recognized gesture will then emit the following signals:
* - #GtkGesture::begin when the gesture is recognized.
* - A number of #GtkGesture::update, whenever an input event is processed.
* - #GtkGesture::end when the gesture is no longer recognized.
*
* ## Event propagation
*
* In order to receive events, a gesture needs to either set a propagation phase
* through gtk_event_controller_set_propagation_phase(), or feed those manually
* through gtk_event_controller_handle_event().
*
* In the capture phase, events are propagated from the toplevel down to the
* target widget, and gestures that are attached to containers above the widget
* get a chance to interact with the event before it reaches the target.
*
* After the capture phase, GTK+ emits the traditional #GtkWidget::button-press-event,
* #GtkWidget::button-release-event, #GtkWidget::touch-event, etc signals. Gestures
* with the %GTK_PHASE_TARGET phase are fed events from the default #GtkWidget::event
* handlers.
*
* In the bubble phase, events are propagated up from the target widget to the
* toplevel, and gestures that are attached to containers above the widget get
* a chance to interact with events that have not been handled yet.
*
* ## States of a sequence # {#touch-sequence-states}
*
* Whenever input interaction happens, a single event may trigger a cascade of
* #GtkGestures, both across the parents of the widget receiving the event and
* in parallel within an individual widget. It is a responsibility of the
* widgets using those gestures to set the state of touch sequences accordingly
* in order to enable cooperation of gestures around the #GdkEventSequences
* triggering those.
*
* Within a widget, gestures can be grouped through gtk_gesture_group(),
* grouped gestures synchronize the state of sequences, so calling
* gtk_gesture_set_sequence_state() on one will effectively propagate
* the state throughout the group.
*
* By default, all sequences start out in the #GTK_EVENT_SEQUENCE_NONE state,
* sequences in this state trigger the gesture event handler, but event
* propagation will continue unstopped by gestures.
*
* If a sequence enters into the #GTK_EVENT_SEQUENCE_DENIED state, the gesture
* group will effectively ignore the sequence, letting events go unstopped
* through the gesture, but the "slot" will still remain occupied while
* the touch is active.
*
* If a sequence enters in the #GTK_EVENT_SEQUENCE_CLAIMED state, the gesture
* group will grab all interaction on the sequence, by:
* - Setting the same sequence to #GTK_EVENT_SEQUENCE_DENIED on every other gesture
* group within the widget, and every gesture on parent widgets in the propagation
* chain.
* - calling #GtkGesture::cancel on every gesture in widgets underneath in the
* propagation chain.
* - Stopping event propagation after the gesture group handles the event.
*
* Note: if a sequence is set early to #GTK_EVENT_SEQUENCE_CLAIMED on
* #GDK_TOUCH_BEGIN/#GDK_BUTTON_PRESS (so those events are captured before
* reaching the event widget, this implies #GTK_PHASE_CAPTURE), one similar
* event will emulated if the sequence changes to #GTK_EVENT_SEQUENCE_DENIED.
* This way event coherence is preserved before event propagation is unstopped
* again.
*
* Sequence states can't be changed freely, see gtk_gesture_set_sequence_state()
* to know about the possible lifetimes of a #GdkEventSequence.
*
* ## Touchpad gestures
*
* On the platforms that support it, #GtkGesture will handle transparently
* touchpad gesture events. The only precautions users of #GtkGesture should do
* to enable this support are:
* - Enabling %GDK_TOUCHPAD_GESTURE_MASK on their #GdkWindows
* - If the gesture has %GTK_PHASE_NONE, ensuring events of type
* %GDK_TOUCHPAD_SWIPE and %GDK_TOUCHPAD_PINCH are handled by the #GtkGesture
*/
public class Gesture : EventController
{
/** the main Gtk struct */
protected GtkGesture* gtkGesture;
/** Get the main Gtk struct */
public GtkGesture* getGestureStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gtkGesture;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gtkGesture;
}
protected override void setStruct(GObject* obj)
{
gtkGesture = cast(GtkGesture*)obj;
super.setStruct(obj);
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GtkGesture* gtkGesture, bool ownedRef = false)
{
this.gtkGesture = gtkGesture;
super(cast(GtkEventController*)gtkGesture, ownedRef);
}
/** */
public static GType getType()
{
return gtk_gesture_get_type();
}
/**
* If there are touch sequences being currently handled by @gesture,
* this function returns %TRUE and fills in @rect with the bounding
* box containing all active touches. Otherwise, %FALSE will be
* returned.
*
* Note: This function will yield unexpected results on touchpad
* gestures. Since there is no correlation between physical and
* pixel distances, these will look as if constrained in an
* infinitely small area, @rect width and height will thus be 0
* regardless of the number of touchpoints.
*
* Params:
* rect = bounding box containing all active touches.
*
* Returns: %TRUE if there are active touches, %FALSE otherwise
*
* Since: 3.14
*/
public bool getBoundingBox(out GdkRectangle rect)
{
return gtk_gesture_get_bounding_box(gtkGesture, &rect) != 0;
}
/**
* If there are touch sequences being currently handled by @gesture,
* this function returns %TRUE and fills in @x and @y with the center
* of the bounding box containing all active touches. Otherwise, %FALSE
* will be returned.
*
* Params:
* x = X coordinate for the bounding box center
* y = Y coordinate for the bounding box center
*
* Returns: %FALSE if no active touches are present, %TRUE otherwise
*
* Since: 3.14
*/
public bool getBoundingBoxCenter(out double x, out double y)
{
return gtk_gesture_get_bounding_box_center(gtkGesture, &x, &y) != 0;
}
/**
* Returns the master #GdkDevice that is currently operating
* on @gesture, or %NULL if the gesture is not being interacted.
*
* Returns: a #GdkDevice, or %NULL
*
* Since: 3.14
*/
public Device getDevice()
{
auto p = gtk_gesture_get_device(gtkGesture);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Device)(cast(GdkDevice*) p);
}
/**
* Returns all gestures in the group of @gesture
*
* Returns: The list
* of #GtkGestures, free with g_list_free()
*
* Since: 3.14
*/
public ListG getGroup()
{
auto p = gtk_gesture_get_group(gtkGesture);
if(p is null)
{
return null;
}
return new ListG(cast(GList*) p);
}
/**
* Returns the last event that was processed for @sequence.
*
* Note that the returned pointer is only valid as long as the @sequence
* is still interpreted by the @gesture. If in doubt, you should make
* a copy of the event.
*
* Params:
* sequence = a #GdkEventSequence
*
* Returns: The last event from @sequence
*/
public Event getLastEvent(GdkEventSequence* sequence)
{
auto p = gtk_gesture_get_last_event(gtkGesture, sequence);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Event)(cast(GdkEvent*) p);
}
/**
* Returns the #GdkEventSequence that was last updated on @gesture.
*
* Returns: The last updated sequence
*
* Since: 3.14
*/
public GdkEventSequence* getLastUpdatedSequence()
{
return gtk_gesture_get_last_updated_sequence(gtkGesture);
}
/**
* If @sequence is currently being interpreted by @gesture, this
* function returns %TRUE and fills in @x and @y with the last coordinates
* stored for that event sequence. The coordinates are always relative to the
* widget allocation.
*
* Params:
* sequence = a #GdkEventSequence, or %NULL for pointer events
* x = return location for X axis of the sequence coordinates
* y = return location for Y axis of the sequence coordinates
*
* Returns: %TRUE if @sequence is currently interpreted
*
* Since: 3.14
*/
public bool getPoint(GdkEventSequence* sequence, out double x, out double y)
{
return gtk_gesture_get_point(gtkGesture, sequence, &x, &y) != 0;
}
/**
* Returns the @sequence state, as seen by @gesture.
*
* Params:
* sequence = a #GdkEventSequence
*
* Returns: The sequence state in @gesture
*
* Since: 3.14
*/
public GtkEventSequenceState getSequenceState(GdkEventSequence* sequence)
{
return gtk_gesture_get_sequence_state(gtkGesture, sequence);
}
/**
* Returns the list of #GdkEventSequences currently being interpreted
* by @gesture.
*
* Returns: A list
* of #GdkEventSequences, the list elements are owned by GTK+
* and must not be freed or modified, the list itself must be deleted
* through g_list_free()
*
* Since: 3.14
*/
public ListG getSequences()
{
auto p = gtk_gesture_get_sequences(gtkGesture);
if(p is null)
{
return null;
}
return new ListG(cast(GList*) p);
}
/**
* Returns the user-defined window that receives the events
* handled by @gesture. See gtk_gesture_set_window() for more
* information.
*
* Returns: the user defined window, or %NULL if none
*
* Since: 3.14
*/
public Window getWindow()
{
auto p = gtk_gesture_get_window(gtkGesture);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
}
/**
* Adds @gesture to the same group than @group_gesture. Gestures
* are by default isolated in their own groups.
*
* When gestures are grouped, the state of #GdkEventSequences
* is kept in sync for all of those, so calling gtk_gesture_set_sequence_state(),
* on one will transfer the same value to the others.
*
* Groups also perform an "implicit grabbing" of sequences, if a
* #GdkEventSequence state is set to #GTK_EVENT_SEQUENCE_CLAIMED on one group,
* every other gesture group attached to the same #GtkWidget will switch the
* state for that sequence to #GTK_EVENT_SEQUENCE_DENIED.
*
* Params:
* gesture = a #GtkGesture
*
* Since: 3.14
*/
public void group(Gesture gesture)
{
gtk_gesture_group(gtkGesture, (gesture is null) ? null : gesture.getGestureStruct());
}
/**
* Returns %TRUE if @gesture is currently handling events corresponding to
* @sequence.
*
* Params:
* sequence = a #GdkEventSequence or %NULL
*
* Returns: %TRUE if @gesture is handling @sequence, %FALSE otherwise
*
* Since: 3.14
*/
public bool handlesSequence(GdkEventSequence* sequence)
{
return gtk_gesture_handles_sequence(gtkGesture, sequence) != 0;
}
/**
* Returns %TRUE if the gesture is currently active.
* A gesture is active meanwhile there are touch sequences
* interacting with it.
*
* Returns: %TRUE if gesture is active
*
* Since: 3.14
*/
public bool isActive()
{
return gtk_gesture_is_active(gtkGesture) != 0;
}
/**
* Returns %TRUE if both gestures pertain to the same group.
*
* Params:
* other = another #GtkGesture
*
* Returns: whether the gestures are grouped
*
* Since: 3.14
*/
public bool isGroupedWith(Gesture other)
{
return gtk_gesture_is_grouped_with(gtkGesture, (other is null) ? null : other.getGestureStruct()) != 0;
}
/**
* Returns %TRUE if the gesture is currently recognized.
* A gesture is recognized if there are as many interacting
* touch sequences as required by @gesture, and #GtkGesture::check
* returned %TRUE for the sequences being currently interpreted.
*
* Returns: %TRUE if gesture is recognized
*
* Since: 3.14
*/
public bool isRecognized()
{
return gtk_gesture_is_recognized(gtkGesture) != 0;
}
/**
* Sets the state of @sequence in @gesture. Sequences start
* in state #GTK_EVENT_SEQUENCE_NONE, and whenever they change
* state, they can never go back to that state. Likewise,
* sequences in state #GTK_EVENT_SEQUENCE_DENIED cannot turn
* back to a not denied state. With these rules, the lifetime
* of an event sequence is constrained to the next four:
*
* * None
* * None → Denied
* * None → Claimed
* * None → Claimed → Denied
*
* Note: Due to event handling ordering, it may be unsafe to
* set the state on another gesture within a #GtkGesture::begin
* signal handler, as the callback might be executed before
* the other gesture knows about the sequence. A safe way to
* perform this could be:
*
* |[
* static void
* first_gesture_begin_cb (GtkGesture *first_gesture,
* GdkEventSequence *sequence,
* gpointer user_data)
* {
* gtk_gesture_set_sequence_state (first_gesture, sequence, GTK_EVENT_SEQUENCE_ACCEPTED);
* gtk_gesture_set_sequence_state (second_gesture, sequence, GTK_EVENT_SEQUENCE_DENIED);
* }
*
* static void
* second_gesture_begin_cb (GtkGesture *second_gesture,
* GdkEventSequence *sequence,
* gpointer user_data)
* {
* if (gtk_gesture_get_sequence_state (first_gesture, sequence) == GTK_EVENT_SEQUENCE_ACCEPTED)
* gtk_gesture_set_sequence_state (second_gesture, sequence, GTK_EVENT_SEQUENCE_DENIED);
* }
* ]|
*
* If both gestures are in the same group, just set the state on
* the gesture emitting the event, the sequence will be already
* be initialized to the group's global state when the second
* gesture processes the event.
*
* Params:
* sequence = a #GdkEventSequence
* state = the sequence state
*
* Returns: %TRUE if @sequence is handled by @gesture,
* and the state is changed successfully
*
* Since: 3.14
*/
public bool setSequenceState(GdkEventSequence* sequence, GtkEventSequenceState state)
{
return gtk_gesture_set_sequence_state(gtkGesture, sequence, state) != 0;
}
/**
* Sets the state of all sequences that @gesture is currently
* interacting with. See gtk_gesture_set_sequence_state()
* for more details on sequence states.
*
* Params:
* state = the sequence state
*
* Returns: %TRUE if the state of at least one sequence
* was changed successfully
*
* Since: 3.14
*/
public bool setState(GtkEventSequenceState state)
{
return gtk_gesture_set_state(gtkGesture, state) != 0;
}
/**
* Sets a specific window to receive events about, so @gesture
* will effectively handle only events targeting @window, or
* a child of it. @window must pertain to gtk_event_controller_get_widget().
*
* Params:
* window = a #GdkWindow, or %NULL
*
* Since: 3.14
*/
public void setWindow(Window window)
{
gtk_gesture_set_window(gtkGesture, (window is null) ? null : window.getWindowStruct());
}
/**
* Separates @gesture into an isolated group.
*
* Since: 3.14
*/
public void ungroup()
{
gtk_gesture_ungroup(gtkGesture);
}
protected class OnBeginDelegateWrapper
{
void delegate(GdkEventSequence*, Gesture) dlg;
gulong handlerId;
this(void delegate(GdkEventSequence*, Gesture) dlg)
{
this.dlg = dlg;
onBeginListeners ~= this;
}
void remove(OnBeginDelegateWrapper source)
{
foreach(index, wrapper; onBeginListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onBeginListeners[index] = null;
onBeginListeners = std.algorithm.remove(onBeginListeners, index);
break;
}
}
}
}
OnBeginDelegateWrapper[] onBeginListeners;
/**
* This signal is emitted when the gesture is recognized. This means the
* number of touch sequences matches #GtkGesture:n-points, and the #GtkGesture::check
* handler(s) returned #TRUE.
*
* Note: These conditions may also happen when an extra touch (eg. a third touch
* on a 2-touches gesture) is lifted, in that situation @sequence won't pertain
* to the current set of active touches, so don't rely on this being true.
*
* Params:
* sequence = the #GdkEventSequence that made the gesture to be recognized
*
* Since: 3.14
*/
gulong addOnBegin(void delegate(GdkEventSequence*, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnBeginDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"begin",
cast(GCallback)&callBackBegin,
cast(void*)wrapper,
cast(GClosureNotify)&callBackBeginDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackBegin(GtkGesture* gestureStruct, GdkEventSequence* sequence, OnBeginDelegateWrapper wrapper)
{
wrapper.dlg(sequence, wrapper.outer);
}
extern(C) static void callBackBeginDestroy(OnBeginDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnBeginGenericDelegateWrapper
{
void delegate(Event, Gesture) dlg;
gulong handlerId;
this(void delegate(Event, Gesture) dlg)
{
this.dlg = dlg;
onBeginGenericListeners ~= this;
}
void remove(OnBeginGenericDelegateWrapper source)
{
foreach(index, wrapper; onBeginGenericListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onBeginGenericListeners[index] = null;
onBeginGenericListeners = std.algorithm.remove(onBeginGenericListeners, index);
break;
}
}
}
}
OnBeginGenericDelegateWrapper[] onBeginGenericListeners;
/**
* This signal is emitted when the gesture is recognized. This means the
* number of touch sequences matches #GtkGesture:n-points, and the #GtkGesture::check
* handler(s) returned #TRUE.
*
* Note: These conditions may also happen when an extra touch (eg. a third touch
* on a 2-touches gesture) is lifted, in that situation @sequence won't pertain
* to the current set of active touches, so don't rely on this being true.
*
* Params:
* sequence = the #GdkEventSequence that made the gesture to be recognized
*
* Since: 3.14
*/
gulong addOnBegin(void delegate(Event, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnBeginGenericDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"begin",
cast(GCallback)&callBackBeginGeneric,
cast(void*)wrapper,
cast(GClosureNotify)&callBackBeginGenericDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackBeginGeneric(GtkGesture* gestureStruct, GdkEvent* sequence, OnBeginGenericDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(Event)(sequence), wrapper.outer);
}
extern(C) static void callBackBeginGenericDestroy(OnBeginGenericDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnCancelDelegateWrapper
{
void delegate(GdkEventSequence*, Gesture) dlg;
gulong handlerId;
this(void delegate(GdkEventSequence*, Gesture) dlg)
{
this.dlg = dlg;
onCancelListeners ~= this;
}
void remove(OnCancelDelegateWrapper source)
{
foreach(index, wrapper; onCancelListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onCancelListeners[index] = null;
onCancelListeners = std.algorithm.remove(onCancelListeners, index);
break;
}
}
}
}
OnCancelDelegateWrapper[] onCancelListeners;
/**
* This signal is emitted whenever a sequence is cancelled. This usually
* happens on active touches when gtk_event_controller_reset() is called
* on @gesture (manually, due to grabs...), or the individual @sequence
* was claimed by parent widgets' controllers (see gtk_gesture_set_sequence_state()).
*
* @gesture must forget everything about @sequence as a reaction to this signal.
*
* Params:
* sequence = the #GdkEventSequence that was cancelled
*
* Since: 3.14
*/
gulong addOnCancel(void delegate(GdkEventSequence*, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnCancelDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"cancel",
cast(GCallback)&callBackCancel,
cast(void*)wrapper,
cast(GClosureNotify)&callBackCancelDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackCancel(GtkGesture* gestureStruct, GdkEventSequence* sequence, OnCancelDelegateWrapper wrapper)
{
wrapper.dlg(sequence, wrapper.outer);
}
extern(C) static void callBackCancelDestroy(OnCancelDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnCancelGenericDelegateWrapper
{
void delegate(Event, Gesture) dlg;
gulong handlerId;
this(void delegate(Event, Gesture) dlg)
{
this.dlg = dlg;
onCancelGenericListeners ~= this;
}
void remove(OnCancelGenericDelegateWrapper source)
{
foreach(index, wrapper; onCancelGenericListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onCancelGenericListeners[index] = null;
onCancelGenericListeners = std.algorithm.remove(onCancelGenericListeners, index);
break;
}
}
}
}
OnCancelGenericDelegateWrapper[] onCancelGenericListeners;
/**
* This signal is emitted whenever a sequence is cancelled. This usually
* happens on active touches when gtk_event_controller_reset() is called
* on @gesture (manually, due to grabs...), or the individual @sequence
* was claimed by parent widgets' controllers (see gtk_gesture_set_sequence_state()).
*
* @gesture must forget everything about @sequence as a reaction to this signal.
*
* Params:
* sequence = the #GdkEventSequence that was cancelled
*
* Since: 3.14
*/
gulong addOnCancel(void delegate(Event, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnCancelGenericDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"cancel",
cast(GCallback)&callBackCancelGeneric,
cast(void*)wrapper,
cast(GClosureNotify)&callBackCancelGenericDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackCancelGeneric(GtkGesture* gestureStruct, GdkEvent* sequence, OnCancelGenericDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(Event)(sequence), wrapper.outer);
}
extern(C) static void callBackCancelGenericDestroy(OnCancelGenericDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnEndDelegateWrapper
{
void delegate(GdkEventSequence*, Gesture) dlg;
gulong handlerId;
this(void delegate(GdkEventSequence*, Gesture) dlg)
{
this.dlg = dlg;
onEndListeners ~= this;
}
void remove(OnEndDelegateWrapper source)
{
foreach(index, wrapper; onEndListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onEndListeners[index] = null;
onEndListeners = std.algorithm.remove(onEndListeners, index);
break;
}
}
}
}
OnEndDelegateWrapper[] onEndListeners;
/**
* This signal is emitted when @gesture either stopped recognizing the event
* sequences as something to be handled (the #GtkGesture::check handler returned
* %FALSE), or the number of touch sequences became higher or lower than
* #GtkGesture:n-points.
*
* Note: @sequence might not pertain to the group of sequences that were
* previously triggering recognition on @gesture (ie. a just pressed touch
* sequence that exceeds #GtkGesture:n-points). This situation may be detected
* by checking through gtk_gesture_handles_sequence().
*
* Params:
* sequence = the #GdkEventSequence that made gesture recognition to finish
*
* Since: 3.14
*/
gulong addOnEnd(void delegate(GdkEventSequence*, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnEndDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"end",
cast(GCallback)&callBackEnd,
cast(void*)wrapper,
cast(GClosureNotify)&callBackEndDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackEnd(GtkGesture* gestureStruct, GdkEventSequence* sequence, OnEndDelegateWrapper wrapper)
{
wrapper.dlg(sequence, wrapper.outer);
}
extern(C) static void callBackEndDestroy(OnEndDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnEndGenericDelegateWrapper
{
void delegate(Event, Gesture) dlg;
gulong handlerId;
this(void delegate(Event, Gesture) dlg)
{
this.dlg = dlg;
onEndGenericListeners ~= this;
}
void remove(OnEndGenericDelegateWrapper source)
{
foreach(index, wrapper; onEndGenericListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onEndGenericListeners[index] = null;
onEndGenericListeners = std.algorithm.remove(onEndGenericListeners, index);
break;
}
}
}
}
OnEndGenericDelegateWrapper[] onEndGenericListeners;
/**
* This signal is emitted when @gesture either stopped recognizing the event
* sequences as something to be handled (the #GtkGesture::check handler returned
* %FALSE), or the number of touch sequences became higher or lower than
* #GtkGesture:n-points.
*
* Note: @sequence might not pertain to the group of sequences that were
* previously triggering recognition on @gesture (ie. a just pressed touch
* sequence that exceeds #GtkGesture:n-points). This situation may be detected
* by checking through gtk_gesture_handles_sequence().
*
* Params:
* sequence = the #GdkEventSequence that made gesture recognition to finish
*
* Since: 3.14
*/
gulong addOnEnd(void delegate(Event, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnEndGenericDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"end",
cast(GCallback)&callBackEndGeneric,
cast(void*)wrapper,
cast(GClosureNotify)&callBackEndGenericDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackEndGeneric(GtkGesture* gestureStruct, GdkEvent* sequence, OnEndGenericDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(Event)(sequence), wrapper.outer);
}
extern(C) static void callBackEndGenericDestroy(OnEndGenericDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnSequenceStateChangedDelegateWrapper
{
void delegate(GdkEventSequence*, GtkEventSequenceState, Gesture) dlg;
gulong handlerId;
this(void delegate(GdkEventSequence*, GtkEventSequenceState, Gesture) dlg)
{
this.dlg = dlg;
onSequenceStateChangedListeners ~= this;
}
void remove(OnSequenceStateChangedDelegateWrapper source)
{
foreach(index, wrapper; onSequenceStateChangedListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onSequenceStateChangedListeners[index] = null;
onSequenceStateChangedListeners = std.algorithm.remove(onSequenceStateChangedListeners, index);
break;
}
}
}
}
OnSequenceStateChangedDelegateWrapper[] onSequenceStateChangedListeners;
/**
* This signal is emitted whenever a sequence state changes. See
* gtk_gesture_set_sequence_state() to know more about the expectable
* sequence lifetimes.
*
* Params:
* sequence = the #GdkEventSequence that was cancelled
* state = the new sequence state
*
* Since: 3.14
*/
gulong addOnSequenceStateChanged(void delegate(GdkEventSequence*, GtkEventSequenceState, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnSequenceStateChangedDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"sequence-state-changed",
cast(GCallback)&callBackSequenceStateChanged,
cast(void*)wrapper,
cast(GClosureNotify)&callBackSequenceStateChangedDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackSequenceStateChanged(GtkGesture* gestureStruct, GdkEventSequence* sequence, GtkEventSequenceState state, OnSequenceStateChangedDelegateWrapper wrapper)
{
wrapper.dlg(sequence, state, wrapper.outer);
}
extern(C) static void callBackSequenceStateChangedDestroy(OnSequenceStateChangedDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnSequenceStateChangedGenericDelegateWrapper
{
void delegate(Event, GtkEventSequenceState, Gesture) dlg;
gulong handlerId;
this(void delegate(Event, GtkEventSequenceState, Gesture) dlg)
{
this.dlg = dlg;
onSequenceStateChangedGenericListeners ~= this;
}
void remove(OnSequenceStateChangedGenericDelegateWrapper source)
{
foreach(index, wrapper; onSequenceStateChangedGenericListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onSequenceStateChangedGenericListeners[index] = null;
onSequenceStateChangedGenericListeners = std.algorithm.remove(onSequenceStateChangedGenericListeners, index);
break;
}
}
}
}
OnSequenceStateChangedGenericDelegateWrapper[] onSequenceStateChangedGenericListeners;
/**
* This signal is emitted whenever a sequence state changes. See
* gtk_gesture_set_sequence_state() to know more about the expectable
* sequence lifetimes.
*
* Params:
* sequence = the #GdkEventSequence that was cancelled
* state = the new sequence state
*
* Since: 3.14
*/
gulong addOnSequenceStateChanged(void delegate(Event, GtkEventSequenceState, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnSequenceStateChangedGenericDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"sequence-state-changed",
cast(GCallback)&callBackSequenceStateChangedGeneric,
cast(void*)wrapper,
cast(GClosureNotify)&callBackSequenceStateChangedGenericDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackSequenceStateChangedGeneric(GtkGesture* gestureStruct, GdkEvent* sequence, GtkEventSequenceState state, OnSequenceStateChangedGenericDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(Event)(sequence), state, wrapper.outer);
}
extern(C) static void callBackSequenceStateChangedGenericDestroy(OnSequenceStateChangedGenericDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnUpdateDelegateWrapper
{
void delegate(GdkEventSequence*, Gesture) dlg;
gulong handlerId;
this(void delegate(GdkEventSequence*, Gesture) dlg)
{
this.dlg = dlg;
onUpdateListeners ~= this;
}
void remove(OnUpdateDelegateWrapper source)
{
foreach(index, wrapper; onUpdateListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onUpdateListeners[index] = null;
onUpdateListeners = std.algorithm.remove(onUpdateListeners, index);
break;
}
}
}
}
OnUpdateDelegateWrapper[] onUpdateListeners;
/**
* This signal is emitted whenever an event is handled while the gesture is
* recognized. @sequence is guaranteed to pertain to the set of active touches.
*
* Params:
* sequence = the #GdkEventSequence that was updated
*
* Since: 3.14
*/
gulong addOnUpdate(void delegate(GdkEventSequence*, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnUpdateDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"update",
cast(GCallback)&callBackUpdate,
cast(void*)wrapper,
cast(GClosureNotify)&callBackUpdateDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackUpdate(GtkGesture* gestureStruct, GdkEventSequence* sequence, OnUpdateDelegateWrapper wrapper)
{
wrapper.dlg(sequence, wrapper.outer);
}
extern(C) static void callBackUpdateDestroy(OnUpdateDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnUpdateGenericDelegateWrapper
{
void delegate(Event, Gesture) dlg;
gulong handlerId;
this(void delegate(Event, Gesture) dlg)
{
this.dlg = dlg;
onUpdateGenericListeners ~= this;
}
void remove(OnUpdateGenericDelegateWrapper source)
{
foreach(index, wrapper; onUpdateGenericListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onUpdateGenericListeners[index] = null;
onUpdateGenericListeners = std.algorithm.remove(onUpdateGenericListeners, index);
break;
}
}
}
}
OnUpdateGenericDelegateWrapper[] onUpdateGenericListeners;
/**
* This signal is emitted whenever an event is handled while the gesture is
* recognized. @sequence is guaranteed to pertain to the set of active touches.
*
* Params:
* sequence = the #GdkEventSequence that was updated
*
* Since: 3.14
*/
gulong addOnUpdate(void delegate(Event, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnUpdateGenericDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"update",
cast(GCallback)&callBackUpdateGeneric,
cast(void*)wrapper,
cast(GClosureNotify)&callBackUpdateGenericDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackUpdateGeneric(GtkGesture* gestureStruct, GdkEvent* sequence, OnUpdateGenericDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(Event)(sequence), wrapper.outer);
}
extern(C) static void callBackUpdateGenericDestroy(OnUpdateGenericDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
}
|