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