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 /// <since_tizen> 3 </since_tizen>
89 public Vector2 Velocity
98 /// This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
99 /// if the gesture has just started, then the amount panned since the user touched the screen.<br>
100 /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.<br>
101 /// A positive y value shows that the user is panning downwards, a negative y value means upwards.<br>
103 /// <since_tizen> 3 </since_tizen>
104 public Vector2 Displacement
113 /// The current touch position of the primary touch point in local actor coordinates.
115 /// <since_tizen> 3 </since_tizen>
116 public Vector2 Position
125 /// The velocity at which the user is moving their fingers.<br>
126 /// This is represented as a Vector2 and is the pixel movement per millisecond.<br>
127 /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.<br>
128 /// A positive y value shows that the user is panning downwards, a negative y values means upwards.<br>
129 /// This value represents the screen coordinates.<br>
131 /// <since_tizen> 3 </since_tizen>
132 public Vector2 ScreenVelocity
136 return screenVelocity;
141 /// This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
142 /// if the gesture has just started, then the amount panned since the user touched the screen.<br>
143 /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.<br>
144 /// A positive y value shows that the user is panning downwards, a negative y value means upwards.<br>
145 /// This value is in screen coordinates.<br>
147 /// <since_tizen> 3 </since_tizen>
148 public Vector2 ScreenDisplacement
152 return screenDisplacement;
157 /// The current touch position of the primary touch point in screen coordinates.
159 /// <since_tizen> 3 </since_tizen>
160 public Vector2 ScreenPosition
164 return screenPosition;
169 /// The total number of fingers touching the screen in a pan gesture.
171 /// <since_tizen> 3 </since_tizen>
172 public uint NumberOfTouches
176 return numberOfTouches;
181 /// The default constructor.
183 /// <since_tizen> 3 </since_tizen>
184 public PanGesture() : this(NDalicPINVOKE.new_PanGesture__SWIG_0(), true)
186 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192 /// <param name="state">The state of the gesture</param>
193 internal PanGesture(Gesture.StateType state) : this(NDalicPINVOKE.new_PanGesture__SWIG_1((int)state), true)
195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
199 private Vector2 velocity
203 NDalicPINVOKE.PanGesture_velocity_set(swigCPtr, Vector2.getCPtr(value));
204 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208 global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_velocity_get(swigCPtr);
209 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
210 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215 private Vector2 displacement
219 NDalicPINVOKE.PanGesture_displacement_set(swigCPtr, Vector2.getCPtr(value));
220 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
224 global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_displacement_get(swigCPtr);
225 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
226 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
231 private Vector2 position
235 NDalicPINVOKE.PanGesture_position_set(swigCPtr, Vector2.getCPtr(value));
236 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
240 global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_position_get(swigCPtr);
241 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
242 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247 private Vector2 screenVelocity
251 NDalicPINVOKE.PanGesture_screenVelocity_set(swigCPtr, Vector2.getCPtr(value));
252 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
256 global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_screenVelocity_get(swigCPtr);
257 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
258 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
263 private Vector2 screenDisplacement
267 NDalicPINVOKE.PanGesture_screenDisplacement_set(swigCPtr, Vector2.getCPtr(value));
268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
272 global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_screenDisplacement_get(swigCPtr);
273 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
274 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
279 private Vector2 screenPosition
283 NDalicPINVOKE.PanGesture_screenPosition_set(swigCPtr, Vector2.getCPtr(value));
284 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288 global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_screenPosition_get(swigCPtr);
289 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
290 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
295 private uint numberOfTouches
299 NDalicPINVOKE.PanGesture_numberOfTouches_set(swigCPtr, value);
300 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
304 uint ret = NDalicPINVOKE.PanGesture_numberOfTouches_get(swigCPtr);
305 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
311 /// Returns the speed at which the user is moving their fingers.<br>
312 /// This is the pixel movement per millisecond.<br>
314 /// <returns>The speed of the pan (in pixels per millisecond).</returns>
315 /// <since_tizen> 3 </since_tizen>
316 public float GetSpeed()
318 float ret = NDalicPINVOKE.PanGesture_GetSpeed(swigCPtr);
319 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
324 /// Returns the distance the user has panned (dragged) since the last pan gesture or,
325 /// if the gesture has just started, then the distance moved since the user touched the screen.<br>
326 /// This is always a positive value.<br>
328 /// <returns>The distance, as a float, a user's finger has panned.</returns>
329 /// <since_tizen> 3 </since_tizen>
330 public float GetDistance()
332 float ret = NDalicPINVOKE.PanGesture_GetDistance(swigCPtr);
333 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
338 /// Returns the speed at which the user is moving their fingers relative to screen coordinates.<br>
339 /// This is the pixel movement per millisecond.<br>
341 /// <returns>The speed of the pan (in pixels per millisecond).</returns>
342 /// <since_tizen> 3 </since_tizen>
343 public float GetScreenSpeed()
345 float ret = NDalicPINVOKE.PanGesture_GetScreenSpeed(swigCPtr);
346 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
351 /// Returns the distance the user has panned (dragged) since the last pan gesture in screen
352 /// coordinates or, if the gesture has just started, then the distance in screen coordinates moved
353 /// since the user touched the screen.<br>
354 /// This is always a positive value.<br>
356 /// <returns>The distance, as a float, a user's finger has panned.</returns>
357 /// <since_tizen> 3 </since_tizen>
358 public float GetScreenDistance()
360 float ret = NDalicPINVOKE.PanGesture_GetScreenDistance(swigCPtr);
361 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();