[NUI] Remove duplicate getCPtr from BaseHandle subclasses (#3545)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Events / GestureDetector.cs
1 /*
2  * Copyright(c) 2018 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 Tizen.NUI.BaseComponents;
18 using System.ComponentModel;
19
20 namespace Tizen.NUI
21 {
22     /// <summary>
23     /// GestureDetectors analyses a stream of touch events and attempt to determine the intention of the user.<br />
24     /// An view is attached to a gesture detector and if the detector recognises a pattern in its analysis, it will
25     /// trigger a detected event to the application.<br />
26     /// This is the base class for different gesture detectors available and provides functionality that is common to all the gesture detectors.<br />
27     /// </summary>
28     /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
29     [EditorBrowsable(EditorBrowsableState.Never)]
30     public class GestureDetector : BaseHandle
31     {
32
33         /// <summary>
34         /// Constructor. Creates an uninitialized GestureDetector.
35         /// </summary>
36         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
37         [EditorBrowsable(EditorBrowsableState.Never)]
38         public GestureDetector() : this(Interop.GestureDetector.NewGestureDetector(), true)
39         {
40             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
41         }
42
43         /// <summary>
44         /// Constructor.
45         /// </summary>
46         /// <param name="handle">A reference to the copied handle</param>
47         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
48         [EditorBrowsable(EditorBrowsableState.Never)]
49         public GestureDetector(GestureDetector handle) : this(Interop.GestureDetector.NewGestureDetector(GestureDetector.getCPtr(handle)), true)
50         {
51             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
52         }
53
54         internal GestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
55         {
56         }
57
58         /// <summary>
59         /// Attaches an view to the gesture. The detected event will be triggered when the gesture occurs on the attached view.
60         /// </summary>
61         /// <param name="view">The view to attach to the gesture detector</param>
62         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
63         [EditorBrowsable(EditorBrowsableState.Never)]
64         public void Attach(View view)
65         {
66             Interop.GestureDetector.Attach(SwigCPtr, View.getCPtr(view));
67             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68         }
69
70         /// <summary>
71         /// Detaches the attached view from the gesture detector.
72         /// </summary>
73         /// <param name="view">The view to detach from the gesture detector</param>
74         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
75         [EditorBrowsable(EditorBrowsableState.Never)]
76         public void Detach(View view)
77         {
78             Interop.GestureDetector.Detach(SwigCPtr, View.getCPtr(view));
79             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
80         }
81
82         /// <summary>
83         /// Detaches all the views that have been attached to the gesture detector.
84         /// </summary>
85         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
86         [EditorBrowsable(EditorBrowsableState.Never)]
87         public void DetachAll()
88         {
89             Interop.GestureDetector.DetachAll(SwigCPtr);
90             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91         }
92
93         /// <summary>
94         /// Returns the number of views attached to the gesture detector.
95         /// </summary>
96         /// <returns>The count</returns>
97         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
98         [EditorBrowsable(EditorBrowsableState.Never)]
99         public uint GetAttachedViewCount()
100         {
101             uint ret = Interop.GestureDetector.GetAttachedActorCount(SwigCPtr);
102             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103             return ret;
104         }
105
106         /// <summary>
107         /// Returns an view by index. An empty handle if the index is not valid.
108         /// </summary>
109         /// <param name="index">The attached view's index</param>
110         /// <returns>The attached view or an empty handle</returns>
111         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
112         [EditorBrowsable(EditorBrowsableState.Never)]
113         public View GetAttachedView(uint index)
114         {
115             View ret = new View(Interop.GestureDetector.GetAttachedActor(SwigCPtr, index), true);
116             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117             return ret;
118         }
119
120         internal GestureDetector Assign(GestureDetector rhs)
121         {
122             GestureDetector ret = new GestureDetector(Interop.GestureDetector.Assign(SwigCPtr, GestureDetector.getCPtr(rhs)), false);
123             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124             return ret;
125         }
126
127         internal static GestureDetector DownCast(BaseHandle handle)
128         {
129             GestureDetector ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as GestureDetector;
130             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131             return ret;
132         }
133
134         /// This will not be public opened.
135         [EditorBrowsable(EditorBrowsableState.Never)]
136         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
137         {
138             Interop.GestureDetector.DeleteGestureDetector(swigCPtr);
139         }
140     }
141 }