[NUI] Split NUI Interop class (#804)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / PanGesture.cs
1 /*
2  * Copyright(c) 2017 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 namespace Tizen.NUI
19 {
20
21     /// <summary>
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 />
29     /// </summary>
30     /// <since_tizen> 3 </since_tizen>
31     public class PanGesture : Gesture
32     {
33         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
34
35         /// <summary>
36         /// The default constructor.
37         /// </summary>
38         /// <since_tizen> 3 </since_tizen>
39         public PanGesture() : this(Interop.PanGestureDetector.new_PanGesture__SWIG_0(), true)
40         {
41             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
42         }
43
44         /// <summary>
45         /// The constructor.
46         /// </summary>
47         /// <param name="state">The state of the gesture</param>
48         internal PanGesture(Gesture.StateType state) : this(Interop.PanGestureDetector.new_PanGesture__SWIG_1((int)state), true)
49         {
50             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
51         }
52
53         internal PanGesture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.PanGestureDetector.PanGesture_SWIGUpcast(cPtr), cMemoryOwn)
54         {
55             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
56         }
57
58         /// <summary>
59         /// The velocity at which the user is moving their fingers.<br />
60         /// This is represented as a Vector2 and is the pixel movement per millisecond.<br />
61         /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.<br />
62         /// A positive y value shows that the user is panning downwards, a negative y values means upwards.<br />
63         /// </summary>
64         /// <since_tizen> 3 </since_tizen>
65         public Vector2 Velocity
66         {
67             get
68             {
69                 return velocity;
70             }
71         }
72
73         /// <summary>
74         /// This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
75         /// if the gesture has just started, then the amount panned since the user touched the screen.<br />
76         /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.<br />
77         /// A positive y value shows that the user is panning downwards, a negative y value means upwards.<br />
78         /// </summary>
79         /// <since_tizen> 3 </since_tizen>
80         public Vector2 Displacement
81         {
82             get
83             {
84                 return displacement;
85             }
86         }
87
88         /// <summary>
89         /// The current touch position of the primary touch point in local actor coordinates.
90         /// </summary>
91         /// <since_tizen> 3 </since_tizen>
92         public Vector2 Position
93         {
94             get
95             {
96                 return position;
97             }
98         }
99
100         /// <summary>
101         /// The velocity at which the user is moving their fingers.<br />
102         /// This is represented as a Vector2 and is the pixel movement per millisecond.<br />
103         /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.<br />
104         /// A positive y value shows that the user is panning downwards, a negative y values means upwards.<br />
105         /// This value represents the screen coordinates.<br />
106         /// </summary>
107         /// <since_tizen> 3 </since_tizen>
108         public Vector2 ScreenVelocity
109         {
110             get
111             {
112                 return screenVelocity;
113             }
114         }
115
116         /// <summary>
117         /// This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
118         /// if the gesture has just started, then the amount panned since the user touched the screen.<br />
119         /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.<br />
120         /// A positive y value shows that the user is panning downwards, a negative y value means upwards.<br />
121         /// This value is in screen coordinates.<br />
122         /// </summary>
123         /// <since_tizen> 3 </since_tizen>
124         public Vector2 ScreenDisplacement
125         {
126             get
127             {
128                 return screenDisplacement;
129             }
130         }
131
132         /// <summary>
133         /// The current touch position of the primary touch point in screen coordinates.
134         /// </summary>
135         /// <since_tizen> 3 </since_tizen>
136         public Vector2 ScreenPosition
137         {
138             get
139             {
140                 return screenPosition;
141             }
142         }
143
144         /// <summary>
145         /// The total number of fingers touching the screen in a pan gesture.
146         /// </summary>
147         /// <since_tizen> 3 </since_tizen>
148         public uint NumberOfTouches
149         {
150             get
151             {
152                 return numberOfTouches;
153             }
154         }
155
156
157         private Vector2 velocity
158         {
159             set
160             {
161                 Interop.PanGestureDetector.PanGesture_velocity_set(swigCPtr, Vector2.getCPtr(value));
162                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163             }
164             get
165             {
166                 global::System.IntPtr cPtr = Interop.PanGestureDetector.PanGesture_velocity_get(swigCPtr);
167                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
168                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169                 return ret;
170             }
171         }
172
173         private Vector2 displacement
174         {
175             set
176             {
177                 Interop.PanGestureDetector.PanGesture_displacement_set(swigCPtr, Vector2.getCPtr(value));
178                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179             }
180             get
181             {
182                 global::System.IntPtr cPtr = Interop.PanGestureDetector.PanGesture_displacement_get(swigCPtr);
183                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
184                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185                 return ret;
186             }
187         }
188
189         private Vector2 position
190         {
191             set
192             {
193                 Interop.PanGestureDetector.PanGesture_position_set(swigCPtr, Vector2.getCPtr(value));
194                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195             }
196             get
197             {
198                 global::System.IntPtr cPtr = Interop.PanGestureDetector.PanGesture_position_get(swigCPtr);
199                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
200                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
201                 return ret;
202             }
203         }
204
205         private Vector2 screenVelocity
206         {
207             set
208             {
209                 Interop.PanGestureDetector.PanGesture_screenVelocity_set(swigCPtr, Vector2.getCPtr(value));
210                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211             }
212             get
213             {
214                 global::System.IntPtr cPtr = Interop.PanGestureDetector.PanGesture_screenVelocity_get(swigCPtr);
215                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
216                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
217                 return ret;
218             }
219         }
220
221         private Vector2 screenDisplacement
222         {
223             set
224             {
225                 Interop.PanGestureDetector.PanGesture_screenDisplacement_set(swigCPtr, Vector2.getCPtr(value));
226                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
227             }
228             get
229             {
230                 global::System.IntPtr cPtr = Interop.PanGestureDetector.PanGesture_screenDisplacement_get(swigCPtr);
231                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
232                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
233                 return ret;
234             }
235         }
236
237         private Vector2 screenPosition
238         {
239             set
240             {
241                 Interop.PanGestureDetector.PanGesture_screenPosition_set(swigCPtr, Vector2.getCPtr(value));
242                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243             }
244             get
245             {
246                 global::System.IntPtr cPtr = Interop.PanGestureDetector.PanGesture_screenPosition_get(swigCPtr);
247                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
248                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249                 return ret;
250             }
251         }
252
253         private uint numberOfTouches
254         {
255             set
256             {
257                 Interop.PanGestureDetector.PanGesture_numberOfTouches_set(swigCPtr, value);
258                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
259             }
260             get
261             {
262                 uint ret = Interop.PanGestureDetector.PanGesture_numberOfTouches_get(swigCPtr);
263                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
264                 return ret;
265             }
266         }
267
268
269         /// <summary>
270         /// Returns the speed at which the user is moving their fingers.<br />
271         /// This is the pixel movement per millisecond.<br />
272         /// </summary>
273         /// <returns>The speed of the pan (in pixels per millisecond).</returns>
274         /// <since_tizen> 3 </since_tizen>
275         public float GetSpeed()
276         {
277             float ret = Interop.PanGestureDetector.PanGesture_GetSpeed(swigCPtr);
278             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
279             return ret;
280         }
281
282         /// <summary>
283         /// Returns the distance the user has panned (dragged) since the last pan gesture or,
284         /// if the gesture has just started, then the distance moved since the user touched the screen.<br />
285         /// This is always a positive value.<br />
286         /// </summary>
287         /// <returns>The distance, as a float, a user's finger has panned.</returns>
288         /// <since_tizen> 3 </since_tizen>
289         public float GetDistance()
290         {
291             float ret = Interop.PanGestureDetector.PanGesture_GetDistance(swigCPtr);
292             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
293             return ret;
294         }
295
296         /// <summary>
297         /// Returns the speed at which the user is moving their fingers relative to screen coordinates.<br />
298         /// This is the pixel movement per millisecond.<br />
299         /// </summary>
300         /// <returns>The speed of the pan (in pixels per millisecond).</returns>
301         /// <since_tizen> 3 </since_tizen>
302         public float GetScreenSpeed()
303         {
304             float ret = Interop.PanGestureDetector.PanGesture_GetScreenSpeed(swigCPtr);
305             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
306             return ret;
307         }
308
309         /// <summary>
310         /// Returns the distance the user has panned (dragged) since the last pan gesture in screen
311         /// coordinates or, if the gesture has just started, then the distance in screen coordinates moved
312         /// since the user touched the screen.<br />
313         /// This is always a positive value.<br />
314         /// </summary>
315         /// <returns>The distance, as a float, a user's finger has panned.</returns>
316         /// <since_tizen> 3 </since_tizen>
317         public float GetScreenDistance()
318         {
319             float ret = Interop.PanGestureDetector.PanGesture_GetScreenDistance(swigCPtr);
320             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
321             return ret;
322         }
323
324         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PanGesture obj)
325         {
326             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
327         }
328
329         internal static PanGesture GetPanGestureFromPtr(global::System.IntPtr cPtr)
330         {
331             PanGesture ret = new PanGesture(cPtr, false);
332             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
333             return ret;
334         }
335
336         /// <summary>
337         /// Dispose.
338         /// </summary>
339         /// <since_tizen> 3 </since_tizen>
340         protected override void Dispose(DisposeTypes type)
341         {
342             if (disposed)
343             {
344                 return;
345             }
346
347             if (type == DisposeTypes.Explicit)
348             {
349                 //Called by User
350                 //Release your own managed resources here.
351                 //You should release all of your own disposable objects here.
352             }
353
354             //Release your own unmanaged resources here.
355             //You should not access any managed member here except static instance.
356             //because the execution order of Finalizes is non-deterministic.
357
358             if (swigCPtr.Handle != global::System.IntPtr.Zero)
359             {
360                 if (swigCMemOwn)
361                 {
362                     swigCMemOwn = false;
363                     Interop.PanGestureDetector.delete_PanGesture(swigCPtr);
364                 }
365                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
366             }
367
368             base.Dispose(type);
369         }
370
371     }
372
373 }