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