2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 using System.Runtime.InteropServices;
23 using Tizen.NUI.BaseComponents;
25 internal class TapGestureDetector : GestureDetector
27 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
29 internal TapGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TapGestureDetector_SWIGUpcast(cPtr), cMemoryOwn)
31 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
34 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TapGestureDetector obj)
36 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
39 protected override void Dispose(DisposeTypes type)
46 if (type == DisposeTypes.Explicit)
49 //Release your own managed resources here.
50 //You should release all of your own disposable objects here.
54 //Release your own unmanaged resources here.
55 //You should not access any managed member here except static instance.
56 //because the execution order of Finalizes is non-deterministic.
58 if (swigCPtr.Handle != global::System.IntPtr.Zero)
63 NDalicPINVOKE.delete_TapGestureDetector(swigCPtr);
65 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
72 public class DetectedEventArgs : EventArgs
75 private TapGesture _tapGesture;
89 public TapGesture TapGesture
102 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
103 private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr TapGesture);
104 private DaliEventHandler<object, DetectedEventArgs> _tapGestureEventHandler;
105 private DetectedCallbackDelegate _tapGestureCallbackDelegate;
108 public event DaliEventHandler<object, DetectedEventArgs> Detected
114 // Restricted to only one listener
115 if (_tapGestureEventHandler == null)
117 _tapGestureEventHandler += value;
119 _tapGestureCallbackDelegate = new DetectedCallbackDelegate(OnTapGestureDetected);
120 this.DetectedSignal().Connect(_tapGestureCallbackDelegate);
129 if (_tapGestureEventHandler != null)
131 this.DetectedSignal().Disconnect(_tapGestureCallbackDelegate);
134 _tapGestureEventHandler -= value;
139 private void OnTapGestureDetected(IntPtr actor, IntPtr tapGesture)
141 DetectedEventArgs e = new DetectedEventArgs();
143 // Populate all members of "e" (DetectedEventArgs) with real data
144 e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View;
145 e.TapGesture = Tizen.NUI.TapGesture.GetTapGestureFromPtr(tapGesture);
147 if (_tapGestureEventHandler != null)
149 //here we send all data to user event handlers
150 _tapGestureEventHandler(this, e);
156 public static TapGestureDetector GetTapGestureDetectorFromPtr(global::System.IntPtr cPtr)
158 TapGestureDetector ret = new TapGestureDetector(cPtr, false);
159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164 public TapGestureDetector() : this(NDalicPINVOKE.TapGestureDetector_New__SWIG_0(), true)
166 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169 public TapGestureDetector(uint tapsRequired) : this(NDalicPINVOKE.TapGestureDetector_New__SWIG_1(tapsRequired), true)
171 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174 public new static TapGestureDetector DownCast(BaseHandle handle)
176 TapGestureDetector ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TapGestureDetector;
177 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181 public TapGestureDetector(TapGestureDetector handle) : this(NDalicPINVOKE.new_TapGestureDetector__SWIG_1(TapGestureDetector.getCPtr(handle)), true)
183 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186 public TapGestureDetector Assign(TapGestureDetector rhs)
188 TapGestureDetector ret = new TapGestureDetector(NDalicPINVOKE.TapGestureDetector_Assign(swigCPtr, TapGestureDetector.getCPtr(rhs)), false);
189 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193 public void SetMinimumTapsRequired(uint minimumTaps)
195 NDalicPINVOKE.TapGestureDetector_SetMinimumTapsRequired(swigCPtr, minimumTaps);
196 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
199 public void SetMaximumTapsRequired(uint maximumTaps)
201 NDalicPINVOKE.TapGestureDetector_SetMaximumTapsRequired(swigCPtr, maximumTaps);
202 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
205 public uint GetMinimumTapsRequired()
207 uint ret = NDalicPINVOKE.TapGestureDetector_GetMinimumTapsRequired(swigCPtr);
208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
212 public uint GetMaximumTapsRequired()
214 uint ret = NDalicPINVOKE.TapGestureDetector_GetMaximumTapsRequired(swigCPtr);
215 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219 internal TapGestureDetectedSignal DetectedSignal()
221 TapGestureDetectedSignal ret = new TapGestureDetectedSignal(NDalicPINVOKE.TapGestureDetector_DetectedSignal(swigCPtr), false);
222 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();