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