1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
21 /// A PanGesture is emitted when the user moves one or more fingers in a particular direction.<br>
22 /// A pan gesture will end in the following ways:<br>
23 /// - User releases the primary finger (the first touch).<br>
24 /// - User has more fingers on the screen than the maximum specified.<br>
25 /// - User has less fingers on the screen than the minimum specified.<br>
26 /// - Cancelled by the system.<br>
27 /// A pan gesture will continue to be sent to the actor under than initial pan until it ends.<br>
29 public class PanGesture : Gesture
31 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
33 internal PanGesture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PanGesture_SWIGUpcast(cPtr), cMemoryOwn)
35 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
38 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PanGesture obj)
40 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
43 protected override void Dispose(DisposeTypes type)
50 if(type == DisposeTypes.Explicit)
53 //Release your own managed resources here.
54 //You should release all of your own disposable objects here.
57 //Release your own unmanaged resources here.
58 //You should not access any managed member here except static instance.
59 //because the execution order of Finalizes is non-deterministic.
61 if (swigCPtr.Handle != global::System.IntPtr.Zero)
66 NDalicPINVOKE.delete_PanGesture(swigCPtr);
68 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
75 internal static PanGesture GetPanGestureFromPtr(global::System.IntPtr cPtr)
77 PanGesture ret = new PanGesture(cPtr, false);
78 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
83 /// The velocity at which the user is moving their fingers.<br>
84 /// This is represented as a Vector2 and is the pixel movement per millisecond.<br>
85 /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.<br>
86 /// A positive y value shows that the user is panning downwards, a negative y values means upwards.<br>
88 public Vector2 Velocity
97 /// This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
98 /// if the gesture has just started, then the amount panned since the user touched the screen.<br>
99 /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.<br>
100 /// A positive y value shows that the user is panning downwards, a negative y value means upwards.<br>
102 public Vector2 Displacement
111 /// This current touch position of the primary touch point in local actor coordinates.
113 public Vector2 Position
122 /// The velocity at which the user is moving their fingers.<br>
123 /// This is represented as a Vector2 and is the pixel movement per millisecond.<br>
124 /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.<br>
125 /// A positive y value shows that the user is panning downwards, a negative y values means upwards.<br>
126 /// This value represents the screen coordinates.<br>
128 public Vector2 ScreenVelocity
132 return screenVelocity;
137 /// This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
138 /// if the gesture has just started, then the amount panned since the user touched the screen.<br>
139 /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.<br>
140 /// A positive y value shows that the user is panning downwards, a negative y value means upwards.<br>
141 /// This value is in screen coordinates.<br>
143 public Vector2 ScreenDisplacement
147 return screenDisplacement;
152 /// This current touch position of the primary touch point in screen coordinates.
154 public Vector2 ScreenPosition
158 return screenPosition;
163 /// The total number of fingers touching the screen in a pan gesture.
165 public uint NumberOfTouches
169 return numberOfTouches;
174 /// Default Constructor.
176 public PanGesture() : this(NDalicPINVOKE.new_PanGesture__SWIG_0(), true)
178 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
184 /// <param name="state">The state of the gesture</param>
185 internal PanGesture(Gesture.StateType state) : this(NDalicPINVOKE.new_PanGesture__SWIG_1((int)state), true)
187 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
191 private Vector2 velocity
195 NDalicPINVOKE.PanGesture_velocity_set(swigCPtr, Vector2.getCPtr(value));
196 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200 global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_velocity_get(swigCPtr);
201 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
202 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
207 private Vector2 displacement
211 NDalicPINVOKE.PanGesture_displacement_set(swigCPtr, Vector2.getCPtr(value));
212 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
216 global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_displacement_get(swigCPtr);
217 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
218 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
223 private Vector2 position
227 NDalicPINVOKE.PanGesture_position_set(swigCPtr, Vector2.getCPtr(value));
228 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
232 global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_position_get(swigCPtr);
233 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
234 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
239 private Vector2 screenVelocity
243 NDalicPINVOKE.PanGesture_screenVelocity_set(swigCPtr, Vector2.getCPtr(value));
244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
248 global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_screenVelocity_get(swigCPtr);
249 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
250 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
255 private Vector2 screenDisplacement
259 NDalicPINVOKE.PanGesture_screenDisplacement_set(swigCPtr, Vector2.getCPtr(value));
260 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
264 global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_screenDisplacement_get(swigCPtr);
265 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
266 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
271 private Vector2 screenPosition
275 NDalicPINVOKE.PanGesture_screenPosition_set(swigCPtr, Vector2.getCPtr(value));
276 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
280 global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_screenPosition_get(swigCPtr);
281 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
282 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
287 private uint numberOfTouches
291 NDalicPINVOKE.PanGesture_numberOfTouches_set(swigCPtr, value);
292 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
296 uint ret = NDalicPINVOKE.PanGesture_numberOfTouches_get(swigCPtr);
297 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
303 /// Returns the speed at which the user is moving their fingers.<br>
304 /// This is the pixel movement per millisecond.<br>
306 /// <returns>The speed of the pan (in pixels per millisecond)</returns>
307 public float GetSpeed()
309 float ret = NDalicPINVOKE.PanGesture_GetSpeed(swigCPtr);
310 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
315 /// This returns the distance the user has panned (dragged) since the last pan gesture or,
316 /// if the gesture has just started, then the distance moved since the user touched the screen.<br>
317 /// This is always a positive value.<br>
319 /// <returns>The distance, as a float, a user's finger has panned</returns>
320 public float GetDistance()
322 float ret = NDalicPINVOKE.PanGesture_GetDistance(swigCPtr);
323 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
328 /// Returns the speed at which the user is moving their fingers relative to screen coordinates.<br>
329 /// This is the pixel movement per millisecond.<br>
331 /// <returns>The speed of the pan (in pixels per millisecond)</returns>
332 public float GetScreenSpeed()
334 float ret = NDalicPINVOKE.PanGesture_GetScreenSpeed(swigCPtr);
335 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
340 /// This returns the distance the user has panned (dragged) since the last pan gesture in screen
341 /// coordinates or, if the gesture has just started, then the distance in screen coordinates moved
342 /// since the user touched the screen.<br>
343 /// This is always a positive value.<br>
345 /// <returns>The distance, as a float, a user's finger has panned</returns>
346 public float GetScreenDistance()
348 float ret = NDalicPINVOKE.PanGesture_GetScreenDistance(swigCPtr);
349 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();