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.GestureSingle; 26 27 private import gtk.Gesture; 28 private import gtk.c.functions; 29 public import gtk.c.types; 30 public import gtkc.gtktypes; 31 32 33 /** 34 * #GtkGestureSingle is a subclass of #GtkGesture, optimized (although 35 * not restricted) for dealing with mouse and single-touch gestures. Under 36 * interaction, these gestures stick to the first interacting sequence, which 37 * is accessible through gtk_gesture_single_get_current_sequence() while the 38 * gesture is being interacted with. 39 * 40 * By default gestures react to both %GDK_BUTTON_PRIMARY and touch 41 * events, gtk_gesture_single_set_touch_only() can be used to change the 42 * touch behavior. Callers may also specify a different mouse button number 43 * to interact with through gtk_gesture_single_set_button(), or react to any 44 * mouse button by setting 0. While the gesture is active, the button being 45 * currently pressed can be known through gtk_gesture_single_get_current_button(). 46 */ 47 public class GestureSingle : Gesture 48 { 49 /** the main Gtk struct */ 50 protected GtkGestureSingle* gtkGestureSingle; 51 52 /** Get the main Gtk struct */ 53 public GtkGestureSingle* getGestureSingleStruct(bool transferOwnership = false) 54 { 55 if (transferOwnership) 56 ownedRef = false; 57 return gtkGestureSingle; 58 } 59 60 /** the main Gtk struct as a void* */ 61 protected override void* getStruct() 62 { 63 return cast(void*)gtkGestureSingle; 64 } 65 66 /** 67 * Sets our main struct and passes it to the parent class. 68 */ 69 public this (GtkGestureSingle* gtkGestureSingle, bool ownedRef = false) 70 { 71 this.gtkGestureSingle = gtkGestureSingle; 72 super(cast(GtkGesture*)gtkGestureSingle, ownedRef); 73 } 74 75 76 /** */ 77 public static GType getType() 78 { 79 return gtk_gesture_single_get_type(); 80 } 81 82 /** 83 * Returns the button number @gesture listens for, or 0 if @gesture 84 * reacts to any button press. 85 * 86 * Returns: The button number, or 0 for any button 87 * 88 * Since: 3.14 89 */ 90 public uint getButton() 91 { 92 return gtk_gesture_single_get_button(gtkGestureSingle); 93 } 94 95 /** 96 * Returns the button number currently interacting with @gesture, or 0 if there 97 * is none. 98 * 99 * Returns: The current button number 100 * 101 * Since: 3.14 102 */ 103 public uint getCurrentButton() 104 { 105 return gtk_gesture_single_get_current_button(gtkGestureSingle); 106 } 107 108 /** 109 * Returns the event sequence currently interacting with @gesture. 110 * This is only meaningful if gtk_gesture_is_active() returns %TRUE. 111 * 112 * Returns: the current sequence 113 * 114 * Since: 3.14 115 */ 116 public GdkEventSequence* getCurrentSequence() 117 { 118 return gtk_gesture_single_get_current_sequence(gtkGestureSingle); 119 } 120 121 /** 122 * Gets whether a gesture is exclusive. For more information, see 123 * gtk_gesture_single_set_exclusive(). 124 * 125 * Returns: Whether the gesture is exclusive 126 * 127 * Since: 3.14 128 */ 129 public bool getExclusive() 130 { 131 return gtk_gesture_single_get_exclusive(gtkGestureSingle) != 0; 132 } 133 134 /** 135 * Returns %TRUE if the gesture is only triggered by touch events. 136 * 137 * Returns: %TRUE if the gesture only handles touch events 138 * 139 * Since: 3.14 140 */ 141 public bool getTouchOnly() 142 { 143 return gtk_gesture_single_get_touch_only(gtkGestureSingle) != 0; 144 } 145 146 /** 147 * Sets the button number @gesture listens to. If non-0, every 148 * button press from a different button number will be ignored. 149 * Touch events implicitly match with button 1. 150 * 151 * Params: 152 * button = button number to listen to, or 0 for any button 153 * 154 * Since: 3.14 155 */ 156 public void setButton(uint button) 157 { 158 gtk_gesture_single_set_button(gtkGestureSingle, button); 159 } 160 161 /** 162 * Sets whether @gesture is exclusive. An exclusive gesture will 163 * only handle pointer and "pointer emulated" touch events, so at 164 * any given time, there is only one sequence able to interact with 165 * those. 166 * 167 * Params: 168 * exclusive = %TRUE to make @gesture exclusive 169 * 170 * Since: 3.14 171 */ 172 public void setExclusive(bool exclusive) 173 { 174 gtk_gesture_single_set_exclusive(gtkGestureSingle, exclusive); 175 } 176 177 /** 178 * If @touch_only is %TRUE, @gesture will only handle events of type 179 * #GDK_TOUCH_BEGIN, #GDK_TOUCH_UPDATE or #GDK_TOUCH_END. If %FALSE, 180 * mouse events will be handled too. 181 * 182 * Params: 183 * touchOnly = whether @gesture handles only touch events 184 * 185 * Since: 3.14 186 */ 187 public void setTouchOnly(bool touchOnly) 188 { 189 gtk_gesture_single_set_touch_only(gtkGestureSingle, touchOnly); 190 } 191 }