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;
32 public class LongPressGestureDetector : GestureDetector {
33 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
35 internal LongPressGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.LongPressGestureDetector_SWIGUpcast(cPtr), cMemoryOwn) {
36 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
39 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LongPressGestureDetector obj) {
40 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
43 ~LongPressGestureDetector() {
44 DisposeQueue.Instance.Add(this);
47 public override void Dispose() {
48 if (!Stage.IsInstalled()) {
49 DisposeQueue.Instance.Add(this);
54 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
57 NDalicPINVOKE.delete_LongPressGestureDetector(swigCPtr);
59 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
61 global::System.GC.SuppressFinalize(this);
69 public class DetectedEventArgs : EventArgs
72 private LongPressGesture _longPressGesture;
86 public LongPressGesture LongPressGesture
90 return _longPressGesture;
94 _longPressGesture = value;
99 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
100 private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr longPressGesture);
101 private DaliEventHandler<object,DetectedEventArgs> _longPressGestureEventHandler;
102 private DetectedCallbackDelegate _longPressGestureCallbackDelegate;
105 public event DaliEventHandler<object,DetectedEventArgs> Detected
111 // Restricted to only one listener
112 if (_longPressGestureEventHandler == null)
114 _longPressGestureEventHandler += value;
116 _longPressGestureCallbackDelegate = new DetectedCallbackDelegate(OnLongPressGestureDetected);
117 this.DetectedSignal().Connect(_longPressGestureCallbackDelegate);
126 if (_longPressGestureEventHandler != null)
128 this.DetectedSignal().Disconnect(_longPressGestureCallbackDelegate);
131 _longPressGestureEventHandler -= value;
136 private void OnLongPressGestureDetected(IntPtr actor, IntPtr longPressGesture)
138 DetectedEventArgs e = new DetectedEventArgs();
140 // Populate all members of "e" (LongPressGestureEventArgs) with real data
141 e.Actor = Actor.GetActorFromPtr(actor);
142 e.LongPressGesture = NUI.LongPressGesture.GetLongPressGestureFromPtr(longPressGesture);
144 if (_longPressGestureEventHandler != null)
146 //here we send all data to user event handlers
147 _longPressGestureEventHandler(this, e);
153 public static LongPressGestureDetector GetLongPressGestureDetectorFromPtr(global::System.IntPtr cPtr) {
154 LongPressGestureDetector ret = new LongPressGestureDetector(cPtr, false);
155 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
160 public LongPressGestureDetector () : this (NDalicPINVOKE.LongPressGestureDetector_New__SWIG_0(), true) {
161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164 public LongPressGestureDetector (uint touchesRequired) : this (NDalicPINVOKE.LongPressGestureDetector_New__SWIG_1(touchesRequired), true) {
165 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 public LongPressGestureDetector (uint minTouches, uint maxTouches) : this (NDalicPINVOKE.LongPressGestureDetector_New__SWIG_2(minTouches, maxTouches), true) {
169 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172 public new static LongPressGestureDetector DownCast(BaseHandle handle) {
173 LongPressGestureDetector ret = new LongPressGestureDetector(NDalicPINVOKE.LongPressGestureDetector_DownCast(BaseHandle.getCPtr(handle)), true);
174 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178 public LongPressGestureDetector(LongPressGestureDetector handle) : this(NDalicPINVOKE.new_LongPressGestureDetector__SWIG_1(LongPressGestureDetector.getCPtr(handle)), true) {
179 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
182 public LongPressGestureDetector Assign(LongPressGestureDetector rhs) {
183 LongPressGestureDetector ret = new LongPressGestureDetector(NDalicPINVOKE.LongPressGestureDetector_Assign(swigCPtr, LongPressGestureDetector.getCPtr(rhs)), false);
184 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
188 public void SetTouchesRequired(uint touches) {
189 NDalicPINVOKE.LongPressGestureDetector_SetTouchesRequired__SWIG_0(swigCPtr, touches);
190 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193 public void SetTouchesRequired(uint minTouches, uint maxTouches) {
194 NDalicPINVOKE.LongPressGestureDetector_SetTouchesRequired__SWIG_1(swigCPtr, minTouches, maxTouches);
195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198 public uint GetMinimumTouchesRequired() {
199 uint ret = NDalicPINVOKE.LongPressGestureDetector_GetMinimumTouchesRequired(swigCPtr);
200 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204 public uint GetMaximumTouchesRequired() {
205 uint ret = NDalicPINVOKE.LongPressGestureDetector_GetMaximumTouchesRequired(swigCPtr);
206 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210 public LongPressGestureDetectedSignal DetectedSignal() {
211 LongPressGestureDetectedSignal ret = new LongPressGestureDetectedSignal(NDalicPINVOKE.LongPressGestureDetector_DetectedSignal(swigCPtr), false);
212 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();