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