merging dali-sharp class scope with nui
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / PanGestureDetector.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 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
18 // <auto-generated />
19 //
20 // This file was automatically generated by SWIG (http://www.swig.org).
21 // Version 3.0.9
22 //
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
26
27 namespace Tizen.NUI
28 {
29
30     using System;
31     using System.Runtime.InteropServices;
32     using Tizen.NUI.BaseComponents;
33
34
35     internal class PanGestureDetector : GestureDetector
36     {
37         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
38
39         internal PanGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PanGestureDetector_SWIGUpcast(cPtr), cMemoryOwn)
40         {
41             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
42         }
43
44         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PanGestureDetector obj)
45         {
46             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
47         }
48
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
64             //Release your own unmanaged resources here.
65             //You should not access any managed member here except static instance.
66             //because the execution order of Finalizes is non-deterministic.
67
68             if (swigCPtr.Handle != global::System.IntPtr.Zero)
69             {
70                 if (swigCMemOwn)
71                 {
72                     swigCMemOwn = false;
73                     NDalicPINVOKE.delete_PanGestureDetector(swigCPtr);
74                 }
75                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
76             }
77
78             base.Dispose(type);
79         }
80
81
82
83         public class DetectedEventArgs : EventArgs
84         {
85             private View _view;
86             private PanGesture _panGesture;
87
88             public View View
89             {
90                 get
91                 {
92                     return _view;
93                 }
94                 set
95                 {
96                     _view = value;
97                 }
98             }
99
100             public PanGesture PanGesture
101             {
102                 get
103                 {
104                     return _panGesture;
105                 }
106                 set
107                 {
108                     _panGesture = value;
109                 }
110             }
111         }
112
113         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
114         private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr panGesture);
115         private DaliEventHandler<object, DetectedEventArgs> _panGestureEventHandler;
116         private DetectedCallbackDelegate _panGestureCallbackDelegate;
117
118
119         public event DaliEventHandler<object, DetectedEventArgs> Detected
120         {
121             add
122             {
123                 lock (this)
124                 {
125                     // Restricted to only one listener
126                     if (_panGestureEventHandler == null)
127                     {
128                         _panGestureEventHandler += value;
129
130                         _panGestureCallbackDelegate = new DetectedCallbackDelegate(OnPanGestureDetected);
131                         this.DetectedSignal().Connect(_panGestureCallbackDelegate);
132                     }
133                 }
134             }
135
136             remove
137             {
138                 lock (this)
139                 {
140                     if (_panGestureEventHandler != null)
141                     {
142                         this.DetectedSignal().Disconnect(_panGestureCallbackDelegate);
143                     }
144
145                     _panGestureEventHandler -= value;
146                 }
147             }
148         }
149
150         private void OnPanGestureDetected(IntPtr actor, IntPtr panGesture)
151         {
152             DetectedEventArgs e = new DetectedEventArgs();
153
154             // Populate all members of "e" (PanGestureEventArgs) with real data
155             e.View = View.GetViewFromPtr(actor);
156             e.PanGesture = Tizen.NUI.PanGesture.GetPanGestureFromPtr(panGesture);
157
158             if (_panGestureEventHandler != null)
159             {
160                 //here we send all data to user event handlers
161                 _panGestureEventHandler(this, e);
162             }
163
164         }
165
166
167         public static PanGestureDetector GetPanGestureDetectorFromPtr(global::System.IntPtr cPtr)
168         {
169             PanGestureDetector ret = new PanGestureDetector(cPtr, false);
170             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171             return ret;
172         }
173
174
175         public class Property : global::System.IDisposable
176         {
177             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
178             protected bool swigCMemOwn;
179
180             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
181             {
182                 swigCMemOwn = cMemoryOwn;
183                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
184             }
185
186             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
187             {
188                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
189             }
190
191             //A Flag to check who called Dispose(). (By User or DisposeQueue)
192             private bool isDisposeQueued = false;
193             //A Flat to check if it is already disposed.
194             protected bool disposed = false;
195
196
197             ~Property()
198             {
199                 if (!isDisposeQueued)
200                 {
201                     isDisposeQueued = true;
202                     DisposeQueue.Instance.Add(this);
203                 }
204             }
205
206             public void Dispose()
207             {
208                 //Throw excpetion if Dispose() is called in separate thread.
209                 if (!Window.IsInstalled())
210                 {
211                     throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
212                 }
213
214                 if (isDisposeQueued)
215                 {
216                     Dispose(DisposeTypes.Implicit);
217                 }
218                 else
219                 {
220                     Dispose(DisposeTypes.Explicit);
221                     System.GC.SuppressFinalize(this);
222                 }
223             }
224
225             protected virtual void Dispose(DisposeTypes type)
226             {
227                 if (disposed)
228                 {
229                     return;
230                 }
231
232                 if (type == DisposeTypes.Explicit)
233                 {
234                     //Called by User
235                     //Release your own managed resources here.
236                     //You should release all of your own disposable objects here.
237
238                 }
239
240                 //Release your own unmanaged resources here.
241                 //You should not access any managed member here except static instance.
242                 //because the execution order of Finalizes is non-deterministic.
243
244                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
245                 {
246                     if (swigCMemOwn)
247                     {
248                         swigCMemOwn = false;
249                         NDalicPINVOKE.delete_PanGestureDetector_Property(swigCPtr);
250                     }
251                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
252                 }
253
254                 disposed = true;
255             }
256
257             public Property() : this(NDalicPINVOKE.new_PanGestureDetector_Property(), true)
258             {
259                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
260             }
261
262             public static readonly int SCREEN_POSITION = NDalicPINVOKE.PanGestureDetector_Property_SCREEN_POSITION_get();
263             public static readonly int SCREEN_DISPLACEMENT = NDalicPINVOKE.PanGestureDetector_Property_SCREEN_DISPLACEMENT_get();
264             public static readonly int SCREEN_VELOCITY = NDalicPINVOKE.PanGestureDetector_Property_SCREEN_VELOCITY_get();
265             public static readonly int LOCAL_POSITION = NDalicPINVOKE.PanGestureDetector_Property_LOCAL_POSITION_get();
266             public static readonly int LOCAL_DISPLACEMENT = NDalicPINVOKE.PanGestureDetector_Property_LOCAL_DISPLACEMENT_get();
267             public static readonly int LOCAL_VELOCITY = NDalicPINVOKE.PanGestureDetector_Property_LOCAL_VELOCITY_get();
268             public static readonly int PANNING = NDalicPINVOKE.PanGestureDetector_Property_PANNING_get();
269
270         }
271
272         public static Radian DIRECTION_LEFT
273         {
274             get
275             {
276                 global::System.IntPtr cPtr = NDalicPINVOKE.PanGestureDetector_DIRECTION_LEFT_get();
277                 Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false);
278                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
279                 return ret;
280             }
281         }
282
283         public static Radian DIRECTION_RIGHT
284         {
285             get
286             {
287                 global::System.IntPtr cPtr = NDalicPINVOKE.PanGestureDetector_DIRECTION_RIGHT_get();
288                 Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false);
289                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
290                 return ret;
291             }
292         }
293
294         public static Radian DIRECTION_UP
295         {
296             get
297             {
298                 global::System.IntPtr cPtr = NDalicPINVOKE.PanGestureDetector_DIRECTION_UP_get();
299                 Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false);
300                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
301                 return ret;
302             }
303         }
304
305         public static Radian DIRECTION_DOWN
306         {
307             get
308             {
309                 global::System.IntPtr cPtr = NDalicPINVOKE.PanGestureDetector_DIRECTION_DOWN_get();
310                 Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false);
311                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
312                 return ret;
313             }
314         }
315
316         public static Radian DIRECTION_HORIZONTAL
317         {
318             get
319             {
320                 global::System.IntPtr cPtr = NDalicPINVOKE.PanGestureDetector_DIRECTION_HORIZONTAL_get();
321                 Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false);
322                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
323                 return ret;
324             }
325         }
326
327         public static Radian DIRECTION_VERTICAL
328         {
329             get
330             {
331                 global::System.IntPtr cPtr = NDalicPINVOKE.PanGestureDetector_DIRECTION_VERTICAL_get();
332                 Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false);
333                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
334                 return ret;
335             }
336         }
337
338         public static Radian DEFAULT_THRESHOLD
339         {
340             get
341             {
342                 global::System.IntPtr cPtr = NDalicPINVOKE.PanGestureDetector_DEFAULT_THRESHOLD_get();
343                 Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false);
344                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
345                 return ret;
346             }
347         }
348
349         public PanGestureDetector() : this(NDalicPINVOKE.PanGestureDetector_New(), true)
350         {
351             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
352
353         }
354         public new static PanGestureDetector DownCast(BaseHandle handle)
355         {
356             PanGestureDetector ret = new PanGestureDetector(NDalicPINVOKE.PanGestureDetector_DownCast(BaseHandle.getCPtr(handle)), true);
357             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
358             return ret;
359         }
360
361         public PanGestureDetector(PanGestureDetector handle) : this(NDalicPINVOKE.new_PanGestureDetector__SWIG_1(PanGestureDetector.getCPtr(handle)), true)
362         {
363             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
364         }
365
366         public PanGestureDetector Assign(PanGestureDetector rhs)
367         {
368             PanGestureDetector ret = new PanGestureDetector(NDalicPINVOKE.PanGestureDetector_Assign(swigCPtr, PanGestureDetector.getCPtr(rhs)), false);
369             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
370             return ret;
371         }
372
373         public void SetMinimumTouchesRequired(uint minimum)
374         {
375             NDalicPINVOKE.PanGestureDetector_SetMinimumTouchesRequired(swigCPtr, minimum);
376             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
377         }
378
379         public void SetMaximumTouchesRequired(uint maximum)
380         {
381             NDalicPINVOKE.PanGestureDetector_SetMaximumTouchesRequired(swigCPtr, maximum);
382             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
383         }
384
385         public uint GetMinimumTouchesRequired()
386         {
387             uint ret = NDalicPINVOKE.PanGestureDetector_GetMinimumTouchesRequired(swigCPtr);
388             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
389             return ret;
390         }
391
392         public uint GetMaximumTouchesRequired()
393         {
394             uint ret = NDalicPINVOKE.PanGestureDetector_GetMaximumTouchesRequired(swigCPtr);
395             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
396             return ret;
397         }
398
399         public void AddAngle(Radian angle, Radian threshold)
400         {
401             NDalicPINVOKE.PanGestureDetector_AddAngle__SWIG_0(swigCPtr, Radian.getCPtr(angle), Radian.getCPtr(threshold));
402             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
403         }
404
405         public void AddAngle(Radian angle)
406         {
407             NDalicPINVOKE.PanGestureDetector_AddAngle__SWIG_1(swigCPtr, Radian.getCPtr(angle));
408             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
409         }
410
411         public void AddDirection(Radian direction, Radian threshold)
412         {
413             NDalicPINVOKE.PanGestureDetector_AddDirection__SWIG_0(swigCPtr, Radian.getCPtr(direction), Radian.getCPtr(threshold));
414             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
415         }
416
417         public void AddDirection(Radian direction)
418         {
419             NDalicPINVOKE.PanGestureDetector_AddDirection__SWIG_1(swigCPtr, Radian.getCPtr(direction));
420             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
421         }
422
423         public uint GetAngleCount()
424         {
425             uint ret = NDalicPINVOKE.PanGestureDetector_GetAngleCount(swigCPtr);
426             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
427             return ret;
428         }
429
430         internal AngleThresholdPair GetAngle(uint index)
431         {
432             AngleThresholdPair ret = new AngleThresholdPair(NDalicPINVOKE.PanGestureDetector_GetAngle(swigCPtr, index), true);
433             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
434             return ret;
435         }
436
437         public void ClearAngles()
438         {
439             NDalicPINVOKE.PanGestureDetector_ClearAngles(swigCPtr);
440             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
441         }
442
443         public void RemoveAngle(Radian angle)
444         {
445             NDalicPINVOKE.PanGestureDetector_RemoveAngle(swigCPtr, Radian.getCPtr(angle));
446             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
447         }
448
449         public void RemoveDirection(Radian direction)
450         {
451             NDalicPINVOKE.PanGestureDetector_RemoveDirection(swigCPtr, Radian.getCPtr(direction));
452             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
453         }
454
455         internal PanGestureDetectedSignal DetectedSignal()
456         {
457             PanGestureDetectedSignal ret = new PanGestureDetectedSignal(NDalicPINVOKE.PanGestureDetector_DetectedSignal(swigCPtr), false);
458             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
459             return ret;
460         }
461
462         public static void SetPanGestureProperties(PanGesture pan)
463         {
464             NDalicPINVOKE.PanGestureDetector_SetPanGestureProperties(PanGesture.getCPtr(pan));
465             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
466         }
467
468         public Vector2 ScreenPosition
469         {
470             get
471             {
472                 Vector2 temp = new Vector2(0.0f, 0.0f);
473                 Tizen.NUI.Object.GetProperty(swigCPtr, PanGestureDetector.Property.SCREEN_POSITION).Get(temp);
474                 return temp;
475             }
476         }
477         public Vector2 ScreenDisplacement
478         {
479             get
480             {
481                 Vector2 temp = new Vector2(0.0f, 0.0f);
482                 Tizen.NUI.Object.GetProperty(swigCPtr, PanGestureDetector.Property.SCREEN_DISPLACEMENT).Get(temp);
483                 return temp;
484             }
485         }
486         public Vector2 ScreenVelocity
487         {
488             get
489             {
490                 Vector2 temp = new Vector2(0.0f, 0.0f);
491                 Tizen.NUI.Object.GetProperty(swigCPtr, PanGestureDetector.Property.SCREEN_VELOCITY).Get(temp);
492                 return temp;
493             }
494         }
495         public Vector2 LocalPosition
496         {
497             get
498             {
499                 Vector2 temp = new Vector2(0.0f, 0.0f);
500                 Tizen.NUI.Object.GetProperty(swigCPtr, PanGestureDetector.Property.LOCAL_POSITION).Get(temp);
501                 return temp;
502             }
503         }
504         public Vector2 LocalDisplacement
505         {
506             get
507             {
508                 Vector2 temp = new Vector2(0.0f, 0.0f);
509                 Tizen.NUI.Object.GetProperty(swigCPtr, PanGestureDetector.Property.LOCAL_DISPLACEMENT).Get(temp);
510                 return temp;
511             }
512         }
513         public Vector2 LocalVelocity
514         {
515             get
516             {
517                 Vector2 temp = new Vector2(0.0f, 0.0f);
518                 Tizen.NUI.Object.GetProperty(swigCPtr, PanGestureDetector.Property.LOCAL_VELOCITY).Get(temp);
519                 return temp;
520             }
521         }
522         public bool Panning
523         {
524             get
525             {
526                 bool temp = false;
527                 Tizen.NUI.Object.GetProperty(swigCPtr, PanGestureDetector.Property.PANNING).Get(ref temp);
528                 return temp;
529             }
530         }
531     }
532
533 }