[Tizen] Review nui API cs files
[platform/core/csapi/nui.git] / Tizen.NUI / src / public / PanGesture.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
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
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
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.
14 *
15 */
16
17 namespace Tizen.NUI
18 {
19
20     /// <summary>
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>
28     /// </summary>
29     public class PanGesture : Gesture
30     {
31         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
32
33         internal PanGesture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PanGesture_SWIGUpcast(cPtr), cMemoryOwn)
34         {
35             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
36         }
37
38         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PanGesture obj)
39         {
40             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
41         }
42
43         protected override void Dispose(DisposeTypes type)
44         {
45             if(disposed)
46             {
47                 return;
48             }
49
50             if(type == DisposeTypes.Explicit)
51             {
52                 //Called by User
53                 //Release your own managed resources here.
54                 //You should release all of your own disposable objects here.
55             }
56
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.
60
61             if (swigCPtr.Handle != global::System.IntPtr.Zero)
62             {
63                 if (swigCMemOwn)
64                 {
65                     swigCMemOwn = false;
66                     NDalicPINVOKE.delete_PanGesture(swigCPtr);
67                 }
68                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
69             }
70
71             base.Dispose(type);
72         }
73
74
75         internal static PanGesture GetPanGestureFromPtr(global::System.IntPtr cPtr)
76         {
77             PanGesture ret = new PanGesture(cPtr, false);
78             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79             return ret;
80         }
81
82         /// <summary>
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>
87         /// </summary>
88         public Vector2 Velocity
89         {
90             get
91             {
92                 return velocity;
93             }
94         }
95
96         /// <summary>
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>
101         /// </summary>
102         public Vector2 Displacement
103         {
104             get
105             {
106                 return displacement;
107             }
108         }
109
110         /// <summary>
111         /// The current touch position of the primary touch point in local actor coordinates.
112         /// </summary>
113         public Vector2 Position
114         {
115             get
116             {
117                 return position;
118             }
119         }
120
121         /// <summary>
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>
127         /// </summary>
128         public Vector2 ScreenVelocity
129         {
130             get
131             {
132                 return screenVelocity;
133             }
134         }
135
136         /// <summary>
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>
142         /// </summary>
143         public Vector2 ScreenDisplacement
144         {
145             get
146             {
147                 return screenDisplacement;
148             }
149         }
150
151         /// <summary>
152         /// The current touch position of the primary touch point in screen coordinates.
153         /// </summary>
154         public Vector2 ScreenPosition
155         {
156             get
157             {
158                 return screenPosition;
159             }
160         }
161
162         /// <summary>
163         /// The total number of fingers touching the screen in a pan gesture.
164         /// </summary>
165         public uint NumberOfTouches
166         {
167             get
168             {
169                 return numberOfTouches;
170             }
171         }
172
173         /// <summary>
174         /// The default constructor.
175         /// </summary>
176         public PanGesture() : this(NDalicPINVOKE.new_PanGesture__SWIG_0(), true)
177         {
178             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179         }
180
181         /// <summary>
182         /// The constructor.
183         /// </summary>
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)
186         {
187             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
188         }
189
190
191         private Vector2 velocity
192         {
193             set
194             {
195                 NDalicPINVOKE.PanGesture_velocity_set(swigCPtr, Vector2.getCPtr(value));
196                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197             }
198             get
199             {
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();
203                 return ret;
204             }
205         }
206
207         private Vector2 displacement
208         {
209             set
210             {
211                 NDalicPINVOKE.PanGesture_displacement_set(swigCPtr, Vector2.getCPtr(value));
212                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
213             }
214             get
215             {
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();
219                 return ret;
220             }
221         }
222
223         private Vector2 position
224         {
225             set
226             {
227                 NDalicPINVOKE.PanGesture_position_set(swigCPtr, Vector2.getCPtr(value));
228                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
229             }
230             get
231             {
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();
235                 return ret;
236             }
237         }
238
239         private Vector2 screenVelocity
240         {
241             set
242             {
243                 NDalicPINVOKE.PanGesture_screenVelocity_set(swigCPtr, Vector2.getCPtr(value));
244                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
245             }
246             get
247             {
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();
251                 return ret;
252             }
253         }
254
255         private Vector2 screenDisplacement
256         {
257             set
258             {
259                 NDalicPINVOKE.PanGesture_screenDisplacement_set(swigCPtr, Vector2.getCPtr(value));
260                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
261             }
262             get
263             {
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();
267                 return ret;
268             }
269         }
270
271         private Vector2 screenPosition
272         {
273             set
274             {
275                 NDalicPINVOKE.PanGesture_screenPosition_set(swigCPtr, Vector2.getCPtr(value));
276                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
277             }
278             get
279             {
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();
283                 return ret;
284             }
285         }
286
287         private uint numberOfTouches
288         {
289             set
290             {
291                 NDalicPINVOKE.PanGesture_numberOfTouches_set(swigCPtr, value);
292                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
293             }
294             get
295             {
296                 uint ret = NDalicPINVOKE.PanGesture_numberOfTouches_get(swigCPtr);
297                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
298                 return ret;
299             }
300         }
301
302         /// <summary>
303         /// Returns the speed at which the user is moving their fingers.<br>
304         /// This is the pixel movement per millisecond.<br>
305         /// </summary>
306         /// <returns>The speed of the pan (in pixels per millisecond).</returns>
307         public float GetSpeed()
308         {
309             float ret = NDalicPINVOKE.PanGesture_GetSpeed(swigCPtr);
310             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
311             return ret;
312         }
313
314         /// <summary>
315         /// 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>
318         /// </summary>
319         /// <returns>The distance, as a float, a user's finger has panned.</returns>
320         public float GetDistance()
321         {
322             float ret = NDalicPINVOKE.PanGesture_GetDistance(swigCPtr);
323             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
324             return ret;
325         }
326
327         /// <summary>
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>
330         /// </summary>
331         /// <returns>The speed of the pan (in pixels per millisecond).</returns>
332         public float GetScreenSpeed()
333         {
334             float ret = NDalicPINVOKE.PanGesture_GetScreenSpeed(swigCPtr);
335             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
336             return ret;
337         }
338
339         /// <summary>
340         /// 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>
344         /// </summary>
345         /// <returns>The distance, as a float, a user's finger has panned.</returns>
346         public float GetScreenDistance()
347         {
348             float ret = NDalicPINVOKE.PanGesture_GetScreenDistance(swigCPtr);
349             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
350             return ret;
351         }
352
353     }
354
355 }