[NUI] Add maximum motion age of pan motion gesture
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Events / PanGestureDetector.cs
1 /*
2  * Copyright(c) 2021 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 using System;
18 using System.Runtime.InteropServices;
19 using Tizen.NUI.BaseComponents;
20 using System.ComponentModel;
21
22 namespace Tizen.NUI
23 {
24     /// <summary>
25     /// This class emits a signals when a pan gesture occurs.<br />
26     /// </summary>
27     /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
28     [EditorBrowsable(EditorBrowsableState.Never)]
29     public class PanGestureDetector : GestureDetector
30     {
31         /// <summary>
32         /// Creates an initialized PanGestureDetector.
33         /// </summary>
34         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
35         [EditorBrowsable(EditorBrowsableState.Never)]
36         public PanGestureDetector() : this(Interop.PanGestureDetector.New(), true)
37         {
38             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
39
40         }
41
42         /// <summary>
43         /// The copy constructor.
44         /// </summary>
45         /// <param name="handle">A reference to the copied handle</param>
46         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
47         [EditorBrowsable(EditorBrowsableState.Never)]
48         public PanGestureDetector(PanGestureDetector handle) : this(Interop.PanGestureDetector.NewPanGestureDetector(PanGestureDetector.getCPtr(handle)), true)
49         {
50             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
51         }
52
53         internal PanGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
54         {
55         }
56
57         private DaliEventHandler<object, DetectedEventArgs> detectedEventHandler;
58         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
59         private delegate void DetectedCallbackType(IntPtr actor, IntPtr panGesture);
60         private DetectedCallbackType detectedCallback;
61
62         /// <summary>
63         /// This signal is emitted when the specified pan is detected on the attached view.
64         /// </summary>
65         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
66         [EditorBrowsable(EditorBrowsableState.Never)]
67         public event DaliEventHandler<object, DetectedEventArgs> Detected
68         {
69             add
70             {
71                 if (detectedEventHandler == null)
72                 {
73                     detectedCallback = OnPanGestureDetected;
74                     DetectedSignal().Connect(detectedCallback);
75                 }
76
77                 detectedEventHandler += value;
78             }
79
80             remove
81             {
82                 detectedEventHandler -= value;
83
84                 if (detectedEventHandler == null && DetectedSignal().Empty() == false)
85                 {
86                     DetectedSignal().Disconnect(detectedCallback);
87                 }
88             }
89         }
90
91         /// <summary>
92         /// For a left pan (-PI Radians).
93         /// </summary>
94         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
95         [EditorBrowsable(EditorBrowsableState.Never)]
96         public static Radian DirectionLeft
97         {
98             get
99             {
100                 global::System.IntPtr cPtr = Interop.PanGestureDetector.DirectionLeftGet();
101                 Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false);
102                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
103                 return ret;
104             }
105         }
106
107         /// <summary>
108         /// For a right pan (0 Radians).
109         /// </summary>
110         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
111         [EditorBrowsable(EditorBrowsableState.Never)]
112         public static Radian DirectionRight
113         {
114             get
115             {
116                 global::System.IntPtr cPtr = Interop.PanGestureDetector.DirectionRightGet();
117                 Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false);
118                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
119                 return ret;
120             }
121         }
122
123         /// <summary>
124         /// For an up pan (-0.5 * PI Radians).
125         /// </summary>
126         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
127         [EditorBrowsable(EditorBrowsableState.Never)]
128         public static Radian DirectionUp
129         {
130             get
131             {
132                 global::System.IntPtr cPtr = Interop.PanGestureDetector.DirectionUpGet();
133                 Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false);
134                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
135                 return ret;
136             }
137         }
138
139         /// <summary>
140         /// For a down pan (0.5 * PI Radians).
141         /// </summary>
142         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
143         [EditorBrowsable(EditorBrowsableState.Never)]
144         public static Radian DirectionDown
145         {
146             get
147             {
148                 global::System.IntPtr cPtr = Interop.PanGestureDetector.DirectionDownGet();
149                 Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false);
150                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
151                 return ret;
152             }
153         }
154
155         /// <summary>
156         /// For a left and right pan (PI Radians). Useful for AddDirection().
157         /// </summary>
158         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
159         [EditorBrowsable(EditorBrowsableState.Never)]
160         public static Radian DirectionHorizontal
161         {
162             get
163             {
164                 global::System.IntPtr cPtr = Interop.PanGestureDetector.DirectionHorizontalGet();
165                 Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false);
166                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
167                 return ret;
168             }
169         }
170
171         /// <summary>
172         /// For an up and down pan (-0.5 * PI Radians). Useful for AddDirection().
173         /// </summary>
174         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
175         [EditorBrowsable(EditorBrowsableState.Never)]
176         public static Radian DirectionVertical
177         {
178             get
179             {
180                 global::System.IntPtr cPtr = Interop.PanGestureDetector.DirectionVerticalGet();
181                 Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false);
182                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
183                 return ret;
184             }
185         }
186
187         /// <summary>
188         /// The default threshold is PI * 0.25 radians (or 45 degrees).
189         /// </summary>
190         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
191         [EditorBrowsable(EditorBrowsableState.Never)]
192         public static Radian DefaultThreshold
193         {
194             get
195             {
196                 global::System.IntPtr cPtr = Interop.PanGestureDetector.DefaultThresholdGet();
197                 Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false);
198                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
199                 return ret;
200             }
201         }
202
203         /// <summary>
204         /// Retrieves the screen position.
205         /// </summary>
206         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
207         [EditorBrowsable(EditorBrowsableState.Never)]
208         public Vector2 ScreenPosition
209         {
210             get
211             {
212                 Vector2 temp = new Vector2(0.0f, 0.0f);
213                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
214                 return temp;
215             }
216         }
217
218         /// <summary>
219         /// Retrieves the screen displacement.
220         /// </summary>
221         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
222         [EditorBrowsable(EditorBrowsableState.Never)]
223         public Vector2 ScreenDisplacement
224         {
225             get
226             {
227                 Vector2 temp = new Vector2(0.0f, 0.0f);
228                 var pValue = Tizen.NUI.Object.GetProperty(SwigCPtr, PanGestureDetector.Property.ScreenDisplacement);
229                 pValue.Get(temp);
230                 pValue.Dispose();
231                 return temp;
232             }
233         }
234
235         /// <summary>
236         /// Retrieves the screen velocity.
237         /// </summary>
238         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
239         [EditorBrowsable(EditorBrowsableState.Never)]
240         public Vector2 ScreenVelocity
241         {
242             get
243             {
244                 Vector2 temp = new Vector2(0.0f, 0.0f);
245                 var pValue = Tizen.NUI.Object.GetProperty(SwigCPtr, PanGestureDetector.Property.ScreenVelocity);
246                 pValue.Get(temp);
247                 pValue.Dispose();
248                 return temp;
249             }
250         }
251
252         /// <summary>
253         /// Retrieves the local position.
254         /// </summary>
255         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
256         [EditorBrowsable(EditorBrowsableState.Never)]
257         public Vector2 LocalPosition
258         {
259             get
260             {
261                 Vector2 temp = new Vector2(0.0f, 0.0f);
262                 var pValue = Tizen.NUI.Object.GetProperty(SwigCPtr, PanGestureDetector.Property.LocalPosition);
263                 pValue.Get(temp);
264                 pValue.Dispose();
265                 return temp;
266             }
267         }
268
269         /// <summary>
270         /// Retrieves the local displacement
271         /// </summary>
272         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
273         [EditorBrowsable(EditorBrowsableState.Never)]
274         public Vector2 LocalDisplacement
275         {
276             get
277             {
278                 Vector2 temp = new Vector2(0.0f, 0.0f);
279                 var pValue = Tizen.NUI.Object.GetProperty(SwigCPtr, PanGestureDetector.Property.LocalDisplacement);
280                 pValue.Get(temp);
281                 pValue.Dispose();
282                 return temp;
283             }
284         }
285
286         /// <summary>
287         /// Retrieves the local velocity.
288         /// </summary>
289         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
290         [EditorBrowsable(EditorBrowsableState.Never)]
291         public Vector2 LocalVelocity
292         {
293             get
294             {
295                 Vector2 temp = new Vector2(0.0f, 0.0f);
296                 var pValue = Tizen.NUI.Object.GetProperty(SwigCPtr, PanGestureDetector.Property.LocalVelocity);
297                 pValue.Get(temp);
298                 pValue.Dispose();
299                 return temp;
300             }
301         }
302
303         /// <summary>
304         /// Retrieves the panning flag.
305         /// </summary>
306         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
307         [EditorBrowsable(EditorBrowsableState.Never)]
308         public bool Panning
309         {
310             get
311             {
312                 bool temp = false;
313                 var pValue = Tizen.NUI.Object.GetProperty(SwigCPtr, PanGestureDetector.Property.PANNING);
314                 pValue.Get(out temp);
315                 pValue.Dispose();
316                 return temp;
317             }
318         }
319
320         /// <summary>
321         /// This is the minimum number of touches required for the pan gesture to be detected.
322         /// </summary>
323         /// <param name="minimum">Minimum touches required</param>
324         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
325         [EditorBrowsable(EditorBrowsableState.Never)]
326         public void SetMinimumTouchesRequired(uint minimum)
327         {
328             Interop.PanGestureDetector.SetMinimumTouchesRequired(SwigCPtr, minimum);
329             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
330         }
331
332         /// <summary>
333         /// This is the maximum number of touches required for the pan gesture to be detected.
334         /// </summary>
335         /// <param name="maximum">Maximum touches required</param>
336         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
337         [EditorBrowsable(EditorBrowsableState.Never)]
338         public void SetMaximumTouchesRequired(uint maximum)
339         {
340             Interop.PanGestureDetector.SetMaximumTouchesRequired(SwigCPtr, maximum);
341             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
342         }
343
344         /// <summary>
345         /// Set a maximum duration of motion event that is able to live on the pan gesture event queue.
346         /// If duration exceed it, the motion event is discarded.
347         /// </summary>
348         /// <param name="maximumAgeMilliSecond">Maximum age of motion events as milliseconds</param>
349         [EditorBrowsable(EditorBrowsableState.Never)]
350         public void SetMaximumMotionEventAge(uint maximumAgeMilliSecond)
351         {
352             Interop.PanGestureDetector.SetMaximumMotionEventAge(SwigCPtr, maximumAgeMilliSecond);
353             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
354         }
355
356         /// <summary>
357         /// Retrieves the minimum number of touches required for the pan gesture to be detected.
358         /// </summary>
359         /// <returns>The minimum touches required</returns>
360         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
361         [EditorBrowsable(EditorBrowsableState.Never)]
362         public uint GetMinimumTouchesRequired()
363         {
364             uint ret = Interop.PanGestureDetector.GetMinimumTouchesRequired(SwigCPtr);
365             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
366             return ret;
367         }
368
369         /// <summary>
370         /// Retrieves the maximum number of touches required for the pan gesture to be detected.
371         /// </summary>
372         /// <returns>The maximum touches required</returns>
373         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
374         [EditorBrowsable(EditorBrowsableState.Never)]
375         public uint GetMaximumTouchesRequired()
376         {
377             uint ret = Interop.PanGestureDetector.GetMaximumTouchesRequired(SwigCPtr);
378             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
379             return ret;
380         }
381
382         /// <summary>
383         /// Retrieves the maximum age for the pan gesture motion as milliseconds.
384         /// </summary>
385         /// <returns>The maximum age of motion events as milliseconds</returns>
386         [EditorBrowsable(EditorBrowsableState.Never)]
387         public uint GetMaximumMotionEventAge()
388         {
389             uint ret = Interop.PanGestureDetector.GetMaximumMotionEventAge(SwigCPtr);
390             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
391             return ret;
392         }
393
394         /// <summary>
395         /// The pan gesture is only emitted if the pan occurs in the direction specified by this method with a +/- threshold allowance.<br />
396         /// If an angle of 0.0 degrees is specified and the threshold is 45 degrees then the acceptable direction range is from -45 to 45 degrees.<br />
397         /// The angle added using this API is only checked when the gesture first starts, after that, this detector will emit the gesture regardless of what angle the pan is moving.
398         /// The user can add as many angles as they require.
399         /// </summary>
400         /// <param name="angle">The angle that pan should be allowed</param>
401         /// <param name="threshold">The threshold around that angle</param>
402         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
403         [EditorBrowsable(EditorBrowsableState.Never)]
404         public void AddAngle(Radian angle, Radian threshold)
405         {
406             Interop.PanGestureDetector.AddAngle(SwigCPtr, Radian.getCPtr(angle), Radian.getCPtr(threshold));
407             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
408         }
409
410         /// <summary>
411         /// The pan gesture is only emitted if the pan occurs in the direction specified by this method with a +/- threshold allowance. The default threshold (PI * 0.25) is used.<br />
412         /// The angle added using this API is only checked when the gesture first starts, after that, this detector will emit the gesture regardless of what angle the pan is moving.<br />
413         /// The user can add as many angles as they require.<br />
414         /// </summary>
415         /// <param name="angle">The angle that pan should be allowed</param>
416         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
417         [EditorBrowsable(EditorBrowsableState.Never)]
418         public void AddAngle(Radian angle)
419         {
420             Interop.PanGestureDetector.AddAngle(SwigCPtr, Radian.getCPtr(angle));
421             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
422         }
423
424         /// <summary>
425         /// A helper method for adding bi-directional angles where the pan should take place.<br />
426         /// In other words, if 0 is requested, then PI will also be added so that we have both left and right scrolling.<br />
427         /// </summary>
428         /// <param name="direction">The direction of panning required</param>
429         /// <param name="threshold">The threshold</param>
430         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
431         [EditorBrowsable(EditorBrowsableState.Never)]
432         public void AddDirection(Radian direction, Radian threshold)
433         {
434             Interop.PanGestureDetector.AddDirection(SwigCPtr, Radian.getCPtr(direction), Radian.getCPtr(threshold));
435             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
436         }
437
438         /// <summary>
439         /// A helper method for adding bi-directional angles where the pan should take place.
440         /// In other words, if 0 is requested, then PI will also be added so that we have both left and right scrolling.<br />
441         /// The default threshold (PI * 0.25) is used.
442         /// </summary>
443         /// <param name="direction">The direction of panning required</param>
444         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
445         [EditorBrowsable(EditorBrowsableState.Never)]
446         public void AddDirection(Radian direction)
447         {
448             Interop.PanGestureDetector.AddDirection(SwigCPtr, Radian.getCPtr(direction));
449             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
450         }
451
452         /// <summary>
453         /// Returns the count of angles that this pan gesture detector emits a signal.
454         /// </summary>
455         /// <returns>The gesture detector has been initialized.</returns>
456         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
457         [EditorBrowsable(EditorBrowsableState.Never)]
458         public uint GetAngleCount()
459         {
460             uint ret = Interop.PanGestureDetector.GetAngleCount(SwigCPtr);
461             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
462             return ret;
463         }
464
465         /// <summary>
466         /// Clears any directional angles that are used by the gesture detector.
467         /// </summary>
468         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
469         [EditorBrowsable(EditorBrowsableState.Never)]
470         public void ClearAngles()
471         {
472             Interop.PanGestureDetector.ClearAngles(SwigCPtr);
473             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
474         }
475
476         /// <summary>
477         /// Removes the angle specified from the container. This will only remove the first instance of the angle found from the container.
478         /// </summary>
479         /// <param name="angle">The angle to remove</param>
480         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
481         [EditorBrowsable(EditorBrowsableState.Never)]
482         public void RemoveAngle(Radian angle)
483         {
484             Interop.PanGestureDetector.RemoveAngle(SwigCPtr, Radian.getCPtr(angle));
485             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
486         }
487
488         /// <summary>
489         /// Removes the two angles that make up the direction from the container.
490         /// </summary>
491         /// <param name="direction">The direction to remove</param>
492         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
493         [EditorBrowsable(EditorBrowsableState.Never)]
494         public void RemoveDirection(Radian direction)
495         {
496             Interop.PanGestureDetector.RemoveDirection(SwigCPtr, Radian.getCPtr(direction));
497             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
498         }
499
500         /// <summary>
501         /// Allows setting of the pan properties that are returned in constraints.
502         /// </summary>
503         /// <param name="pan">The pan gesture to set</param>
504         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
505         [EditorBrowsable(EditorBrowsableState.Never)]
506         public static void SetPanGestureProperties(PanGesture pan)
507         {
508             Interop.PanGestureDetector.SetPanGestureProperties(PanGesture.getCPtr(pan));
509             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
510         }
511
512         internal static PanGestureDetector GetPanGestureDetectorFromPtr(global::System.IntPtr cPtr)
513         {
514             PanGestureDetector ret = new PanGestureDetector(cPtr, false);
515             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
516             return ret;
517         }
518
519         internal new static PanGestureDetector DownCast(BaseHandle handle)
520         {
521             PanGestureDetector ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as PanGestureDetector;
522             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
523             return ret;
524         }
525
526         internal AngleThresholdPair GetAngle(uint index)
527         {
528             AngleThresholdPair ret = new AngleThresholdPair(Interop.PanGestureDetector.GetAngle(SwigCPtr, index), true);
529             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
530             return ret;
531         }
532
533         internal PanGestureDetector Assign(PanGestureDetector rhs)
534         {
535             PanGestureDetector ret = new PanGestureDetector(Interop.PanGestureDetector.Assign(SwigCPtr, PanGestureDetector.getCPtr(rhs)), false);
536             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
537             return ret;
538         }
539
540         internal PanGestureDetectedSignal DetectedSignal()
541         {
542             PanGestureDetectedSignal ret = new PanGestureDetectedSignal(Interop.PanGestureDetector.DetectedSignal(SwigCPtr), false);
543             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
544             return ret;
545         }
546
547         /// This will not be public opened.
548         [EditorBrowsable(EditorBrowsableState.Never)]
549         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
550         {
551             if (detectedCallback != null)
552             {
553                 DetectedSignal().Disconnect(detectedCallback);
554             }
555
556             Interop.PanGestureDetector.DeletePanGestureDetector(swigCPtr);
557         }
558
559         private void OnPanGestureDetected(IntPtr actor, IntPtr panGesture)
560         {
561             if (detectedEventHandler != null)
562             {
563                 DetectedEventArgs e = new DetectedEventArgs();
564
565                 // Populate all members of "e" (PanGestureEventArgs) with real data
566                 e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View;
567                 if (null == e.View)
568                 {
569                     e.View = Registry.GetManagedBaseHandleFromRefObject(actor) as View;
570                 }
571
572                 e.PanGesture = Tizen.NUI.PanGesture.GetPanGestureFromPtr(panGesture);
573                 detectedEventHandler(this, e);
574             }
575         }
576
577         /// <summary>
578         /// Event arguments that are passed via the PanGestureEvent signal.
579         /// </summary>
580         /// <since_tizen> 5 </since_tizen>
581         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
582         [EditorBrowsable(EditorBrowsableState.Never)]
583         public class DetectedEventArgs : EventArgs
584         {
585             private View view;
586             private PanGesture panGesture;
587             private bool handled = true;
588
589             /// <summary>
590             /// The attached view.
591             /// </summary>
592             /// <since_tizen> 5 </since_tizen>
593             /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
594             [EditorBrowsable(EditorBrowsableState.Never)]
595             public View View
596             {
597                 get
598                 {
599                     return view;
600                 }
601                 set
602                 {
603                     view = value;
604                 }
605             }
606
607             /// <summary>
608             /// The PanGesture.
609             /// </summary>
610             /// <since_tizen> 5 </since_tizen>
611             /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
612             [EditorBrowsable(EditorBrowsableState.Never)]
613             public PanGesture PanGesture
614             {
615                 get
616                 {
617                     return panGesture;
618                 }
619                 set
620                 {
621                     panGesture = value;
622                 }
623             }
624
625             /// <summary>
626             /// Gets or sets a value that indicates whether the event handler has completely handled the event or whether the system should continue its own processing.
627             /// </summary>
628             [EditorBrowsable(EditorBrowsableState.Never)]
629             public bool Handled
630             {
631                 get => handled;
632                 set
633                 {
634                     handled = value;
635                     Interop.Actor.SetNeedGesturePropagation(View.getCPtr(view), !value);
636                     if (NDalicPINVOKE.SWIGPendingException.Pending)
637                         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
638                 }
639             }
640         }
641
642         internal class Property
643         {
644             internal static readonly int ScreenPosition = Interop.PanGestureDetector.ScreenPositionGet();
645             internal static readonly int ScreenDisplacement = Interop.PanGestureDetector.ScreenDisplacementGet();
646             internal static readonly int ScreenVelocity = Interop.PanGestureDetector.ScreenVelocityGet();
647             internal static readonly int LocalPosition = Interop.PanGestureDetector.LocalPositionGet();
648             internal static readonly int LocalDisplacement = Interop.PanGestureDetector.LocalDisplacementGet();
649             internal static readonly int LocalVelocity = Interop.PanGestureDetector.LocalVelocityGet();
650             internal static readonly int PANNING = Interop.PanGestureDetector.PanningGet();
651         }
652     }
653 }