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.GestureClick;
26 
27 private import gdk.Event;
28 private import glib.ConstructionException;
29 private import gobject.ObjectG;
30 private import gobject.Signals;
31 private import gtk.Gesture;
32 private import gtk.GestureSingle;
33 private import gtk.c.functions;
34 public  import gtk.c.types;
35 private import std.algorithm;
36 
37 
38 /**
39  * `GtkGestureClick` is a `GtkGesture` implementation for clicks.
40  * 
41  * It is able to recognize multiple clicks on a nearby zone, which
42  * can be listened for through the [signal@Gtk.GestureClick::pressed]
43  * signal. Whenever time or distance between clicks exceed the GTK
44  * defaults, [signal@Gtk.GestureClick::stopped] is emitted, and the
45  * click counter is reset.
46  */
47 public class GestureClick : GestureSingle
48 {
49 	/** the main Gtk struct */
50 	protected GtkGestureClick* gtkGestureClick;
51 
52 	/** Get the main Gtk struct */
53 	public GtkGestureClick* getGestureClickStruct(bool transferOwnership = false)
54 	{
55 		if (transferOwnership)
56 			ownedRef = false;
57 		return gtkGestureClick;
58 	}
59 
60 	/** the main Gtk struct as a void* */
61 	protected override void* getStruct()
62 	{
63 		return cast(void*)gtkGestureClick;
64 	}
65 
66 	/**
67 	 * Sets our main struct and passes it to the parent class.
68 	 */
69 	public this (GtkGestureClick* gtkGestureClick, bool ownedRef = false)
70 	{
71 		this.gtkGestureClick = gtkGestureClick;
72 		super(cast(GtkGestureSingle*)gtkGestureClick, ownedRef);
73 	}
74 
75 
76 	/** */
77 	public static GType getType()
78 	{
79 		return gtk_gesture_click_get_type();
80 	}
81 
82 	/**
83 	 * Returns a newly created `GtkGesture` that recognizes
84 	 * single and multiple presses.
85 	 *
86 	 * Returns: a newly created `GtkGestureClick`
87 	 *
88 	 * Throws: ConstructionException GTK+ fails to create the object.
89 	 */
90 	public this()
91 	{
92 		auto __p = gtk_gesture_click_new();
93 
94 		if(__p is null)
95 		{
96 			throw new ConstructionException("null returned by new");
97 		}
98 
99 		this(cast(GtkGestureClick*) __p, true);
100 	}
101 
102 	/**
103 	 * Emitted whenever a button or touch press happens.
104 	 *
105 	 * Params:
106 	 *     nPress = how many touch/button presses happened with this one
107 	 *     x = The X coordinate, in widget allocation coordinates
108 	 *     y = The Y coordinate, in widget allocation coordinates
109 	 */
110 	gulong addOnPressed(void delegate(int, double, double, GestureClick) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
111 	{
112 		return Signals.connect(this, "pressed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
113 	}
114 
115 	/**
116 	 * Emitted when a button or touch is released.
117 	 *
118 	 * @n_press will report the number of press that is paired to
119 	 * this event, note that [signal@Gtk.GestureClick::stopped] may
120 	 * have been emitted between the press and its release, @n_press
121 	 * will only start over at the next press.
122 	 *
123 	 * Params:
124 	 *     nPress = number of press that is paired with this release
125 	 *     x = The X coordinate, in widget allocation coordinates
126 	 *     y = The Y coordinate, in widget allocation coordinates
127 	 */
128 	gulong addOnReleased(void delegate(int, double, double, GestureClick) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
129 	{
130 		return Signals.connect(this, "released", dlg, connectFlags ^ ConnectFlags.SWAPPED);
131 	}
132 
133 	/**
134 	 * Emitted whenever any time/distance threshold has been exceeded.
135 	 */
136 	gulong addOnStopped(void delegate(GestureClick) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
137 	{
138 		return Signals.connect(this, "stopped", dlg, connectFlags ^ ConnectFlags.SWAPPED);
139 	}
140 
141 	/**
142 	 * Emitted whenever the gesture receives a release
143 	 * event that had no previous corresponding press.
144 	 *
145 	 * Due to implicit grabs, this can only happen on situations
146 	 * where input is grabbed elsewhere mid-press or the pressed
147 	 * widget voluntarily relinquishes its implicit grab.
148 	 *
149 	 * Params:
150 	 *     x = X coordinate of the event
151 	 *     y = Y coordinate of the event
152 	 *     button = Button being released
153 	 *     sequence = Sequence being released
154 	 */
155 	gulong addOnUnpairedRelease(void delegate(double, double, uint, GdkEventSequence*, GestureClick) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
156 	{
157 		return Signals.connect(this, "unpaired-release", dlg, connectFlags ^ ConnectFlags.SWAPPED);
158 	}
159 
160 	/**
161 	 * Emitted whenever the gesture receives a release
162 	 * event that had no previous corresponding press.
163 	 *
164 	 * Due to implicit grabs, this can only happen on situations
165 	 * where input is grabbed elsewhere mid-press or the pressed
166 	 * widget voluntarily relinquishes its implicit grab.
167 	 *
168 	 * Params:
169 	 *     x = X coordinate of the event
170 	 *     y = Y coordinate of the event
171 	 *     button = Button being released
172 	 *     sequence = Sequence being released
173 	 */
174 	gulong addOnUnpairedRelease(void delegate(double, double, uint, Event, GestureClick) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
175 	{
176 		return Signals.connect(this, "unpaired-release", dlg, connectFlags ^ ConnectFlags.SWAPPED);
177 	}
178 }