merging dali-sharp class scope with nui
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / TapGestureDetector.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     internal class TapGestureDetector : GestureDetector
35     {
36         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
37
38         internal TapGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TapGestureDetector_SWIGUpcast(cPtr), cMemoryOwn)
39         {
40             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
41         }
42
43         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TapGestureDetector obj)
44         {
45             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
46         }
47
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
63             //Release your own unmanaged resources here.
64             //You should not access any managed member here except static instance.
65             //because the execution order of Finalizes is non-deterministic.
66
67             if (swigCPtr.Handle != global::System.IntPtr.Zero)
68             {
69                 if (swigCMemOwn)
70                 {
71                     swigCMemOwn = false;
72                     NDalicPINVOKE.delete_TapGestureDetector(swigCPtr);
73                 }
74                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
75             }
76
77             base.Dispose(type);
78         }
79
80
81         public class DetectedEventArgs : EventArgs
82         {
83             private View _view;
84             private TapGesture _tapGesture;
85
86             public View View
87             {
88                 get
89                 {
90                     return _view;
91                 }
92                 set
93                 {
94                     _view = value;
95                 }
96             }
97
98             public TapGesture TapGesture
99             {
100                 get
101                 {
102                     return _tapGesture;
103                 }
104                 set
105                 {
106                     _tapGesture = value;
107                 }
108             }
109         }
110
111         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
112         private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr TapGesture);
113         private DaliEventHandler<object, DetectedEventArgs> _tapGestureEventHandler;
114         private DetectedCallbackDelegate _tapGestureCallbackDelegate;
115
116
117         public event DaliEventHandler<object, DetectedEventArgs> Detected
118         {
119             add
120             {
121                 lock (this)
122                 {
123                     // Restricted to only one listener
124                     if (_tapGestureEventHandler == null)
125                     {
126                         _tapGestureEventHandler += value;
127
128                         _tapGestureCallbackDelegate = new DetectedCallbackDelegate(OnTapGestureDetected);
129                         this.DetectedSignal().Connect(_tapGestureCallbackDelegate);
130                     }
131                 }
132             }
133
134             remove
135             {
136                 lock (this)
137                 {
138                     if (_tapGestureEventHandler != null)
139                     {
140                         this.DetectedSignal().Disconnect(_tapGestureCallbackDelegate);
141                     }
142
143                     _tapGestureEventHandler -= value;
144                 }
145             }
146         }
147
148         private void OnTapGestureDetected(IntPtr actor, IntPtr tapGesture)
149         {
150             DetectedEventArgs e = new DetectedEventArgs();
151
152             // Populate all members of "e" (DetectedEventArgs) with real data
153             e.View = View.GetViewFromPtr(actor);
154             e.TapGesture = Tizen.NUI.TapGesture.GetTapGestureFromPtr(tapGesture);
155
156             if (_tapGestureEventHandler != null)
157             {
158                 //here we send all data to user event handlers
159                 _tapGestureEventHandler(this, e);
160             }
161
162         }
163
164
165         public static TapGestureDetector GetTapGestureDetectorFromPtr(global::System.IntPtr cPtr)
166         {
167             TapGestureDetector ret = new TapGestureDetector(cPtr, false);
168             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169             return ret;
170         }
171
172
173         public TapGestureDetector() : this(NDalicPINVOKE.TapGestureDetector_New__SWIG_0(), true)
174         {
175             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
176
177         }
178         public TapGestureDetector(uint tapsRequired) : this(NDalicPINVOKE.TapGestureDetector_New__SWIG_1(tapsRequired), true)
179         {
180             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181
182         }
183         public new static TapGestureDetector DownCast(BaseHandle handle)
184         {
185             TapGestureDetector ret = new TapGestureDetector(NDalicPINVOKE.TapGestureDetector_DownCast(BaseHandle.getCPtr(handle)), true);
186             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
187             return ret;
188         }
189
190         public TapGestureDetector(TapGestureDetector handle) : this(NDalicPINVOKE.new_TapGestureDetector__SWIG_1(TapGestureDetector.getCPtr(handle)), true)
191         {
192             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193         }
194
195         public TapGestureDetector Assign(TapGestureDetector rhs)
196         {
197             TapGestureDetector ret = new TapGestureDetector(NDalicPINVOKE.TapGestureDetector_Assign(swigCPtr, TapGestureDetector.getCPtr(rhs)), false);
198             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
199             return ret;
200         }
201
202         public void SetMinimumTapsRequired(uint minimumTaps)
203         {
204             NDalicPINVOKE.TapGestureDetector_SetMinimumTapsRequired(swigCPtr, minimumTaps);
205             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
206         }
207
208         public void SetMaximumTapsRequired(uint maximumTaps)
209         {
210             NDalicPINVOKE.TapGestureDetector_SetMaximumTapsRequired(swigCPtr, maximumTaps);
211             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
212         }
213
214         public uint GetMinimumTapsRequired()
215         {
216             uint ret = NDalicPINVOKE.TapGestureDetector_GetMinimumTapsRequired(swigCPtr);
217             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
218             return ret;
219         }
220
221         public uint GetMaximumTapsRequired()
222         {
223             uint ret = NDalicPINVOKE.TapGestureDetector_GetMaximumTapsRequired(swigCPtr);
224             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
225             return ret;
226         }
227
228         internal TapGestureDetectedSignal DetectedSignal()
229         {
230             TapGestureDetectedSignal ret = new TapGestureDetectedSignal(NDalicPINVOKE.TapGestureDetector_DetectedSignal(swigCPtr), false);
231             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
232             return ret;
233         }
234
235     }
236
237 }