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