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.
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
20 // This file was automatically generated by SWIG (http://www.swig.org).
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
30 using System.Runtime.InteropServices;
\r
31 using Tizen.NUI.BaseComponents;
33 public class LongPressGestureDetector : GestureDetector {
34 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
36 internal LongPressGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.LongPressGestureDetector_SWIGUpcast(cPtr), cMemoryOwn) {
37 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
40 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LongPressGestureDetector obj) {
41 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
44 public override void Dispose() {
45 if (!Window.IsInstalled()) {
46 DisposeQueue.Instance.Add(this);
51 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
54 NDalicPINVOKE.delete_LongPressGestureDetector(swigCPtr);
56 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
58 global::System.GC.SuppressFinalize(this);
66 public class DetectedEventArgs : EventArgs
69 private LongPressGesture _longPressGesture;
83 public LongPressGesture LongPressGesture
87 return _longPressGesture;
91 _longPressGesture = value;
96 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
97 private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr longPressGesture);
98 private DaliEventHandler<object,DetectedEventArgs> _longPressGestureEventHandler;
99 private DetectedCallbackDelegate _longPressGestureCallbackDelegate;
102 public event DaliEventHandler<object,DetectedEventArgs> Detected
108 // Restricted to only one listener
109 if (_longPressGestureEventHandler == null)
111 _longPressGestureEventHandler += value;
113 _longPressGestureCallbackDelegate = new DetectedCallbackDelegate(OnLongPressGestureDetected);
114 this.DetectedSignal().Connect(_longPressGestureCallbackDelegate);
123 if (_longPressGestureEventHandler != null)
125 this.DetectedSignal().Disconnect(_longPressGestureCallbackDelegate);
128 _longPressGestureEventHandler -= value;
133 private void OnLongPressGestureDetected(IntPtr actor, IntPtr longPressGesture)
135 DetectedEventArgs e = new DetectedEventArgs();
137 // Populate all members of "e" (LongPressGestureEventArgs) with real data
138 e.View = View.GetViewFromPtr(actor);
139 e.LongPressGesture = Tizen.NUI.LongPressGesture.GetLongPressGestureFromPtr(longPressGesture);
141 if (_longPressGestureEventHandler != null)
143 //here we send all data to user event handlers
144 _longPressGestureEventHandler(this, e);
150 public static LongPressGestureDetector GetLongPressGestureDetectorFromPtr(global::System.IntPtr cPtr) {
151 LongPressGestureDetector ret = new LongPressGestureDetector(cPtr, false);
152 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157 public LongPressGestureDetector () : this (NDalicPINVOKE.LongPressGestureDetector_New__SWIG_0(), true) {
158 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161 public LongPressGestureDetector (uint touchesRequired) : this (NDalicPINVOKE.LongPressGestureDetector_New__SWIG_1(touchesRequired), true) {
162 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165 public LongPressGestureDetector (uint minTouches, uint maxTouches) : this (NDalicPINVOKE.LongPressGestureDetector_New__SWIG_2(minTouches, maxTouches), true) {
166 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169 public new static LongPressGestureDetector DownCast(BaseHandle handle) {
170 LongPressGestureDetector ret = new LongPressGestureDetector(NDalicPINVOKE.LongPressGestureDetector_DownCast(BaseHandle.getCPtr(handle)), true);
171 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
175 public LongPressGestureDetector(LongPressGestureDetector handle) : this(NDalicPINVOKE.new_LongPressGestureDetector__SWIG_1(LongPressGestureDetector.getCPtr(handle)), true) {
176 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179 public LongPressGestureDetector Assign(LongPressGestureDetector rhs) {
180 LongPressGestureDetector ret = new LongPressGestureDetector(NDalicPINVOKE.LongPressGestureDetector_Assign(swigCPtr, LongPressGestureDetector.getCPtr(rhs)), false);
181 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185 public void SetTouchesRequired(uint touches) {
186 NDalicPINVOKE.LongPressGestureDetector_SetTouchesRequired__SWIG_0(swigCPtr, touches);
187 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190 public void SetTouchesRequired(uint minTouches, uint maxTouches) {
191 NDalicPINVOKE.LongPressGestureDetector_SetTouchesRequired__SWIG_1(swigCPtr, minTouches, maxTouches);
192 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195 public uint GetMinimumTouchesRequired() {
196 uint ret = NDalicPINVOKE.LongPressGestureDetector_GetMinimumTouchesRequired(swigCPtr);
197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
201 public uint GetMaximumTouchesRequired() {
202 uint ret = NDalicPINVOKE.LongPressGestureDetector_GetMaximumTouchesRequired(swigCPtr);
203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
207 internal LongPressGestureDetectedSignal DetectedSignal() {
208 LongPressGestureDetectedSignal ret = new LongPressGestureDetectedSignal(NDalicPINVOKE.LongPressGestureDetector_DetectedSignal(swigCPtr), false);
209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();