2 * Copyright(c) 2018 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;
35 internal TapGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TapGestureDetector_SWIGUpcast(cPtr), cMemoryOwn)
37 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
40 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TapGestureDetector obj)
42 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
48 /// <param name="type">The dispose type</param>
49 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
50 [EditorBrowsable(EditorBrowsableState.Never)]
51 protected override void Dispose(DisposeTypes type)
58 if (type == DisposeTypes.Explicit)
61 //Release your own managed resources here.
62 //You should release all of your own disposable objects here.
66 //Release your own unmanaged resources here.
67 //You should not access any managed member here except static instance.
68 //because the execution order of Finalizes is non-deterministic.
70 if (swigCPtr.Handle != global::System.IntPtr.Zero)
75 NDalicPINVOKE.delete_TapGestureDetector(swigCPtr);
77 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
84 /// Event arguments that are passed via the TapGestureEvent signal.
86 /// <since_tizen> 5 </since_tizen>
87 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
88 [EditorBrowsable(EditorBrowsableState.Never)]
89 public class DetectedEventArgs : EventArgs
92 private TapGesture _tapGesture;
95 /// The attached view.
97 /// <since_tizen> 5 </since_tizen>
98 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
99 [EditorBrowsable(EditorBrowsableState.Never)]
115 /// <since_tizen> 5 </since_tizen>
116 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
117 [EditorBrowsable(EditorBrowsableState.Never)]
118 public TapGesture TapGesture
131 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
132 private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr TapGesture);
133 private DaliEventHandler<object, DetectedEventArgs> _tapGestureEventHandler;
134 private DetectedCallbackDelegate _tapGestureCallbackDelegate;
137 /// This signal is emitted when the specified tap is detected on the attached view.
139 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
140 [EditorBrowsable(EditorBrowsableState.Never)]
141 public event DaliEventHandler<object, DetectedEventArgs> Detected
147 // Restricted to only one listener
148 if (_tapGestureEventHandler == null)
150 _tapGestureEventHandler += value;
152 _tapGestureCallbackDelegate = new DetectedCallbackDelegate(OnTapGestureDetected);
153 this.DetectedSignal().Connect(_tapGestureCallbackDelegate);
162 if (_tapGestureEventHandler != null)
164 this.DetectedSignal().Disconnect(_tapGestureCallbackDelegate);
167 _tapGestureEventHandler -= value;
172 private void OnTapGestureDetected(IntPtr actor, IntPtr tapGesture)
174 DetectedEventArgs e = new DetectedEventArgs();
176 // Populate all members of "e" (DetectedEventArgs) with real data
177 e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View;
178 e.TapGesture = Tizen.NUI.TapGesture.GetTapGestureFromPtr(tapGesture);
180 if (_tapGestureEventHandler != null)
182 //here we send all data to user event handlers
183 _tapGestureEventHandler(this, e);
188 internal static TapGestureDetector GetTapGestureDetectorFromPtr(global::System.IntPtr cPtr)
190 TapGestureDetector ret = new TapGestureDetector(cPtr, false);
191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196 /// Creates an initialized TapGestureDetector.
198 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
199 [EditorBrowsable(EditorBrowsableState.Never)]
200 public TapGestureDetector() : this(NDalicPINVOKE.TapGestureDetector_New__SWIG_0(), true)
202 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
207 /// Creates an initialized TapGestureDetector with the specified parameters.
209 /// <param name="tapsRequired">The minimum & maximum number of taps required</param>
210 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
211 [EditorBrowsable(EditorBrowsableState.Never)]
212 public TapGestureDetector(uint tapsRequired) : this(NDalicPINVOKE.TapGestureDetector_New__SWIG_1(tapsRequired), true)
214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
218 internal new static TapGestureDetector DownCast(BaseHandle handle)
220 TapGestureDetector ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TapGestureDetector;
221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
226 /// The copy constructor.
228 /// <param name="handle">A reference to the copied handle</param>
229 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
230 [EditorBrowsable(EditorBrowsableState.Never)]
231 public TapGestureDetector(TapGestureDetector handle) : this(NDalicPINVOKE.new_TapGestureDetector__SWIG_1(TapGestureDetector.getCPtr(handle)), true)
233 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
236 internal TapGestureDetector Assign(TapGestureDetector rhs)
238 TapGestureDetector ret = new TapGestureDetector(NDalicPINVOKE.TapGestureDetector_Assign(swigCPtr, TapGestureDetector.getCPtr(rhs)), false);
239 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
244 /// Sets the minimum number of taps required. The tap count is the number of times a user should "tap" the screen.<br />
245 /// The default is 1.<br />
247 /// <param name="minimumTaps">The minimum taps required</param>
248 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
249 [EditorBrowsable(EditorBrowsableState.Never)]
250 public void SetMinimumTapsRequired(uint minimumTaps)
252 NDalicPINVOKE.TapGestureDetector_SetMinimumTapsRequired(swigCPtr, minimumTaps);
253 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
257 /// Sets the maximum number of taps required. The tap count is the number of times a user should "tap" the screen.<br />
258 /// The default is 1.<br />
260 /// <param name="maximumTaps">The maximum taps required</param>
261 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
262 [EditorBrowsable(EditorBrowsableState.Never)]
263 public void SetMaximumTapsRequired(uint maximumTaps)
265 NDalicPINVOKE.TapGestureDetector_SetMaximumTapsRequired(swigCPtr, maximumTaps);
266 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
270 /// Retrieves the minimum number of taps required.
272 /// <returns>The minimum taps required</returns>
273 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
274 [EditorBrowsable(EditorBrowsableState.Never)]
275 public uint GetMinimumTapsRequired()
277 uint ret = NDalicPINVOKE.TapGestureDetector_GetMinimumTapsRequired(swigCPtr);
278 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
283 /// Retrieves the maximum number of taps required.
285 /// <returns>The maximum taps required</returns>
286 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
287 [EditorBrowsable(EditorBrowsableState.Never)]
288 public uint GetMaximumTapsRequired()
290 uint ret = NDalicPINVOKE.TapGestureDetector_GetMaximumTapsRequired(swigCPtr);
291 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
295 internal TapGestureDetectedSignal DetectedSignal()
297 TapGestureDetectedSignal ret = new TapGestureDetectedSignal(NDalicPINVOKE.TapGestureDetector_DetectedSignal(swigCPtr), false);
298 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();