2 * Copyright(c) 2020 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 using System.ComponentModel;
22 /// A PanGesture is emitted when the user moves one or more fingers in a particular direction.<br />
23 /// A pan gesture will end in the following ways:<br />
24 /// - User releases the primary finger (the first touch).<br />
25 /// - User has more fingers on the screen than the maximum specified.<br />
26 /// - User has less fingers on the screen than the minimum specified.<br />
27 /// - Cancelled by the system.<br />
28 /// A pan gesture will continue to be sent to the actor under than initial pan until it ends.<br />
30 /// <since_tizen> 3 </since_tizen>
31 public class PanGesture : Gesture
35 /// The default constructor.
37 /// <since_tizen> 3 </since_tizen>
38 public PanGesture() : this(Interop.PanGestureDetector.PanGestureNew(0), true)
40 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
46 /// <param name="state">The state of the gesture</param>
47 internal PanGesture(Gesture.StateType state) : this(Interop.PanGestureDetector.PanGestureNew((int)state), true)
49 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
52 internal PanGesture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.PanGestureDetector.PanGestureUpcast(cPtr), cMemoryOwn)
57 /// The velocity at which the user is moving their fingers.<br />
58 /// This is represented as a Vector2 and is the pixel movement per millisecond.<br />
59 /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.<br />
60 /// A positive y value shows that the user is panning downwards, a negative y values means upwards.<br />
62 /// <since_tizen> 3 </since_tizen>
63 public Vector2 Velocity
72 /// This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
73 /// if the gesture has just started, then the amount panned since the user touched the screen.<br />
74 /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.<br />
75 /// A positive y value shows that the user is panning downwards, a negative y value means upwards.<br />
77 /// <since_tizen> 3 </since_tizen>
78 public Vector2 Displacement
87 /// The current touch position of the primary touch point in local actor coordinates.
89 /// <since_tizen> 3 </since_tizen>
90 public Vector2 Position
99 /// The velocity at which the user is moving their fingers.<br />
100 /// This is represented as a Vector2 and is the pixel movement per millisecond.<br />
101 /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.<br />
102 /// A positive y value shows that the user is panning downwards, a negative y values means upwards.<br />
103 /// This value represents the screen coordinates.<br />
105 /// <since_tizen> 3 </since_tizen>
106 public Vector2 ScreenVelocity
110 return screenVelocity;
115 /// This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
116 /// if the gesture has just started, then the amount panned since the user touched the screen.<br />
117 /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.<br />
118 /// A positive y value shows that the user is panning downwards, a negative y value means upwards.<br />
119 /// This value is in screen coordinates.<br />
121 /// <since_tizen> 3 </since_tizen>
122 public Vector2 ScreenDisplacement
126 return screenDisplacement;
131 /// The current touch position of the primary touch point in screen coordinates.
133 /// <since_tizen> 3 </since_tizen>
134 public Vector2 ScreenPosition
138 return screenPosition;
143 /// The total number of fingers touching the screen in a pan gesture.
145 /// <since_tizen> 3 </since_tizen>
146 public uint NumberOfTouches
150 return numberOfTouches;
155 private Vector2 velocity
159 Interop.PanGestureDetector.PanGestureVelocitySet(SwigCPtr, Vector2.getCPtr(value));
160 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164 global::System.IntPtr cPtr = Interop.PanGestureDetector.PanGestureVelocityGet(SwigCPtr);
165 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
166 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171 private Vector2 displacement
175 Interop.PanGestureDetector.PanGestureDisplacementSet(SwigCPtr, Vector2.getCPtr(value));
176 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180 global::System.IntPtr cPtr = Interop.PanGestureDetector.PanGestureDisplacementGet(SwigCPtr);
181 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
182 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
187 private Vector2 position
191 Interop.PanGestureDetector.PanGesturePositionSet(SwigCPtr, Vector2.getCPtr(value));
192 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196 global::System.IntPtr cPtr = Interop.PanGestureDetector.PanGesturePositionGet(SwigCPtr);
197 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
198 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203 private Vector2 screenVelocity
207 Interop.PanGestureDetector.PanGestureScreenVelocitySet(SwigCPtr, Vector2.getCPtr(value));
208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
212 global::System.IntPtr cPtr = Interop.PanGestureDetector.PanGestureScreenVelocityGet(SwigCPtr);
213 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219 private Vector2 screenDisplacement
223 Interop.PanGestureDetector.PanGestureScreenDisplacementSet(SwigCPtr, Vector2.getCPtr(value));
224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228 global::System.IntPtr cPtr = Interop.PanGestureDetector.PanGestureScreenDisplacementGet(SwigCPtr);
229 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
230 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
235 private Vector2 screenPosition
239 Interop.PanGestureDetector.PanGestureScreenPositionSet(SwigCPtr, Vector2.getCPtr(value));
240 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
244 global::System.IntPtr cPtr = Interop.PanGestureDetector.PanGestureScreenPositionGet(SwigCPtr);
245 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
246 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
251 private uint numberOfTouches
255 Interop.PanGestureDetector.PanGestureNumberOfTouchesSet(SwigCPtr, value);
256 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
260 uint ret = Interop.PanGestureDetector.PanGestureNumberOfTouchesGet(SwigCPtr);
261 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
268 /// Returns the speed at which the user is moving their fingers.<br />
269 /// This is the pixel movement per millisecond.<br />
271 /// <returns>The speed of the pan (in pixels per millisecond).</returns>
272 /// <since_tizen> 3 </since_tizen>
273 public float GetSpeed()
275 float ret = Interop.PanGestureDetector.PanGestureGetSpeed(SwigCPtr);
276 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
281 /// Returns the distance the user has panned (dragged) since the last pan gesture or,
282 /// if the gesture has just started, then the distance moved since the user touched the screen.<br />
283 /// This is always a positive value.<br />
285 /// <returns>The distance, as a float, a user's finger has panned.</returns>
286 /// <since_tizen> 3 </since_tizen>
287 public float GetDistance()
289 float ret = Interop.PanGestureDetector.PanGestureGetDistance(SwigCPtr);
290 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
295 /// Returns the speed at which the user is moving their fingers relative to screen coordinates.<br />
296 /// This is the pixel movement per millisecond.<br />
298 /// <returns>The speed of the pan (in pixels per millisecond).</returns>
299 /// <since_tizen> 3 </since_tizen>
300 public float GetScreenSpeed()
302 float ret = Interop.PanGestureDetector.PanGestureGetScreenSpeed(SwigCPtr);
303 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
308 /// Returns the distance the user has panned (dragged) since the last pan gesture in screen
309 /// coordinates or, if the gesture has just started, then the distance in screen coordinates moved
310 /// since the user touched the screen.<br />
311 /// This is always a positive value.<br />
313 /// <returns>The distance, as a float, a user's finger has panned.</returns>
314 /// <since_tizen> 3 </since_tizen>
315 public float GetScreenDistance()
317 float ret = Interop.PanGestureDetector.PanGestureGetScreenDistance(SwigCPtr);
318 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
322 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PanGesture obj)
324 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
327 internal static PanGesture GetPanGestureFromPtr(global::System.IntPtr cPtr)
329 PanGesture ret = new PanGesture(cPtr, false);
330 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
334 /// This will not be public opened.
335 [EditorBrowsable(EditorBrowsableState.Never)]
336 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
338 Interop.PanGestureDetector.DeletePanGesture(swigCPtr);