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