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 	 * Params:
256 	 *     sequence = a #GdkEventSequence
257 	 *
258 	 * Return: The last event from @sequence
259 	 */
260 	public Event getLastEvent(GdkEventSequence* sequence)
261 	{
262 		auto p = gtk_gesture_get_last_event(gtkGesture, sequence);
263 		
264 		if(p is null)
265 		{
266 			return null;
267 		}
268 		
269 		return ObjectG.getDObject!(Event)(cast(GdkEvent*) p);
270 	}
271 
272 	/**
273 	 * Returns the #GdkEventSequence that was last updated on @gesture.
274 	 *
275 	 * Return: The last updated sequence
276 	 *
277 	 * Since: 3.14
278 	 */
279 	public GdkEventSequence* getLastUpdatedSequence()
280 	{
281 		return gtk_gesture_get_last_updated_sequence(gtkGesture);
282 	}
283 
284 	/**
285 	 * If @sequence is currently being interpreted by @gesture, this
286 	 * function returns %TRUE and fills in @x and @y with the last coordinates
287 	 * stored for that event sequence. The coordinates are always relative to the
288 	 * widget allocation.
289 	 *
290 	 * Params:
291 	 *     sequence = a #GdkEventSequence, or %NULL for pointer events
292 	 *     x = return location for X axis of the sequence coordinates
293 	 *     y = return location for Y axis of the sequence coordinates
294 	 *
295 	 * Return: %TRUE if @sequence is currently interpreted
296 	 *
297 	 * Since: 3.14
298 	 */
299 	public bool getPoint(GdkEventSequence* sequence, out double x, out double y)
300 	{
301 		return gtk_gesture_get_point(gtkGesture, sequence, &x, &y) != 0;
302 	}
303 
304 	/**
305 	 * Returns the @sequence state, as seen by @gesture.
306 	 *
307 	 * Params:
308 	 *     sequence = a #GdkEventSequence
309 	 *
310 	 * Return: The sequence state in @gesture
311 	 *
312 	 * Since: 3.14
313 	 */
314 	public GtkEventSequenceState getSequenceState(GdkEventSequence* sequence)
315 	{
316 		return gtk_gesture_get_sequence_state(gtkGesture, sequence);
317 	}
318 
319 	/**
320 	 * Returns the list of #GdkEventSequences currently being interpreted
321 	 * by @gesture.
322 	 *
323 	 * Return: A list
324 	 *     of #GdkEventSequences, the list elements are owned by GTK+
325 	 *     and must not be freed or modified, the list itself must be deleted
326 	 *     through g_list_free()
327 	 *
328 	 * Since: 3.14
329 	 */
330 	public ListG getSequences()
331 	{
332 		auto p = gtk_gesture_get_sequences(gtkGesture);
333 		
334 		if(p is null)
335 		{
336 			return null;
337 		}
338 		
339 		return new ListG(cast(GList*) p);
340 	}
341 
342 	/**
343 	 * Returns the user-defined window that receives the events
344 	 * handled by @gesture. See gtk_gesture_set_window() for more
345 	 * information.
346 	 *
347 	 * Return: the user defined window, or %NULL if none
348 	 *
349 	 * Since: 3.14
350 	 */
351 	public Window getWindow()
352 	{
353 		auto p = gtk_gesture_get_window(gtkGesture);
354 		
355 		if(p is null)
356 		{
357 			return null;
358 		}
359 		
360 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
361 	}
362 
363 	/**
364 	 * Adds @gesture to the same group than @group_gesture. Gestures
365 	 * are by default isolated in their own groups.
366 	 *
367 	 * When gestures are grouped, the state of #GdkEventSequences
368 	 * is kept in sync for all of those, so calling gtk_gesture_set_sequence_state(),
369 	 * on one will transfer the same value to the others.
370 	 *
371 	 * Groups also perform an "implicit grabbing" of sequences, if a
372 	 * #GdkEventSequence state is set to #GTK_EVENT_SEQUENCE_CLAIMED on one group,
373 	 * every other gesture group attached to the same #GtkWidget will switch the
374 	 * state for that sequence to #GTK_EVENT_SEQUENCE_DENIED.
375 	 *
376 	 * Params:
377 	 *     gesture = a #GtkGesture
378 	 *
379 	 * Since: 3.14
380 	 */
381 	public void group(Gesture gesture)
382 	{
383 		gtk_gesture_group(gtkGesture, (gesture is null) ? null : gesture.getGestureStruct());
384 	}
385 
386 	/**
387 	 * Returns %TRUE if @gesture is currently handling events corresponding to
388 	 * @sequence.
389 	 *
390 	 * Params:
391 	 *     sequence = a #GdkEventSequence
392 	 *
393 	 * Return: %TRUE if @gesture is handling @sequence
394 	 *
395 	 * Since: 3.14
396 	 */
397 	public bool handlesSequence(GdkEventSequence* sequence)
398 	{
399 		return gtk_gesture_handles_sequence(gtkGesture, sequence) != 0;
400 	}
401 
402 	/**
403 	 * Returns %TRUE if the gesture is currently active.
404 	 * A gesture is active meanwhile there are touch sequences
405 	 * interacting with it.
406 	 *
407 	 * Return: %TRUE if gesture is active
408 	 *
409 	 * Since: 3.14
410 	 */
411 	public bool isActive()
412 	{
413 		return gtk_gesture_is_active(gtkGesture) != 0;
414 	}
415 
416 	/**
417 	 * Returns %TRUE if both gestures pertain to the same group.
418 	 *
419 	 * Params:
420 	 *     other = another #GtkGesture
421 	 *
422 	 * Return: whether the gestures are grouped
423 	 *
424 	 * Since: 3.14
425 	 */
426 	public bool isGroupedWith(Gesture other)
427 	{
428 		return gtk_gesture_is_grouped_with(gtkGesture, (other is null) ? null : other.getGestureStruct()) != 0;
429 	}
430 
431 	/**
432 	 * Returns %TRUE if the gesture is currently recognized.
433 	 * A gesture is recognized if there are as many interacting
434 	 * touch sequences as required by @gesture, and #GtkGesture::check
435 	 * returned %TRUE for the sequences being currently interpreted.
436 	 *
437 	 * Return: %TRUE if gesture is recognized
438 	 *
439 	 * Since: 3.14
440 	 */
441 	public bool isRecognized()
442 	{
443 		return gtk_gesture_is_recognized(gtkGesture) != 0;
444 	}
445 
446 	/**
447 	 * Sets the state of @sequence in @gesture. Sequences start
448 	 * in state #GTK_EVENT_SEQUENCE_NONE, and whenever they change
449 	 * state, they can never go back to that state. Likewise,
450 	 * sequences in state #GTK_EVENT_SEQUENCE_DENIED cannot turn
451 	 * back to a not denied state. With these rules, the lifetime
452 	 * of an event sequence is constrained to the next four:
453 	 *
454 	 * * None
455 	 * * None → Denied
456 	 * * None → Claimed
457 	 * * None → Claimed → Denied
458 	 *
459 	 * Note: Due to event handling ordering, it may be unsafe to
460 	 * set the state on another gesture within a #GtkGesture::begin
461 	 * signal handler, as the callback might be executed before
462 	 * the other gesture knows about the sequence. A safe way to
463 	 * perform this could be:
464 	 *
465 	 * |[
466 	 * static void
467 	 * first_gesture_begin_cb (GtkGesture       *first_gesture,
468 	 * GdkEventSequence *sequence,
469 	 * gpointer          user_data)
470 	 * {
471 	 * gtk_gesture_set_sequence_state (first_gesture, sequence, GTK_EVENT_SEQUENCE_ACCEPTED);
472 	 * gtk_gesture_set_sequence_state (second_gesture, sequence, GTK_EVENT_SEQUENCE_DENIED);
473 	 * }
474 	 *
475 	 * static void
476 	 * second_gesture_begin_cb (GtkGesture       *second_gesture,
477 	 * GdkEventSequence *sequence,
478 	 * gpointer          user_data)
479 	 * {
480 	 * if (gtk_gesture_get_sequence_state (first_gesture, sequence) == GTK_EVENT_SEQUENCE_ACCEPTED)
481 	 * gtk_gesture_set_sequence_state (second_gesture, sequence, GTK_EVENT_SEQUENCE_DENIED);
482 	 * }
483 	 * ]|
484 	 *
485 	 * If both gestures are in the same group, just set the state on
486 	 * the gesture emitting the event, the sequence will be already
487 	 * be initialized to the group's global state when the second
488 	 * gesture processes the event.
489 	 *
490 	 * Params:
491 	 *     sequence = a #GdkEventSequence
492 	 *     state = the sequence state
493 	 *
494 	 * Return: %TRUE if @sequence is handled by @gesture,
495 	 *     and the state is changed successfully
496 	 *
497 	 * Since: 3.14
498 	 */
499 	public bool setSequenceState(GdkEventSequence* sequence, GtkEventSequenceState state)
500 	{
501 		return gtk_gesture_set_sequence_state(gtkGesture, sequence, state) != 0;
502 	}
503 
504 	/**
505 	 * Sets the state of all sequences that @gesture is currently
506 	 * interacting with. See gtk_gesture_set_sequence_state()
507 	 * for more details on sequence states.
508 	 *
509 	 * Params:
510 	 *     state = the sequence state
511 	 *
512 	 * Return: %TRUE if the state of at least one sequence
513 	 *     was changed successfully
514 	 *
515 	 * Since: 3.14
516 	 */
517 	public bool setState(GtkEventSequenceState state)
518 	{
519 		return gtk_gesture_set_state(gtkGesture, state) != 0;
520 	}
521 
522 	/**
523 	 * Sets a specific window to receive events about, so @gesture
524 	 * will effectively handle only events targeting @window, or
525 	 * a child of it. @window must pertain to gtk_event_controller_get_widget().
526 	 *
527 	 * Params:
528 	 *     window = a #GdkWindow, or %NULL
529 	 *
530 	 * Since: 3.14
531 	 */
532 	public void setWindow(Window window)
533 	{
534 		gtk_gesture_set_window(gtkGesture, (window is null) ? null : window.getWindowStruct());
535 	}
536 
537 	/**
538 	 * Separates @gesture into an isolated group.
539 	 *
540 	 * Since: 3.14
541 	 */
542 	public void ungroup()
543 	{
544 		gtk_gesture_ungroup(gtkGesture);
545 	}
546 
547 	int[string] connectedSignals;
548 
549 	void delegate(GdkEventSequence*, Gesture)[] onBeginListeners;
550 	/**
551 	 * This signal is emitted when the gesture is recognized. This means the
552 	 * number of touch sequences matches #GtkGesture:n-points, and the #GtkGesture::check
553 	 * handler(s) returned #TRUE.
554 	 *
555 	 * Note: These conditions may also happen when an extra touch (eg. a third touch
556 	 * on a 2-touches gesture) is lifted, in that situation @sequence won't pertain
557 	 * to the current set of active touches, so don't rely on this being true.
558 	 *
559 	 * Params:
560 	 *     sequence = the #GdkEventSequence that made the gesture to be recognized
561 	 *
562 	 * Since: 3.14
563 	 */
564 	void addOnBegin(void delegate(GdkEventSequence*, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
565 	{
566 		if ( "begin" !in connectedSignals )
567 		{
568 			Signals.connectData(
569 				this,
570 				"begin",
571 				cast(GCallback)&callBackBegin,
572 				cast(void*)this,
573 				null,
574 				connectFlags);
575 			connectedSignals["begin"] = 1;
576 		}
577 		onBeginListeners ~= dlg;
578 	}
579 	extern(C) static void callBackBegin(GtkGesture* gestureStruct, GdkEventSequence* sequence, Gesture _gesture)
580 	{
581 		foreach ( void delegate(GdkEventSequence*, Gesture) dlg; _gesture.onBeginListeners )
582 		{
583 			dlg(sequence, _gesture);
584 		}
585 	}
586 
587 	void delegate(Event, Gesture)[] onBeginGenericListeners;
588 	/**
589 	 * This signal is emitted when the gesture is recognized. This means the
590 	 * number of touch sequences matches #GtkGesture:n-points, and the #GtkGesture::check
591 	 * handler(s) returned #TRUE.
592 	 *
593 	 * Note: These conditions may also happen when an extra touch (eg. a third touch
594 	 * on a 2-touches gesture) is lifted, in that situation @sequence won't pertain
595 	 * to the current set of active touches, so don't rely on this being true.
596 	 *
597 	 * Params:
598 	 *     sequence = the #GdkEventSequence that made the gesture to be recognized
599 	 *
600 	 * Since: 3.14
601 	 */
602 	void addOnBegin(void delegate(Event, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
603 	{
604 		if ( "begin-generic-event" !in connectedSignals )
605 		{
606 			Signals.connectData(
607 				this,
608 				"begin",
609 				cast(GCallback)&callBackBeginGeneric,
610 				cast(void*)this,
611 				null,
612 				connectFlags);
613 			connectedSignals["begin-generic-event"] = 1;
614 		}
615 		onBeginGenericListeners ~= dlg;
616 	}
617 	extern(C) static void callBackBeginGeneric(GtkGesture* gestureStruct, GdkEvent* sequence, Gesture _gesture)
618 	{
619 		foreach ( void delegate(Event, Gesture) dlg; _gesture.onBeginGenericListeners )
620 		{
621 			dlg(ObjectG.getDObject!(Event)(sequence), _gesture);
622 		}
623 	}
624 
625 	void delegate(GdkEventSequence*, Gesture)[] onCancelListeners;
626 	/**
627 	 * This signal is emitted whenever a sequence is cancelled. This usually
628 	 * happens on active touches when gtk_event_controller_reset() is called
629 	 * on @gesture (manually, due to grabs...), or the individual @sequence
630 	 * was claimed by parent widgets' controllers (see gtk_gesture_set_sequence_state()).
631 	 *
632 	 * @gesture must forget everything about @sequence as a reaction to this signal.
633 	 *
634 	 * Params:
635 	 *     sequence = the #GdkEventSequence that was cancelled
636 	 *
637 	 * Since: 3.14
638 	 */
639 	void addOnCancel(void delegate(GdkEventSequence*, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
640 	{
641 		if ( "cancel" !in connectedSignals )
642 		{
643 			Signals.connectData(
644 				this,
645 				"cancel",
646 				cast(GCallback)&callBackCancel,
647 				cast(void*)this,
648 				null,
649 				connectFlags);
650 			connectedSignals["cancel"] = 1;
651 		}
652 		onCancelListeners ~= dlg;
653 	}
654 	extern(C) static void callBackCancel(GtkGesture* gestureStruct, GdkEventSequence* sequence, Gesture _gesture)
655 	{
656 		foreach ( void delegate(GdkEventSequence*, Gesture) dlg; _gesture.onCancelListeners )
657 		{
658 			dlg(sequence, _gesture);
659 		}
660 	}
661 
662 	void delegate(Event, Gesture)[] onCancelGenericListeners;
663 	/**
664 	 * This signal is emitted whenever a sequence is cancelled. This usually
665 	 * happens on active touches when gtk_event_controller_reset() is called
666 	 * on @gesture (manually, due to grabs...), or the individual @sequence
667 	 * was claimed by parent widgets' controllers (see gtk_gesture_set_sequence_state()).
668 	 *
669 	 * @gesture must forget everything about @sequence as a reaction to this signal.
670 	 *
671 	 * Params:
672 	 *     sequence = the #GdkEventSequence that was cancelled
673 	 *
674 	 * Since: 3.14
675 	 */
676 	void addOnCancel(void delegate(Event, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
677 	{
678 		if ( "cancel-generic-event" !in connectedSignals )
679 		{
680 			Signals.connectData(
681 				this,
682 				"cancel",
683 				cast(GCallback)&callBackCancelGeneric,
684 				cast(void*)this,
685 				null,
686 				connectFlags);
687 			connectedSignals["cancel-generic-event"] = 1;
688 		}
689 		onCancelGenericListeners ~= dlg;
690 	}
691 	extern(C) static void callBackCancelGeneric(GtkGesture* gestureStruct, GdkEvent* sequence, Gesture _gesture)
692 	{
693 		foreach ( void delegate(Event, Gesture) dlg; _gesture.onCancelGenericListeners )
694 		{
695 			dlg(ObjectG.getDObject!(Event)(sequence), _gesture);
696 		}
697 	}
698 
699 	void delegate(GdkEventSequence*, Gesture)[] onEndListeners;
700 	/**
701 	 * This signal is emitted when @gesture either stopped recognizing the event
702 	 * sequences as something to be handled (the #GtkGesture::check handler returned
703 	 * %FALSE), or the number of touch sequences became higher or lower than
704 	 * #GtkGesture:n-points.
705 	 *
706 	 * Note: @sequence might not pertain to the group of sequences that were
707 	 * previously triggering recognition on @gesture (ie. a just pressed touch
708 	 * sequence that exceeds #GtkGesture:n-points). This situation may be detected
709 	 * by checking through gtk_gesture_handles_sequence().
710 	 *
711 	 * Params:
712 	 *     sequence = the #GdkEventSequence that made gesture recognition to finish
713 	 *
714 	 * Since: 3.14
715 	 */
716 	void addOnEnd(void delegate(GdkEventSequence*, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
717 	{
718 		if ( "end" !in connectedSignals )
719 		{
720 			Signals.connectData(
721 				this,
722 				"end",
723 				cast(GCallback)&callBackEnd,
724 				cast(void*)this,
725 				null,
726 				connectFlags);
727 			connectedSignals["end"] = 1;
728 		}
729 		onEndListeners ~= dlg;
730 	}
731 	extern(C) static void callBackEnd(GtkGesture* gestureStruct, GdkEventSequence* sequence, Gesture _gesture)
732 	{
733 		foreach ( void delegate(GdkEventSequence*, Gesture) dlg; _gesture.onEndListeners )
734 		{
735 			dlg(sequence, _gesture);
736 		}
737 	}
738 
739 	void delegate(Event, Gesture)[] onEndGenericListeners;
740 	/**
741 	 * This signal is emitted when @gesture either stopped recognizing the event
742 	 * sequences as something to be handled (the #GtkGesture::check handler returned
743 	 * %FALSE), or the number of touch sequences became higher or lower than
744 	 * #GtkGesture:n-points.
745 	 *
746 	 * Note: @sequence might not pertain to the group of sequences that were
747 	 * previously triggering recognition on @gesture (ie. a just pressed touch
748 	 * sequence that exceeds #GtkGesture:n-points). This situation may be detected
749 	 * by checking through gtk_gesture_handles_sequence().
750 	 *
751 	 * Params:
752 	 *     sequence = the #GdkEventSequence that made gesture recognition to finish
753 	 *
754 	 * Since: 3.14
755 	 */
756 	void addOnEnd(void delegate(Event, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
757 	{
758 		if ( "end-generic-event" !in connectedSignals )
759 		{
760 			Signals.connectData(
761 				this,
762 				"end",
763 				cast(GCallback)&callBackEndGeneric,
764 				cast(void*)this,
765 				null,
766 				connectFlags);
767 			connectedSignals["end-generic-event"] = 1;
768 		}
769 		onEndGenericListeners ~= dlg;
770 	}
771 	extern(C) static void callBackEndGeneric(GtkGesture* gestureStruct, GdkEvent* sequence, Gesture _gesture)
772 	{
773 		foreach ( void delegate(Event, Gesture) dlg; _gesture.onEndGenericListeners )
774 		{
775 			dlg(ObjectG.getDObject!(Event)(sequence), _gesture);
776 		}
777 	}
778 
779 	void delegate(GdkEventSequence*, GtkEventSequenceState, Gesture)[] onSequenceStateChangedListeners;
780 	/**
781 	 * This signal is emitted whenever a sequence state changes. See
782 	 * gtk_gesture_set_sequence_state() to know more about the expectable
783 	 * sequence lifetimes.
784 	 *
785 	 * Params:
786 	 *     sequence = the #GdkEventSequence that was cancelled
787 	 *     state = the new sequence state
788 	 *
789 	 * Since: 3.14
790 	 */
791 	void addOnSequenceStateChanged(void delegate(GdkEventSequence*, GtkEventSequenceState, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
792 	{
793 		if ( "sequence-state-changed" !in connectedSignals )
794 		{
795 			Signals.connectData(
796 				this,
797 				"sequence-state-changed",
798 				cast(GCallback)&callBackSequenceStateChanged,
799 				cast(void*)this,
800 				null,
801 				connectFlags);
802 			connectedSignals["sequence-state-changed"] = 1;
803 		}
804 		onSequenceStateChangedListeners ~= dlg;
805 	}
806 	extern(C) static void callBackSequenceStateChanged(GtkGesture* gestureStruct, GdkEventSequence* sequence, GtkEventSequenceState state, Gesture _gesture)
807 	{
808 		foreach ( void delegate(GdkEventSequence*, GtkEventSequenceState, Gesture) dlg; _gesture.onSequenceStateChangedListeners )
809 		{
810 			dlg(sequence, state, _gesture);
811 		}
812 	}
813 
814 	void delegate(Event, GtkEventSequenceState, Gesture)[] onSequenceStateChangedGenericListeners;
815 	/**
816 	 * This signal is emitted whenever a sequence state changes. See
817 	 * gtk_gesture_set_sequence_state() to know more about the expectable
818 	 * sequence lifetimes.
819 	 *
820 	 * Params:
821 	 *     sequence = the #GdkEventSequence that was cancelled
822 	 *     state = the new sequence state
823 	 *
824 	 * Since: 3.14
825 	 */
826 	void addOnSequenceStateChanged(void delegate(Event, GtkEventSequenceState, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
827 	{
828 		if ( "sequence-state-changed-generic-event" !in connectedSignals )
829 		{
830 			Signals.connectData(
831 				this,
832 				"sequence-state-changed",
833 				cast(GCallback)&callBackSequenceStateChangedGeneric,
834 				cast(void*)this,
835 				null,
836 				connectFlags);
837 			connectedSignals["sequence-state-changed-generic-event"] = 1;
838 		}
839 		onSequenceStateChangedGenericListeners ~= dlg;
840 	}
841 	extern(C) static void callBackSequenceStateChangedGeneric(GtkGesture* gestureStruct, GdkEvent* sequence, GtkEventSequenceState state, Gesture _gesture)
842 	{
843 		foreach ( void delegate(Event, GtkEventSequenceState, Gesture) dlg; _gesture.onSequenceStateChangedGenericListeners )
844 		{
845 			dlg(ObjectG.getDObject!(Event)(sequence), state, _gesture);
846 		}
847 	}
848 
849 	void delegate(GdkEventSequence*, Gesture)[] onUpdateListeners;
850 	/**
851 	 * This signal is emitted whenever an event is handled while the gesture is
852 	 * recognized. @sequence is guaranteed to pertain to the set of active touches.
853 	 *
854 	 * Params:
855 	 *     sequence = the #GdkEventSequence that was updated
856 	 *
857 	 * Since: 3.14
858 	 */
859 	void addOnUpdate(void delegate(GdkEventSequence*, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
860 	{
861 		if ( "update" !in connectedSignals )
862 		{
863 			Signals.connectData(
864 				this,
865 				"update",
866 				cast(GCallback)&callBackUpdate,
867 				cast(void*)this,
868 				null,
869 				connectFlags);
870 			connectedSignals["update"] = 1;
871 		}
872 		onUpdateListeners ~= dlg;
873 	}
874 	extern(C) static void callBackUpdate(GtkGesture* gestureStruct, GdkEventSequence* sequence, Gesture _gesture)
875 	{
876 		foreach ( void delegate(GdkEventSequence*, Gesture) dlg; _gesture.onUpdateListeners )
877 		{
878 			dlg(sequence, _gesture);
879 		}
880 	}
881 
882 	void delegate(Event, Gesture)[] onUpdateGenericListeners;
883 	/**
884 	 * This signal is emitted whenever an event is handled while the gesture is
885 	 * recognized. @sequence is guaranteed to pertain to the set of active touches.
886 	 *
887 	 * Params:
888 	 *     sequence = the #GdkEventSequence that was updated
889 	 *
890 	 * Since: 3.14
891 	 */
892 	void addOnUpdate(void delegate(Event, Gesture) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
893 	{
894 		if ( "update-generic-event" !in connectedSignals )
895 		{
896 			Signals.connectData(
897 				this,
898 				"update",
899 				cast(GCallback)&callBackUpdateGeneric,
900 				cast(void*)this,
901 				null,
902 				connectFlags);
903 			connectedSignals["update-generic-event"] = 1;
904 		}
905 		onUpdateGenericListeners ~= dlg;
906 	}
907 	extern(C) static void callBackUpdateGeneric(GtkGesture* gestureStruct, GdkEvent* sequence, Gesture _gesture)
908 	{
909 		foreach ( void delegate(Event, Gesture) dlg; _gesture.onUpdateGenericListeners )
910 		{
911 			dlg(ObjectG.getDObject!(Event)(sequence), _gesture);
912 		}
913 	}
914 }