1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 using System.Runtime.InteropServices;
22 using Tizen.NUI.BaseComponents;
24 internal class TapGestureDetector : GestureDetector
26 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
28 internal TapGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TapGestureDetector_SWIGUpcast(cPtr), cMemoryOwn)
30 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
33 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TapGestureDetector obj)
35 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
38 protected override void Dispose(DisposeTypes type)
45 if (type == DisposeTypes.Explicit)
48 //Release your own managed resources here.
49 //You should release all of your own disposable objects here.
53 //Release your own unmanaged resources here.
54 //You should not access any managed member here except static instance.
55 //because the execution order of Finalizes is non-deterministic.
57 if (swigCPtr.Handle != global::System.IntPtr.Zero)
62 NDalicPINVOKE.delete_TapGestureDetector(swigCPtr);
64 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
71 public class DetectedEventArgs : EventArgs
74 private TapGesture _tapGesture;
88 public TapGesture TapGesture
101 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
102 private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr TapGesture);
103 private DaliEventHandler<object, DetectedEventArgs> _tapGestureEventHandler;
104 private DetectedCallbackDelegate _tapGestureCallbackDelegate;
107 public event DaliEventHandler<object, DetectedEventArgs> Detected
113 // Restricted to only one listener
114 if (_tapGestureEventHandler == null)
116 _tapGestureEventHandler += value;
118 _tapGestureCallbackDelegate = new DetectedCallbackDelegate(OnTapGestureDetected);
119 this.DetectedSignal().Connect(_tapGestureCallbackDelegate);
128 if (_tapGestureEventHandler != null)
130 this.DetectedSignal().Disconnect(_tapGestureCallbackDelegate);
133 _tapGestureEventHandler -= value;
138 private void OnTapGestureDetected(IntPtr actor, IntPtr tapGesture)
140 DetectedEventArgs e = new DetectedEventArgs();
142 // Populate all members of "e" (DetectedEventArgs) with real data
143 e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View;
144 e.TapGesture = Tizen.NUI.TapGesture.GetTapGestureFromPtr(tapGesture);
146 if (_tapGestureEventHandler != null)
148 //here we send all data to user event handlers
149 _tapGestureEventHandler(this, e);
155 public static TapGestureDetector GetTapGestureDetectorFromPtr(global::System.IntPtr cPtr)
157 TapGestureDetector ret = new TapGestureDetector(cPtr, false);
158 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163 public TapGestureDetector() : this(NDalicPINVOKE.TapGestureDetector_New__SWIG_0(), true)
165 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 public TapGestureDetector(uint tapsRequired) : this(NDalicPINVOKE.TapGestureDetector_New__SWIG_1(tapsRequired), true)
170 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
173 public new static TapGestureDetector DownCast(BaseHandle handle)
175 TapGestureDetector ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TapGestureDetector;
176 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180 public TapGestureDetector(TapGestureDetector handle) : this(NDalicPINVOKE.new_TapGestureDetector__SWIG_1(TapGestureDetector.getCPtr(handle)), true)
182 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185 public TapGestureDetector Assign(TapGestureDetector rhs)
187 TapGestureDetector ret = new TapGestureDetector(NDalicPINVOKE.TapGestureDetector_Assign(swigCPtr, TapGestureDetector.getCPtr(rhs)), false);
188 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192 public void SetMinimumTapsRequired(uint minimumTaps)
194 NDalicPINVOKE.TapGestureDetector_SetMinimumTapsRequired(swigCPtr, minimumTaps);
195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198 public void SetMaximumTapsRequired(uint maximumTaps)
200 NDalicPINVOKE.TapGestureDetector_SetMaximumTapsRequired(swigCPtr, maximumTaps);
201 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204 public uint GetMinimumTapsRequired()
206 uint ret = NDalicPINVOKE.TapGestureDetector_GetMinimumTapsRequired(swigCPtr);
207 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211 public uint GetMaximumTapsRequired()
213 uint ret = NDalicPINVOKE.TapGestureDetector_GetMaximumTapsRequired(swigCPtr);
214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
218 internal TapGestureDetectedSignal DetectedSignal()
220 TapGestureDetectedSignal ret = new TapGestureDetectedSignal(NDalicPINVOKE.TapGestureDetector_DetectedSignal(swigCPtr), false);
221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();