1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.Gesture;
26 
27 private import gdk.Device;
28 private import gdk.Event;
29 private import gdk.Window;
30 private import glib.ListG;
31 private import gobject.ObjectG;
32 private import gobject.Signals;
33 private import gtk.EventController;
34 public  import gtkc.gdktypes;
35 private import gtkc.gtk;
36 public  import gtkc.gtktypes;
37 
38 
39 /**
40  * #GtkGesture is the base object for gesture recognition, although this
41  * object is quite generalized to serve as a base for multi-touch gestures,
42  * it is suitable to implement single-touch and pointer-based gestures (using
43  * the special %NULL #GdkEventSequence value for these).
44  * 
45  * The number of touches that a #GtkGesture need to be recognized is controlled
46  * by the #GtkGesture:n-points property, if a gesture is keeping track of less
47  * or more than that number of sequences, it won't check wether the gesture
48  * is recognized.
49  * 
50  * As soon as the gesture has the expected number of touches, the gesture will
51  * run the #GtkGesture::check signal regularly on input events until the gesture
52  * is recognized, the criteria to consider a gesture as "recognized" is left to
53  * #GtkGesture subclasses.
54  * 
55  * A recognized gesture will then emit the following signals:
56  * - #GtkGesture::begin when the gesture is recognized.
57  * - A number of #GtkGesture::update, whenever an input event is processed.
58  * - #GtkGesture::end when the gesture is no longer recognized.
59  * 
60  * ## Event propagation
61  * 
62  * In order to receive events, a gesture needs to either set a propagation phase
63  * through gtk_event_controller_set_propagation_phase(), or feed those manually
64  * through gtk_event_controller_handle_event().
65  * 
66  * In the capture phase, events are propagated from the toplevel down to the
67  * target widget, and gestures that are attached to containers above the widget
68  * get a chance to interact with the event before it reaches the target.
69  * 
70  * After the capture phase, GTK+ emits the traditional #GtkWidget::button-press-event,
71  * #GtkWidget::button-release-event, #GtkWidget::touch-event, etc signals. Gestures
72  * with the %GTK_PHASE_TARGET phase are fed events from the default #GtkWidget::event
73  * handlers.
74  * 
75  * In the bubble phase, events are propagated up from the target widget to the
76  * toplevel, and gestures that are attached to containers above the widget get
77  * a chance to interact with events that have not been handled yet.
78  * 
79  * ## States of a sequence # {#touch-sequence-states}
80  * 
81  * Whenever input interaction happens, a single event may trigger a cascade of
82  * #GtkGestures, both across the parents of the widget receiving the event and
83  * in parallel within an individual widget. It is a responsibility of the
84  * widgets using those gestures to set the state of touch sequences accordingly
85  * in order to enable cooperation of gestures around the #GdkEventSequences
86  * triggering those.
87  * 
88  * Within a widget, gestures can be grouped through gtk_gesture_group(),
89  * grouped gestures synchronize the state of sequences, so calling
90  * gtk_gesture_set_sequence_state() on one will effectively propagate
91  * the state throughout the group.
92  * 
93  * By default, all sequences start out in the #GTK_EVENT_SEQUENCE_NONE state,
94  * sequences in this state trigger the gesture event handler, but event
95  * propagation will continue unstopped by gestures.
96  * 
97  * If a sequence enters into the #GTK_EVENT_SEQUENCE_DENIED state, the gesture
98  * group will effectively ignore the sequence, letting events go unstopped
99  * through the gesture, but the "slot" will still remain occupied while
100  * the touch is active.
101  * 
102  * If a sequence enters in the #GTK_EVENT_SEQUENCE_CLAIMED state, the gesture
103  * group will grab all interaction on the sequence, by:
104  * - Setting the same sequence to #GTK_EVENT_SEQUENCE_DENIED on every other gesture
105  * group within the widget, and every gesture on parent widgets in the propagation
106  * chain.
107  * - calling #GtkGesture::cancel on every gesture in widgets underneath in the
108  * propagation chain.
109  * - Stopping event propagation after the gesture group handles the event.
110  * 
111  * Note: if a sequence is set early to #GTK_EVENT_SEQUENCE_CLAIMED on
112  * #GDK_TOUCH_BEGIN/#GDK_BUTTON_PRESS (so those events are captured before
113  * reaching the event widget, this implies #GTK_PHASE_CAPTURE), one similar
114  * event will emulated if the sequence changes to #GTK_EVENT_SEQUENCE_DENIED.
115  * This way event coherence is preserved before event propagation is unstopped
116  * again.
117  * 
118  * Sequence states can't be changed freely, see gtk_gesture_set_sequence_state()
119  * to know about the possible lifetimes of a #GdkEventSequence.
120  * 
121  * ## Touchpad gestures
122  * 
123  * On the platforms that support it, #GtkGesture will handle transparently
124  * touchpad gesture events. The only precautions users of #GtkGesture should do
125  * to enable this support are:
126  * - Enabling %GDK_TOUCHPAD_GESTURE_MASK on their #GdkWindows
127  * - If the gesture has %GTK_PHASE_NONE, ensuring events of type
128  * %GDK_TOUCHPAD_SWIPE and %GDK_TOUCHPAD_PINCH are handled by the #GtkGesture
129  */
130 public class Gesture : EventController
131 {
132 	/** the main Gtk struct */
133 	protected GtkGesture* gtkGesture;
134 
135 	/** Get the main Gtk struct */
136 	public GtkGesture* getGestureStruct()
137 	{
138 		return gtkGesture;
139 	}
140 
141 	/** the main Gtk struct as a void* */
142 	protected override void* getStruct()
143 	{
144 		return cast(void*)gtkGesture;
145 	}
146 
147 	protected override void setStruct(GObject* obj)
148 	{
149 		gtkGesture = cast(GtkGesture*)obj;
150 		super.setStruct(obj);
151 	}
152 
153 	/**
154 	 * Sets our main struct and passes it to the parent class.
155 	 */
156 	public this (GtkGesture* gtkGesture, bool ownedRef = false)
157 	{
158 		this.gtkGesture = gtkGesture;
159 		super(cast(GtkEventController*)gtkGesture, ownedRef);
160 	}
161 
162 
163 	/** */
164 	public static GType getType()
165 	{
166 		return gtk_gesture_get_type();
167 	}
168 
169 	/**
170 	 * If there are touch sequences being currently handled by @gesture,
171 	 * this function returns %TRUE and fills in @rect with the bounding
172 	 * box containing all active touches. Otherwise, %FALSE will be
173 	 * returned.
174 	 *
175 	 * Note: This function will yield unexpected results on touchpad
176 	 * gestures. Since there is no correlation between physical and
177 	 * pixel distances, these will look as if constrained in an
178 	 * infinitely small area, @rect width and height will thus be 0
179 	 * regardless of the number of touchpoints.
180 	 *
181 	 * Params:
182 	 *     rect = bounding box containing all active touches.
183 	 *
184 	 * Return: %TRUE if there are active touches, %FALSE otherwise
185 	 *
186 	 * Since: 3.14
187 	 */
188 	public bool getBoundingBox(out GdkRectangle rect)
189 	{
190 		return gtk_gesture_get_bounding_box(gtkGesture, &rect) != 0;
191 	}
192 
193 	/**
194 	 * If there are touch sequences being currently handled by @gesture,
195 	 * this function returns %TRUE and fills in @x and @y with the center
196 	 * of the bounding box containing all active touches. Otherwise, %FALSE
197 	 * will be returned.
198 	 *
199 	 * Params:
200 	 *     x = X coordinate for the bounding box center
201 	 *     y = Y coordinate for the bounding box center
202 	 *
203 	 * Return: %FALSE if no active touches are present, %TRUE otherwise
204 	 *
205 	 * Since: 3.14
206 	 */
207 	public bool getBoundingBoxCenter(out double x, out double y)
208 	{
209 		return gtk_gesture_get_bounding_box_center(gtkGesture, &x, &y) != 0;
210 	}
211 
212 	/**
213 	 * Returns the master #GdkDevice that is currently operating
214 	 * on @gesture, or %NULL if the gesture is not being interacted.
215 	 *
216 	 * Return: a #GdkDevice, or %NULL
217 	 *
218 	 * Since: 3.14
219 	 */
220 	public Device getDevice()
221 	{
222 		auto p = gtk_gesture_get_device(gtkGesture);
223 		
224 		if(p is null)
225 		{
226 			return null;
227 		}
228 		
229 		return ObjectG.getDObject!(Device)(cast(GdkDevice*) p);
230 	}
231 
232 	/**
233 	 * Returns all gestures in the group of @gesture
234 	 *
235 	 * Return: The list
236 	 *     of #GtkGestures, free with g_list_free()
237 	 *
238 	 * Since: 3.14
239 	 */
240 	public ListG getGroup()
241 	{
242 		auto p = gtk_gesture_get_group(gtkGesture);
243 		
244 		if(p is null)
245 		{
246 			return null;
247 		}
248 		
249 		return new ListG(cast(GList*) p);
250 	}
251 
252 	/**
253 	 * Returns the last event that was processed for @sequence.
254 	 *
255 	 * Note that the returned pointer is only valid as long as the @sequence
256 	 * is still interpreted by the @gesture. If in doubt, you should make
257 	 * a copy of the event.
258 	 *
259 	 * Params:
260 	 *     sequence = a #GdkEventSequence
261 	 *
262 	 * Return: The last event from @sequence
263 	 */
264 	public Event getLastEvent(GdkEventSequence* sequence)
265 	{
266 		auto p = gtk_gesture_get_last_event(gtkGesture, sequence);
267 		
268 		if(p is null)
269 		{
270 			return null;
271 		}
272 		
273 		return ObjectG.getDObject!(Event)(cast(GdkEvent*) p);
274 	}
275 
276 	/**
277 	 * Returns the #GdkEventSequence that was last updated on @gesture.
278 	 *
279 	 * Return: The last updated sequence
280 	 *
281 	 * Since: 3.14
282 	 */
283 	public GdkEventSequence* getLastUpdatedSequence()
284 	{
285 		return gtk_gesture_get_last_updated_sequence(gtkGesture);
286 	}
287 
288 	/**
289 	 * If @sequence is currently being interpreted by @gesture, this
290 	 * function returns %TRUE and fills in @x and @y with the last coordinates
291 	 * stored for that event sequence. The coordinates are always relative to the
292 	 * widget allocation.
293 	 *
294 	 * Params:
295 	 *     sequence = a #GdkEventSequence, or %NULL for pointer events
296 	 *     x = return location for X axis of the sequence coordinates
297 	 *     y = return location for Y axis of the sequence coordinates
298 	 *
299 	 * Return: %TRUE if @sequence is currently interpreted
300 	 *
301 	 * Since: 3.14
302 	 */
303 	public bool getPoint(GdkEventSequence* sequence, out double x, out double y)
304 	{
305 		return gtk_gesture_get_point(gtkGesture, sequence, &x, &y) != 0;
306 	}
307 
308 	/**
309 	 * Returns the @sequence state, as seen by @gesture.
310 	 *
311 	 * Params:
312 	 *     sequence = a #GdkEventSequence
313 	 *
314 	 * Return: The sequence state in @gesture
315 	 *
316 	 * Since: 3.14
317 	 */
318 	public GtkEventSequenceState getSequenceState(GdkEventSequence* sequence)
319 	{
320 		return gtk_gesture_get_sequence_state(gtkGesture, sequence);
321 	}
322 
323 	/**
324 	 * Returns the list of #GdkEventSequences currently being interpreted
325 	 * by @gesture.
326 	 *
327 	 * Return: A list
328 	 *     of #GdkEventSequences, the list elements are owned by GTK+
329 	 *     and must not be freed or modified, the list itself must be deleted
330 	 *     through g_list_free()
331 	 *
332 	 * Since: 3.14
333 	 */
334 	public ListG getSequences()
335 	{
336 		auto p = gtk_gesture_get_sequences(gtkGesture);
337 		
338 		if(p is null)
339 		{
340 			return null;
341 		}
342 		
343 		return new ListG(cast(GList*) p);
344 	}
345 
346 	/**
347 	 * Returns the user-defined window that receives the events
348 	 * handled by @gesture. See gtk_gesture_set_window() for more
349 	 * information.
350 	 *
351 	 * Return: the user defined window, or %NULL if none
352 	 *
353 	 * Since: 3.14
354 	 */
355 	public Window getWindow()
356 	{
357 		auto p = gtk_gesture_get_window(gtkGesture);
358 		
359 		if(p is null)
360 		{
361 			return null;
362 		}
363 		
364 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
365 	}
366 
367 	/**
368 	 * Adds @gesture to the same group than @group_gesture. Gestures
369 	 * are by default isolated in their own groups.
370 	 *
371 	 * When gestures are grouped, the state of #GdkEventSequences
372 	 * is kept in sync for all of those, so calling gtk_gesture_set_sequence_state(),
373 	 * on one will transfer the same value to the others.
374 	 *
375 	 * Groups also perform an "implicit grabbing" of sequences, if a
376 	 * #GdkEventSequence state is set to #GTK_EVENT_SEQUENCE_CLAIMED on one group,
377 	 * every other gesture group attached to the same #GtkWidget will switch the
378 	 * state for that sequence to #GTK_EVENT_SEQUENCE_DENIED.
379 	 *
380 	 * Params:
381 	 *     gesture = a #GtkGesture
382 	 *
383 	 * Since: 3.14
384 	 */
385 	public void group(Gesture gesture)
386 	{
387 		gtk_gesture_group(gtkGesture, (gesture is null) ? null : gesture.getGestureStruct());
388 	}
389 
390 	/**
391 	 * Returns %TRUE if @gesture is currently handling events corresponding to
392 	 * @sequence.
393 	 *
394 	 * Params:
395 	 *     sequence = a #GdkEventSequence
396 	 *
397 	 * Return: %TRUE if @gesture is handling @sequence
398 	 *
399 	 * Since: 3.14
400 	 */
401 	public bool handlesSequence(GdkEventSequence* sequence)
402 	{
403 		return gtk_gesture_handles_sequence(gtkGesture, sequence) != 0;
404 	}
405 
406 	/**
407 	 * Returns %TRUE if the gesture is currently active.
408 	 * A gesture is active meanwhile there are touch sequences
409 	 * interacting with it.
410 	 *
411 	 * Return: %TRUE if gesture is active
412 	 *
413 	 * Since: 3.14
414 	 */
415 	public bool isActive()
416 	{
417 		return gtk_gesture_is_active(gtkGesture) != 0;
418 	}
419 
420 	/**
421 	 * Returns %TRUE if both gestures pertain to the same group.
422 	 *
423 	 * Params:
424 	 *     other = another #GtkGesture
425 	 *
426 	 * Return: whether the gestures are grouped
427 	 *
428 	 * Since: 3.14
429 	 */
430 	public bool isGroupedWith(Gesture other)
431 	{
432 		return gtk_gesture_is_grouped_with(gtkGesture, (other is null) ? null : other.getGestureStruct()) != 0;
433 	}
434 
435 	/**
436 	 * Returns %TRUE if the gesture is currently recognized.
437 	 * A gesture is recognized if there are as many interacting
438 	 * touch sequences as required by @gesture, and #GtkGesture::check
439 	 * returned %TRUE for the sequences being currently interpreted.
440 	 *
441 	 * Return: %TRUE if gesture is recognized
442 	 *
443 	 * Since: 3.14
444 	 */
445 	public bool isRecognized()
446 	{
447 		return gtk_gesture_is_recognized(gtkGesture) != 0;
448 	}
449 
450 	/**
451 	 * Sets the state of @sequence in @gesture. Sequences start
452 	 * in state #GTK_EVENT_SEQUENCE_NONE, and whenever they change
453 	 * state, they can never go back to that state. Likewise,
454 	 * sequences in state #GTK_EVENT_SEQUENCE_DENIED cannot turn
455 	 * back to a not denied state. With these rules, the lifetime
456 	 * of an event sequence is constrained to the next four:
457 	 *
458 	 * * None
459 	 * * None → Denied
460 	 * * None → Claimed
461 	 * * None → Claimed → Denied
462 	 *
463 	 * Note: Due to event handling ordering, it may be unsafe to
464 	 * set the state on another gesture within a #GtkGesture::begin
465 	 * signal handler, as the callback might be executed before
466 	 * the other gesture knows about the sequence. A safe way to
467 	 * perform this could be:
468 	 *
469 	 * |[
470 	 * static void
471 	 * first_gesture_begin_cb (GtkGesture       *first_gesture,
472 	 * GdkEventSequence *sequence,
473 	 * gpointer          user_data)
474 	 * {
475 	 * gtk_gesture_set_sequence_state (first_gesture, sequence, GTK_EVENT_SEQUENCE_ACCEPTED);
476 	 * gtk_gesture_set_sequence_state (second_gesture, sequence, GTK_EVENT_SEQUENCE_DENIED);
477 	 * }
478 	 *
479 	 * static void
480 	 * second_gesture_begin_cb (GtkGesture       *second_gesture,
481 	 * GdkEventSequence *sequence,
482 	 * gpointer          user_data)
483 	 * {
484 	 * if (gtk_gesture_get_sequence_state (first_gesture, sequence) == GTK_EVENT_SEQUENCE_ACCEPTED)
485 	 * gtk_gesture_set_sequence_state (second_gesture, sequence, GTK_EVENT_SEQUENCE_DENIED);
486 	 * }
487 	 * ]|
488 	 *
489 	 * If both gestures are in the same group, just set the state on
490 	 * the gesture emitting the event, the sequence will be already
491 	 * be initialized to the group's global state when the second
492 	 * gesture processes the event.
493 	 *
494 	 * Params:
495 	 *     sequence = a #GdkEventSequence
496 	 *     state = the sequence state
497 	 *
498 	 * Return: %TRUE if @sequence is handled by @gesture,
499 	 *     and the state is changed successfully
500 	 *
501 	 * Since: 3.14
502 	 */
503 	public bool setSequenceState(GdkEventSequence* sequence, GtkEventSequenceState state)
504 	{
505 		return gtk_gesture_set_sequence_state(gtkGesture, sequence, state) != 0;
506 	}
507 
508 	/**
509 	 * Sets the state of all sequences that @gesture is currently
510 	 * interacting with. See gtk_gesture_set_sequence_state()
511 	 * for more details on sequence states.
512 	 *
513 	 * Params:
514 	 *     state = the sequence state
515 	 *
516 	 * Return: %TRUE if the state of at least one sequence
517 	 *     was changed successfully
518 	 *
519 	 * Since: 3.14
520 	 */
521 	public bool setState(GtkEventSequenceState state)
522 	{
523 		return gtk_gesture_set_state(gtkGesture, state) != 0;
524 	}
525 
526 	/**
527 	 * Sets a specific window to receive events about, so @gesture
528 	 * will effectively handle only events targeting @window, or
529 	 * a child of it. @window must pertain to gtk_event_controller_get_widget().
530 	 *
531 	 * Params:
532 	 *     window = a #GdkWindow, or %NULL
533 	 *
534 	 * Since: 3.14
535 	 */
536 	public void setWindow(Window window)
537 	{
538 		gtk_gesture_set_window(gtkGesture, (window is null) ? null : window.getWindowStruct());
539 	}
540 
541 	/**
542 	 * Separates @gesture into an isolated group.
543 	 *
544 	 * Since: 3.14
545 	 */
546 	public void ungroup()
547 	{
548 		gtk_gesture_ungroup(gtkGesture);
549 	}
550 
551 	int[string] connectedSignals;
552 
553 	void delegate(GdkEventSequence*, Gesture)[] onBeginListeners;
554 	/**
555 	 * This signal is emitted when the gesture is recognized. This means the
556 	 * number of touch sequences matches #GtkGesture:n-points, and the #GtkGesture::check
557 	 * handler(s) returned #TRUE.
558 	 *
559 	 * Note: These conditions may also happen when an extra touch (eg. a third touch
560 	 * on a 2-touches gesture) is lifted, in that situation @sequence won't pertain
561 	 * to the current set of active touches, so don't rely on this being true.
562 	 *
563 	 * Params:
564 	 *     sequence = the #GdkEventSequence that made the gesture to be recognized
565 	 *
566 	 * Since: 3.14
567 	 */
568 	void addOnBegin(void delegate(GdkEventSequence*, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
569 	{
570 		if ( "begin" !in connectedSignals )
571 		{
572 			Signals.connectData(
573 				this,
574 				"begin",
575 				cast(GCallback)&callBackBegin,
576 				cast(void*)this,
577 				null,
578 				connectFlags);
579 			connectedSignals["begin"] = 1;
580 		}
581 		onBeginListeners ~= dlg;
582 	}
583 	extern(C) static void callBackBegin(GtkGesture* gestureStruct, GdkEventSequence* sequence, Gesture _gesture)
584 	{
585 		foreach ( void delegate(GdkEventSequence*, Gesture) dlg; _gesture.onBeginListeners )
586 		{
587 			dlg(sequence, _gesture);
588 		}
589 	}
590 
591 	void delegate(Event, Gesture)[] onBeginGenericListeners;
592 	/**
593 	 * This signal is emitted when the gesture is recognized. This means the
594 	 * number of touch sequences matches #GtkGesture:n-points, and the #GtkGesture::check
595 	 * handler(s) returned #TRUE.
596 	 *
597 	 * Note: These conditions may also happen when an extra touch (eg. a third touch
598 	 * on a 2-touches gesture) is lifted, in that situation @sequence won't pertain
599 	 * to the current set of active touches, so don't rely on this being true.
600 	 *
601 	 * Params:
602 	 *     sequence = the #GdkEventSequence that made the gesture to be recognized
603 	 *
604 	 * Since: 3.14
605 	 */
606 	void addOnBegin(void delegate(Event, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
607 	{
608 		if ( "begin-generic-event" !in connectedSignals )
609 		{
610 			Signals.connectData(
611 				this,
612 				"begin",
613 				cast(GCallback)&callBackBeginGeneric,
614 				cast(void*)this,
615 				null,
616 				connectFlags);
617 			connectedSignals["begin-generic-event"] = 1;
618 		}
619 		onBeginGenericListeners ~= dlg;
620 	}
621 	extern(C) static void callBackBeginGeneric(GtkGesture* gestureStruct, GdkEvent* sequence, Gesture _gesture)
622 	{
623 		foreach ( void delegate(Event, Gesture) dlg; _gesture.onBeginGenericListeners )
624 		{
625 			dlg(ObjectG.getDObject!(Event)(sequence), _gesture);
626 		}
627 	}
628 
629 	void delegate(GdkEventSequence*, Gesture)[] onCancelListeners;
630 	/**
631 	 * This signal is emitted whenever a sequence is cancelled. This usually
632 	 * happens on active touches when gtk_event_controller_reset() is called
633 	 * on @gesture (manually, due to grabs...), or the individual @sequence
634 	 * was claimed by parent widgets' controllers (see gtk_gesture_set_sequence_state()).
635 	 *
636 	 * @gesture must forget everything about @sequence as a reaction to this signal.
637 	 *
638 	 * Params:
639 	 *     sequence = the #GdkEventSequence that was cancelled
640 	 *
641 	 * Since: 3.14
642 	 */
643 	void addOnCancel(void delegate(GdkEventSequence*, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
644 	{
645 		if ( "cancel" !in connectedSignals )
646 		{
647 			Signals.connectData(
648 				this,
649 				"cancel",
650 				cast(GCallback)&callBackCancel,
651 				cast(void*)this,
652 				null,
653 				connectFlags);
654 			connectedSignals["cancel"] = 1;
655 		}
656 		onCancelListeners ~= dlg;
657 	}
658 	extern(C) static void callBackCancel(GtkGesture* gestureStruct, GdkEventSequence* sequence, Gesture _gesture)
659 	{
660 		foreach ( void delegate(GdkEventSequence*, Gesture) dlg; _gesture.onCancelListeners )
661 		{
662 			dlg(sequence, _gesture);
663 		}
664 	}
665 
666 	void delegate(Event, Gesture)[] onCancelGenericListeners;
667 	/**
668 	 * This signal is emitted whenever a sequence is cancelled. This usually
669 	 * happens on active touches when gtk_event_controller_reset() is called
670 	 * on @gesture (manually, due to grabs...), or the individual @sequence
671 	 * was claimed by parent widgets' controllers (see gtk_gesture_set_sequence_state()).
672 	 *
673 	 * @gesture must forget everything about @sequence as a reaction to this signal.
674 	 *
675 	 * Params:
676 	 *     sequence = the #GdkEventSequence that was cancelled
677 	 *
678 	 * Since: 3.14
679 	 */
680 	void addOnCancel(void delegate(Event, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
681 	{
682 		if ( "cancel-generic-event" !in connectedSignals )
683 		{
684 			Signals.connectData(
685 				this,
686 				"cancel",
687 				cast(GCallback)&callBackCancelGeneric,
688 				cast(void*)this,
689 				null,
690 				connectFlags);
691 			connectedSignals["cancel-generic-event"] = 1;
692 		}
693 		onCancelGenericListeners ~= dlg;
694 	}
695 	extern(C) static void callBackCancelGeneric(GtkGesture* gestureStruct, GdkEvent* sequence, Gesture _gesture)
696 	{
697 		foreach ( void delegate(Event, Gesture) dlg; _gesture.onCancelGenericListeners )
698 		{
699 			dlg(ObjectG.getDObject!(Event)(sequence), _gesture);
700 		}
701 	}
702 
703 	void delegate(GdkEventSequence*, Gesture)[] onEndListeners;
704 	/**
705 	 * This signal is emitted when @gesture either stopped recognizing the event
706 	 * sequences as something to be handled (the #GtkGesture::check handler returned
707 	 * %FALSE), or the number of touch sequences became higher or lower than
708 	 * #GtkGesture:n-points.
709 	 *
710 	 * Note: @sequence might not pertain to the group of sequences that were
711 	 * previously triggering recognition on @gesture (ie. a just pressed touch
712 	 * sequence that exceeds #GtkGesture:n-points). This situation may be detected
713 	 * by checking through gtk_gesture_handles_sequence().
714 	 *
715 	 * Params:
716 	 *     sequence = the #GdkEventSequence that made gesture recognition to finish
717 	 *
718 	 * Since: 3.14
719 	 */
720 	void addOnEnd(void delegate(GdkEventSequence*, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
721 	{
722 		if ( "end" !in connectedSignals )
723 		{
724 			Signals.connectData(
725 				this,
726 				"end",
727 				cast(GCallback)&callBackEnd,
728 				cast(void*)this,
729 				null,
730 				connectFlags);
731 			connectedSignals["end"] = 1;
732 		}
733 		onEndListeners ~= dlg;
734 	}
735 	extern(C) static void callBackEnd(GtkGesture* gestureStruct, GdkEventSequence* sequence, Gesture _gesture)
736 	{
737 		foreach ( void delegate(GdkEventSequence*, Gesture) dlg; _gesture.onEndListeners )
738 		{
739 			dlg(sequence, _gesture);
740 		}
741 	}
742 
743 	void delegate(Event, Gesture)[] onEndGenericListeners;
744 	/**
745 	 * This signal is emitted when @gesture either stopped recognizing the event
746 	 * sequences as something to be handled (the #GtkGesture::check handler returned
747 	 * %FALSE), or the number of touch sequences became higher or lower than
748 	 * #GtkGesture:n-points.
749 	 *
750 	 * Note: @sequence might not pertain to the group of sequences that were
751 	 * previously triggering recognition on @gesture (ie. a just pressed touch
752 	 * sequence that exceeds #GtkGesture:n-points). This situation may be detected
753 	 * by checking through gtk_gesture_handles_sequence().
754 	 *
755 	 * Params:
756 	 *     sequence = the #GdkEventSequence that made gesture recognition to finish
757 	 *
758 	 * Since: 3.14
759 	 */
760 	void addOnEnd(void delegate(Event, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
761 	{
762 		if ( "end-generic-event" !in connectedSignals )
763 		{
764 			Signals.connectData(
765 				this,
766 				"end",
767 				cast(GCallback)&callBackEndGeneric,
768 				cast(void*)this,
769 				null,
770 				connectFlags);
771 			connectedSignals["end-generic-event"] = 1;
772 		}
773 		onEndGenericListeners ~= dlg;
774 	}
775 	extern(C) static void callBackEndGeneric(GtkGesture* gestureStruct, GdkEvent* sequence, Gesture _gesture)
776 	{
777 		foreach ( void delegate(Event, Gesture) dlg; _gesture.onEndGenericListeners )
778 		{
779 			dlg(ObjectG.getDObject!(Event)(sequence), _gesture);
780 		}
781 	}
782 
783 	void delegate(GdkEventSequence*, GtkEventSequenceState, Gesture)[] onSequenceStateChangedListeners;
784 	/**
785 	 * This signal is emitted whenever a sequence state changes. See
786 	 * gtk_gesture_set_sequence_state() to know more about the expectable
787 	 * sequence lifetimes.
788 	 *
789 	 * Params:
790 	 *     sequence = the #GdkEventSequence that was cancelled
791 	 *     state = the new sequence state
792 	 *
793 	 * Since: 3.14
794 	 */
795 	void addOnSequenceStateChanged(void delegate(GdkEventSequence*, GtkEventSequenceState, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
796 	{
797 		if ( "sequence-state-changed" !in connectedSignals )
798 		{
799 			Signals.connectData(
800 				this,
801 				"sequence-state-changed",
802 				cast(GCallback)&callBackSequenceStateChanged,
803 				cast(void*)this,
804 				null,
805 				connectFlags);
806 			connectedSignals["sequence-state-changed"] = 1;
807 		}
808 		onSequenceStateChangedListeners ~= dlg;
809 	}
810 	extern(C) static void callBackSequenceStateChanged(GtkGesture* gestureStruct, GdkEventSequence* sequence, GtkEventSequenceState state, Gesture _gesture)
811 	{
812 		foreach ( void delegate(GdkEventSequence*, GtkEventSequenceState, Gesture) dlg; _gesture.onSequenceStateChangedListeners )
813 		{
814 			dlg(sequence, state, _gesture);
815 		}
816 	}
817 
818 	void delegate(Event, GtkEventSequenceState, Gesture)[] onSequenceStateChangedGenericListeners;
819 	/**
820 	 * This signal is emitted whenever a sequence state changes. See
821 	 * gtk_gesture_set_sequence_state() to know more about the expectable
822 	 * sequence lifetimes.
823 	 *
824 	 * Params:
825 	 *     sequence = the #GdkEventSequence that was cancelled
826 	 *     state = the new sequence state
827 	 *
828 	 * Since: 3.14
829 	 */
830 	void addOnSequenceStateChanged(void delegate(Event, GtkEventSequenceState, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
831 	{
832 		if ( "sequence-state-changed-generic-event" !in connectedSignals )
833 		{
834 			Signals.connectData(
835 				this,
836 				"sequence-state-changed",
837 				cast(GCallback)&callBackSequenceStateChangedGeneric,
838 				cast(void*)this,
839 				null,
840 				connectFlags);
841 			connectedSignals["sequence-state-changed-generic-event"] = 1;
842 		}
843 		onSequenceStateChangedGenericListeners ~= dlg;
844 	}
845 	extern(C) static void callBackSequenceStateChangedGeneric(GtkGesture* gestureStruct, GdkEvent* sequence, GtkEventSequenceState state, Gesture _gesture)
846 	{
847 		foreach ( void delegate(Event, GtkEventSequenceState, Gesture) dlg; _gesture.onSequenceStateChangedGenericListeners )
848 		{
849 			dlg(ObjectG.getDObject!(Event)(sequence), state, _gesture);
850 		}
851 	}
852 
853 	void delegate(GdkEventSequence*, Gesture)[] onUpdateListeners;
854 	/**
855 	 * This signal is emitted whenever an event is handled while the gesture is
856 	 * recognized. @sequence is guaranteed to pertain to the set of active touches.
857 	 *
858 	 * Params:
859 	 *     sequence = the #GdkEventSequence that was updated
860 	 *
861 	 * Since: 3.14
862 	 */
863 	void addOnUpdate(void delegate(GdkEventSequence*, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
864 	{
865 		if ( "update" !in connectedSignals )
866 		{
867 			Signals.connectData(
868 				this,
869 				"update",
870 				cast(GCallback)&callBackUpdate,
871 				cast(void*)this,
872 				null,
873 				connectFlags);
874 			connectedSignals["update"] = 1;
875 		}
876 		onUpdateListeners ~= dlg;
877 	}
878 	extern(C) static void callBackUpdate(GtkGesture* gestureStruct, GdkEventSequence* sequence, Gesture _gesture)
879 	{
880 		foreach ( void delegate(GdkEventSequence*, Gesture) dlg; _gesture.onUpdateListeners )
881 		{
882 			dlg(sequence, _gesture);
883 		}
884 	}
885 
886 	void delegate(Event, Gesture)[] onUpdateGenericListeners;
887 	/**
888 	 * This signal is emitted whenever an event is handled while the gesture is
889 	 * recognized. @sequence is guaranteed to pertain to the set of active touches.
890 	 *
891 	 * Params:
892 	 *     sequence = the #GdkEventSequence that was updated
893 	 *
894 	 * Since: 3.14
895 	 */
896 	void addOnUpdate(void delegate(Event, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
897 	{
898 		if ( "update-generic-event" !in connectedSignals )
899 		{
900 			Signals.connectData(
901 				this,
902 				"update",
903 				cast(GCallback)&callBackUpdateGeneric,
904 				cast(void*)this,
905 				null,
906 				connectFlags);
907 			connectedSignals["update-generic-event"] = 1;
908 		}
909 		onUpdateGenericListeners ~= dlg;
910 	}
911 	extern(C) static void callBackUpdateGeneric(GtkGesture* gestureStruct, GdkEvent* sequence, Gesture _gesture)
912 	{
913 		foreach ( void delegate(Event, Gesture) dlg; _gesture.onUpdateGenericListeners )
914 		{
915 			dlg(ObjectG.getDObject!(Event)(sequence), _gesture);
916 		}
917 	}
918 }