2 * Copyright(c) 2019 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.
18 using System.Runtime.InteropServices;
19 using Tizen.NUI.BaseComponents;
20 using System.ComponentModel;
26 /// This class emits a signal when a tap gesture occurs that meets the requirements set by the application.<br />
27 /// A TapGesture is a discrete gesture, which means it does not have any state information attached.<br />
29 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
30 [EditorBrowsable(EditorBrowsableState.Never)]
31 public class TapGestureDetector : GestureDetector
33 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
34 private DaliEventHandler<object, DetectedEventArgs> _tapGestureEventHandler;
35 private DetectedCallbackDelegate _tapGestureCallbackDelegate;
38 /// Creates an initialized TapGestureDetector.
40 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
41 [EditorBrowsable(EditorBrowsableState.Never)]
42 public TapGestureDetector() : this(Interop.TapGestureDetector.TapGestureDetector_New__SWIG_0(), true)
44 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
48 /// Creates an initialized TapGestureDetector with the specified parameters.
50 /// <param name="tapsRequired">The minimum and maximum number of taps required</param>
51 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
52 [EditorBrowsable(EditorBrowsableState.Never)]
53 public TapGestureDetector(uint tapsRequired) : this(Interop.TapGestureDetector.TapGestureDetector_New__SWIG_1(tapsRequired), true)
55 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
59 internal TapGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.TapGestureDetector.TapGestureDetector_SWIGUpcast(cPtr), cMemoryOwn)
61 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
64 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
65 private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr TapGesture);
68 /// This signal is emitted when the specified tap is detected on the attached view.
70 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
71 [EditorBrowsable(EditorBrowsableState.Never)]
72 public event DaliEventHandler<object, DetectedEventArgs> Detected
78 // Restricted to only one listener
79 if (_tapGestureEventHandler == null)
81 _tapGestureEventHandler += value;
83 _tapGestureCallbackDelegate = new DetectedCallbackDelegate(OnTapGestureDetected);
84 this.DetectedSignal().Connect(_tapGestureCallbackDelegate);
93 if (_tapGestureEventHandler != null)
95 this.DetectedSignal().Disconnect(_tapGestureCallbackDelegate);
98 _tapGestureEventHandler -= value;
104 /// The copy constructor.
106 /// <param name="handle">A reference to the copied handle</param>
107 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
108 [EditorBrowsable(EditorBrowsableState.Never)]
109 public TapGestureDetector(TapGestureDetector handle) : this(Interop.TapGestureDetector.new_TapGestureDetector__SWIG_1(TapGestureDetector.getCPtr(handle)), true)
111 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
115 /// Sets the minimum number of taps required. The tap count is the number of times a user should "tap" the screen.<br />
116 /// The default is 1.<br />
118 /// <param name="minimumTaps">The minimum taps required</param>
119 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
120 [EditorBrowsable(EditorBrowsableState.Never)]
121 public void SetMinimumTapsRequired(uint minimumTaps)
123 Interop.TapGestureDetector.TapGestureDetector_SetMinimumTapsRequired(swigCPtr, minimumTaps);
124 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
128 /// Sets the maximum number of taps required. The tap count is the number of times a user should "tap" the screen.<br />
129 /// The default is 1.<br />
131 /// <param name="maximumTaps">The maximum taps required</param>
132 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
133 [EditorBrowsable(EditorBrowsableState.Never)]
134 public void SetMaximumTapsRequired(uint maximumTaps)
136 Interop.TapGestureDetector.TapGestureDetector_SetMaximumTapsRequired(swigCPtr, maximumTaps);
137 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141 /// Retrieves the minimum number of taps required.
143 /// <returns>The minimum taps required</returns>
144 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
145 [EditorBrowsable(EditorBrowsableState.Never)]
146 public uint GetMinimumTapsRequired()
148 uint ret = Interop.TapGestureDetector.TapGestureDetector_GetMinimumTapsRequired(swigCPtr);
149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154 /// Retrieves the maximum number of taps required.
156 /// <returns>The maximum taps required</returns>
157 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
158 [EditorBrowsable(EditorBrowsableState.Never)]
159 public uint GetMaximumTapsRequired()
161 uint ret = Interop.TapGestureDetector.TapGestureDetector_GetMaximumTapsRequired(swigCPtr);
162 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166 internal new static TapGestureDetector DownCast(BaseHandle handle)
168 TapGestureDetector ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TapGestureDetector;
169 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
173 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TapGestureDetector obj)
175 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
178 internal static TapGestureDetector GetTapGestureDetectorFromPtr(global::System.IntPtr cPtr)
180 TapGestureDetector ret = new TapGestureDetector(cPtr, false);
181 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185 internal TapGestureDetectedSignal DetectedSignal()
187 TapGestureDetectedSignal ret = new TapGestureDetectedSignal(Interop.TapGestureDetector.TapGestureDetector_DetectedSignal(swigCPtr), false);
188 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192 internal TapGestureDetector Assign(TapGestureDetector rhs)
194 TapGestureDetector ret = new TapGestureDetector(Interop.TapGestureDetector.TapGestureDetector_Assign(swigCPtr, TapGestureDetector.getCPtr(rhs)), false);
195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202 /// <param name="type">The dispose type</param>
203 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
204 [EditorBrowsable(EditorBrowsableState.Never)]
205 protected override void Dispose(DisposeTypes type)
212 //Release your own unmanaged resources here.
213 //You should not access any managed member here except static instance.
214 //because the execution order of Finalizes is non-deterministic.
216 if (swigCPtr.Handle != global::System.IntPtr.Zero)
221 Interop.TapGestureDetector.delete_TapGestureDetector(swigCPtr);
223 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
229 private void OnTapGestureDetected(IntPtr actor, IntPtr tapGesture)
231 DetectedEventArgs e = new DetectedEventArgs();
233 // Populate all members of "e" (DetectedEventArgs) with real data
234 e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View;
238 e.View = Registry.GetManagedBaseHandleFromRefObject(actor) as View;
241 e.TapGesture = Tizen.NUI.TapGesture.GetTapGestureFromPtr(tapGesture);
243 if (_tapGestureEventHandler != null)
245 //here we send all data to user event handlers
246 _tapGestureEventHandler(this, e);
251 /// Event arguments that are passed via the TapGestureEvent signal.
253 /// <since_tizen> 5 </since_tizen>
254 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
255 [EditorBrowsable(EditorBrowsableState.Never)]
256 public class DetectedEventArgs : EventArgs
259 private TapGesture _tapGesture;
262 /// The attached view.
264 /// <since_tizen> 5 </since_tizen>
265 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
266 [EditorBrowsable(EditorBrowsableState.Never)]
282 /// <since_tizen> 5 </since_tizen>
283 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
284 [EditorBrowsable(EditorBrowsableState.Never)]
285 public TapGesture TapGesture