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.GestureLongPress; 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.GestureSingle; 32 private import gtk.Widget; 33 private import gtk.c.functions; 34 public import gtk.c.types; 35 public import gtkc.gtktypes; 36 private import std.algorithm; 37 38 39 /** 40 * #GtkGestureLongPress is a #GtkGesture implementation able to recognize 41 * long presses, triggering the #GtkGestureLongPress::pressed after the 42 * timeout is exceeded. 43 * 44 * If the touchpoint is lifted before the timeout passes, or if it drifts 45 * too far of the initial press point, the #GtkGestureLongPress::cancelled 46 * signal will be emitted. 47 */ 48 public class GestureLongPress : GestureSingle 49 { 50 /** the main Gtk struct */ 51 protected GtkGestureLongPress* gtkGestureLongPress; 52 53 /** Get the main Gtk struct */ 54 public GtkGestureLongPress* getGestureLongPressStruct(bool transferOwnership = false) 55 { 56 if (transferOwnership) 57 ownedRef = false; 58 return gtkGestureLongPress; 59 } 60 61 /** the main Gtk struct as a void* */ 62 protected override void* getStruct() 63 { 64 return cast(void*)gtkGestureLongPress; 65 } 66 67 /** 68 * Sets our main struct and passes it to the parent class. 69 */ 70 public this (GtkGestureLongPress* gtkGestureLongPress, bool ownedRef = false) 71 { 72 this.gtkGestureLongPress = gtkGestureLongPress; 73 super(cast(GtkGestureSingle*)gtkGestureLongPress, ownedRef); 74 } 75 76 77 /** */ 78 public static GType getType() 79 { 80 return gtk_gesture_long_press_get_type(); 81 } 82 83 /** 84 * Returns a newly created #GtkGesture that recognizes long presses. 85 * 86 * Params: 87 * widget = a #GtkWidget 88 * 89 * Returns: a newly created #GtkGestureLongPress 90 * 91 * Since: 3.14 92 * 93 * Throws: ConstructionException GTK+ fails to create the object. 94 */ 95 public this(Widget widget) 96 { 97 auto p = gtk_gesture_long_press_new((widget is null) ? null : widget.getWidgetStruct()); 98 99 if(p is null) 100 { 101 throw new ConstructionException("null returned by new"); 102 } 103 104 this(cast(GtkGestureLongPress*) p, true); 105 } 106 107 /** 108 * This signal is emitted whenever a press moved too far, or was released 109 * before #GtkGestureLongPress::pressed happened. 110 * 111 * Since: 3.14 112 */ 113 gulong addOnCancelled(void delegate(GestureLongPress) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 114 { 115 return Signals.connect(this, "cancelled", dlg, connectFlags ^ ConnectFlags.SWAPPED); 116 } 117 118 /** 119 * This signal is emitted whenever a press goes unmoved/unreleased longer than 120 * what the GTK+ defaults tell. 121 * 122 * Params: 123 * x = the X coordinate where the press happened, relative to the widget allocation 124 * y = the Y coordinate where the press happened, relative to the widget allocation 125 * 126 * Since: 3.14 127 */ 128 gulong addOnPressed(void delegate(double, double, GestureLongPress) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 129 { 130 return Signals.connect(this, "pressed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 131 } 132 }