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;
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();
49 /// Creates an initialized TapGestureDetector with the specified parameters.
51 /// <param name="tapsRequired">The minimum and maximum number of taps required</param>
52 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
53 [EditorBrowsable(EditorBrowsableState.Never)]
54 public TapGestureDetector(uint tapsRequired) : this(Interop.TapGestureDetector.TapGestureDetector_New__SWIG_1(tapsRequired), true)
56 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
60 internal TapGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.TapGestureDetector.TapGestureDetector_SWIGUpcast(cPtr), cMemoryOwn)
62 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
65 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
66 private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr TapGesture);
69 /// This signal is emitted when the specified tap is detected on the attached view.
71 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 public event DaliEventHandler<object, DetectedEventArgs> Detected
79 // Restricted to only one listener
80 if (_tapGestureEventHandler == null)
82 _tapGestureEventHandler += value;
84 _tapGestureCallbackDelegate = new DetectedCallbackDelegate(OnTapGestureDetected);
85 this.DetectedSignal().Connect(_tapGestureCallbackDelegate);
94 if (_tapGestureEventHandler != null)
96 this.DetectedSignal().Disconnect(_tapGestureCallbackDelegate);
99 _tapGestureEventHandler -= value;
105 /// The copy constructor.
107 /// <param name="handle">A reference to the copied handle</param>
108 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
109 [EditorBrowsable(EditorBrowsableState.Never)]
110 public TapGestureDetector(TapGestureDetector handle) : this(Interop.TapGestureDetector.new_TapGestureDetector__SWIG_1(TapGestureDetector.getCPtr(handle)), true)
112 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116 /// Sets the minimum number of taps required. The tap count is the number of times a user should "tap" the screen.<br />
117 /// The default is 1.<br />
119 /// <param name="minimumTaps">The minimum taps required</param>
120 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
121 [EditorBrowsable(EditorBrowsableState.Never)]
122 public void SetMinimumTapsRequired(uint minimumTaps)
124 Interop.TapGestureDetector.TapGestureDetector_SetMinimumTapsRequired(swigCPtr, minimumTaps);
125 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129 /// Sets the maximum number of taps required. The tap count is the number of times a user should "tap" the screen.<br />
130 /// The default is 1.<br />
132 /// <param name="maximumTaps">The maximum taps required</param>
133 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
134 [EditorBrowsable(EditorBrowsableState.Never)]
135 public void SetMaximumTapsRequired(uint maximumTaps)
137 Interop.TapGestureDetector.TapGestureDetector_SetMaximumTapsRequired(swigCPtr, maximumTaps);
138 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
142 /// Retrieves the minimum number of taps required.
144 /// <returns>The minimum taps required</returns>
145 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
146 [EditorBrowsable(EditorBrowsableState.Never)]
147 public uint GetMinimumTapsRequired()
149 uint ret = Interop.TapGestureDetector.TapGestureDetector_GetMinimumTapsRequired(swigCPtr);
150 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
155 /// Retrieves the maximum number of taps required.
157 /// <returns>The maximum taps required</returns>
158 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
159 [EditorBrowsable(EditorBrowsableState.Never)]
160 public uint GetMaximumTapsRequired()
162 uint ret = Interop.TapGestureDetector.TapGestureDetector_GetMaximumTapsRequired(swigCPtr);
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 internal new static TapGestureDetector DownCast(BaseHandle handle)
169 TapGestureDetector ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TapGestureDetector;
170 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TapGestureDetector obj)
176 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
179 internal static TapGestureDetector GetTapGestureDetectorFromPtr(global::System.IntPtr cPtr)
181 TapGestureDetector ret = new TapGestureDetector(cPtr, false);
182 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186 internal TapGestureDetectedSignal DetectedSignal()
188 TapGestureDetectedSignal ret = new TapGestureDetectedSignal(Interop.TapGestureDetector.TapGestureDetector_DetectedSignal(swigCPtr), false);
189 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193 internal TapGestureDetector Assign(TapGestureDetector rhs)
195 TapGestureDetector ret = new TapGestureDetector(Interop.TapGestureDetector.TapGestureDetector_Assign(swigCPtr, TapGestureDetector.getCPtr(rhs)), false);
196 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203 /// <param name="type">The dispose type</param>
204 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
205 [EditorBrowsable(EditorBrowsableState.Never)]
206 protected override void Dispose(DisposeTypes type)
213 if (type == DisposeTypes.Explicit)
216 //Release your own managed resources here.
217 //You should release all of your own disposable objects here.
221 //Release your own unmanaged resources here.
222 //You should not access any managed member here except static instance.
223 //because the execution order of Finalizes is non-deterministic.
225 if (swigCPtr.Handle != global::System.IntPtr.Zero)
230 Interop.TapGestureDetector.delete_TapGestureDetector(swigCPtr);
232 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
238 private void OnTapGestureDetected(IntPtr actor, IntPtr tapGesture)
240 DetectedEventArgs e = new DetectedEventArgs();
242 // Populate all members of "e" (DetectedEventArgs) with real data
243 e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View;
247 e.View = Registry.GetManagedBaseHandleFromRefObject(actor) as View;
250 e.TapGesture = Tizen.NUI.TapGesture.GetTapGestureFromPtr(tapGesture);
252 if (_tapGestureEventHandler != null)
254 //here we send all data to user event handlers
255 _tapGestureEventHandler(this, e);
261 /// Event arguments that are passed via the TapGestureEvent signal.
263 /// <since_tizen> 5 </since_tizen>
264 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
265 [EditorBrowsable(EditorBrowsableState.Never)]
266 public class DetectedEventArgs : EventArgs
269 private TapGesture _tapGesture;
272 /// The attached view.
274 /// <since_tizen> 5 </since_tizen>
275 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
276 [EditorBrowsable(EditorBrowsableState.Never)]
292 /// <since_tizen> 5 </since_tizen>
293 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
294 [EditorBrowsable(EditorBrowsableState.Never)]
295 public TapGesture TapGesture