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