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