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 protected override void setStruct(GObject* obj) 67 { 68 gtkGestureSingle = cast(GtkGestureSingle*)obj; 69 super.setStruct(obj); 70 } 71 72 /** 73 * Sets our main struct and passes it to the parent class. 74 */ 75 public this (GtkGestureSingle* gtkGestureSingle, bool ownedRef = false) 76 { 77 this.gtkGestureSingle = gtkGestureSingle; 78 super(cast(GtkGesture*)gtkGestureSingle, ownedRef); 79 } 80 81 82 /** */ 83 public static GType getType() 84 { 85 return gtk_gesture_single_get_type(); 86 } 87 88 /** 89 * Returns the button number @gesture listens for, or 0 if @gesture 90 * reacts to any button press. 91 * 92 * Returns: The button number, or 0 for any button 93 * 94 * Since: 3.14 95 */ 96 public uint getButton() 97 { 98 return gtk_gesture_single_get_button(gtkGestureSingle); 99 } 100 101 /** 102 * Returns the button number currently interacting with @gesture, or 0 if there 103 * is none. 104 * 105 * Returns: The current button number 106 * 107 * Since: 3.14 108 */ 109 public uint getCurrentButton() 110 { 111 return gtk_gesture_single_get_current_button(gtkGestureSingle); 112 } 113 114 /** 115 * Returns the event sequence currently interacting with @gesture. 116 * This is only meaningful if gtk_gesture_is_active() returns %TRUE. 117 * 118 * Returns: the current sequence 119 * 120 * Since: 3.14 121 */ 122 public GdkEventSequence* getCurrentSequence() 123 { 124 return gtk_gesture_single_get_current_sequence(gtkGestureSingle); 125 } 126 127 /** 128 * Gets whether a gesture is exclusive. For more information, see 129 * gtk_gesture_single_set_exclusive(). 130 * 131 * Returns: Whether the gesture is exclusive 132 * 133 * Since: 3.14 134 */ 135 public bool getExclusive() 136 { 137 return gtk_gesture_single_get_exclusive(gtkGestureSingle) != 0; 138 } 139 140 /** 141 * Returns %TRUE if the gesture is only triggered by touch events. 142 * 143 * Returns: %TRUE if the gesture only handles touch events 144 * 145 * Since: 3.14 146 */ 147 public bool getTouchOnly() 148 { 149 return gtk_gesture_single_get_touch_only(gtkGestureSingle) != 0; 150 } 151 152 /** 153 * Sets the button number @gesture listens to. If non-0, every 154 * button press from a different button number will be ignored. 155 * Touch events implicitly match with button 1. 156 * 157 * Params: 158 * button = button number to listen to, or 0 for any button 159 * 160 * Since: 3.14 161 */ 162 public void setButton(uint button) 163 { 164 gtk_gesture_single_set_button(gtkGestureSingle, button); 165 } 166 167 /** 168 * Sets whether @gesture is exclusive. An exclusive gesture will 169 * only handle pointer and "pointer emulated" touch events, so at 170 * any given time, there is only one sequence able to interact with 171 * those. 172 * 173 * Params: 174 * exclusive = %TRUE to make @gesture exclusive 175 * 176 * Since: 3.14 177 */ 178 public void setExclusive(bool exclusive) 179 { 180 gtk_gesture_single_set_exclusive(gtkGestureSingle, exclusive); 181 } 182 183 /** 184 * If @touch_only is %TRUE, @gesture will only handle events of type 185 * #GDK_TOUCH_BEGIN, #GDK_TOUCH_UPDATE or #GDK_TOUCH_END. If %FALSE, 186 * mouse events will be handled too. 187 * 188 * Params: 189 * touchOnly = whether @gesture handles only touch events 190 * 191 * Since: 3.14 192 */ 193 public void setTouchOnly(bool touchOnly) 194 { 195 gtk_gesture_single_set_touch_only(gtkGestureSingle, touchOnly); 196 } 197 }