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.GestureRotate;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gobject.Signals;
30 private import gtk.Gesture;
31 private import gtk.Widget;
32 private import gtk.c.functions;
33 public  import gtk.c.types;
34 public  import gtkc.gtktypes;
35 private import std.algorithm;
36 
37 
38 /**
39  * #GtkGestureRotate is a #GtkGesture implementation able to recognize
40  * 2-finger rotations, whenever the angle between both handled sequences
41  * changes, the #GtkGestureRotate::angle-changed signal is emitted.
42  */
43 public class GestureRotate : Gesture
44 {
45 	/** the main Gtk struct */
46 	protected GtkGestureRotate* gtkGestureRotate;
47 
48 	/** Get the main Gtk struct */
49 	public GtkGestureRotate* getGestureRotateStruct(bool transferOwnership = false)
50 	{
51 		if (transferOwnership)
52 			ownedRef = false;
53 		return gtkGestureRotate;
54 	}
55 
56 	/** the main Gtk struct as a void* */
57 	protected override void* getStruct()
58 	{
59 		return cast(void*)gtkGestureRotate;
60 	}
61 
62 	/**
63 	 * Sets our main struct and passes it to the parent class.
64 	 */
65 	public this (GtkGestureRotate* gtkGestureRotate, bool ownedRef = false)
66 	{
67 		this.gtkGestureRotate = gtkGestureRotate;
68 		super(cast(GtkGesture*)gtkGestureRotate, ownedRef);
69 	}
70 
71 
72 	/** */
73 	public static GType getType()
74 	{
75 		return gtk_gesture_rotate_get_type();
76 	}
77 
78 	/**
79 	 * Returns a newly created #GtkGesture that recognizes 2-touch
80 	 * rotation gestures.
81 	 *
82 	 * Params:
83 	 *     widget = a #GtkWidget
84 	 *
85 	 * Returns: a newly created #GtkGestureRotate
86 	 *
87 	 * Since: 3.14
88 	 *
89 	 * Throws: ConstructionException GTK+ fails to create the object.
90 	 */
91 	public this(Widget widget)
92 	{
93 		auto p = gtk_gesture_rotate_new((widget is null) ? null : widget.getWidgetStruct());
94 
95 		if(p is null)
96 		{
97 			throw new ConstructionException("null returned by new");
98 		}
99 
100 		this(cast(GtkGestureRotate*) p, true);
101 	}
102 
103 	/**
104 	 * If @gesture is active, this function returns the angle difference
105 	 * in radians since the gesture was first recognized. If @gesture is
106 	 * not active, 0 is returned.
107 	 *
108 	 * Returns: the angle delta in radians
109 	 *
110 	 * Since: 3.14
111 	 */
112 	public double getAngleDelta()
113 	{
114 		return gtk_gesture_rotate_get_angle_delta(gtkGestureRotate);
115 	}
116 
117 	/**
118 	 * This signal is emitted when the angle between both tracked points
119 	 * changes.
120 	 *
121 	 * Params:
122 	 *     angle = Current angle in radians
123 	 *     angleDelta = Difference with the starting angle, in radians
124 	 *
125 	 * Since: 3.14
126 	 */
127 	gulong addOnAngleChanged(void delegate(double, double, GestureRotate) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
128 	{
129 		return Signals.connect(this, "angle-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
130 	}
131 }