manual nui merge 0.2.38
[platform/core/csapi/nui.git] / Tizen.NUI / src / internal / TapGestureDetector.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
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
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
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.
14 *
15 */
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
18 // <auto-generated />
19 //
20 // This file was automatically generated by SWIG (http://www.swig.org).
21 // Version 3.0.9
22 //
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
26
27 namespace Tizen.NUI {
28
29 using System;
30 using System.Runtime.InteropServices;\r
31     using Tizen.NUI.BaseComponents;
32
33 public class TapGestureDetector : GestureDetector {
34   private global::System.Runtime.InteropServices.HandleRef swigCPtr;
35
36   internal TapGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TapGestureDetector_SWIGUpcast(cPtr), cMemoryOwn) {
37     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
38   }
39
40   internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TapGestureDetector obj) {
41     return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
42   }
43
44   public override void Dispose() {
45     if (!Window.IsInstalled()) {
46       DisposeQueue.Instance.Add(this);
47       return;
48     }
49
50     lock(this) {
51       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
52         if (swigCMemOwn) {
53           swigCMemOwn = false;
54           NDalicPINVOKE.delete_TapGestureDetector(swigCPtr);
55         }
56         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
57       }
58       global::System.GC.SuppressFinalize(this);
59       base.Dispose();
60     }
61   }
62
63
64
65
66 public class DetectedEventArgs : EventArgs
67 {
68    private View _view;
69    private TapGesture _tapGesture;
70
71    public View View\r
72             {
73       get
74       {
75          return _view;
76       }
77       set
78       {
79          _view = value;
80       }
81    }
82
83    public TapGesture TapGesture
84    {
85       get
86       {
87          return _tapGesture;
88       }
89       set
90       {
91          _tapGesture = value;
92       }
93    }
94 }
95
96   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
97   private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr TapGesture);
98   private DaliEventHandler<object,DetectedEventArgs> _tapGestureEventHandler;
99   private DetectedCallbackDelegate _tapGestureCallbackDelegate;
100
101
102   public event DaliEventHandler<object,DetectedEventArgs> Detected
103   {
104      add
105      {
106         lock(this)
107         {
108            // Restricted to only one listener
109            if (_tapGestureEventHandler == null)
110            {
111               _tapGestureEventHandler += value;
112
113               _tapGestureCallbackDelegate = new DetectedCallbackDelegate(OnTapGestureDetected);
114               this.DetectedSignal().Connect(_tapGestureCallbackDelegate);
115            }
116         }
117      }
118
119      remove
120      {
121         lock(this)
122         {
123            if (_tapGestureEventHandler != null)
124            {
125               this.DetectedSignal().Disconnect(_tapGestureCallbackDelegate);
126            }
127
128            _tapGestureEventHandler -= value;
129         }
130      }
131   }
132
133  private void OnTapGestureDetected(IntPtr actor, IntPtr tapGesture)
134   {
135    DetectedEventArgs e = new DetectedEventArgs();
136
137    // Populate all members of "e" (DetectedEventArgs) with real data
138    e.View = View.GetViewFromPtr(actor);
139    e.TapGesture = Tizen.NUI.TapGesture.GetTapGestureFromPtr(tapGesture);
140
141    if (_tapGestureEventHandler != null)
142    {
143       //here we send all data to user event handlers
144       _tapGestureEventHandler(this, e);
145    }
146
147   }
148
149
150 public static TapGestureDetector GetTapGestureDetectorFromPtr(global::System.IntPtr cPtr) {
151     TapGestureDetector ret = new TapGestureDetector(cPtr, false);
152     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153     return ret;
154   }
155
156
157   public TapGestureDetector () : this (NDalicPINVOKE.TapGestureDetector_New__SWIG_0(), true) {
158       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159
160   }
161   public TapGestureDetector (uint tapsRequired) : this (NDalicPINVOKE.TapGestureDetector_New__SWIG_1(tapsRequired), true) {
162       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163
164   }
165   public new static TapGestureDetector DownCast(BaseHandle handle) {
166     TapGestureDetector ret = new TapGestureDetector(NDalicPINVOKE.TapGestureDetector_DownCast(BaseHandle.getCPtr(handle)), true);
167     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168     return ret;
169   }
170
171   public TapGestureDetector(TapGestureDetector handle) : this(NDalicPINVOKE.new_TapGestureDetector__SWIG_1(TapGestureDetector.getCPtr(handle)), true) {
172     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
173   }
174
175   public TapGestureDetector Assign(TapGestureDetector rhs) {
176     TapGestureDetector ret = new TapGestureDetector(NDalicPINVOKE.TapGestureDetector_Assign(swigCPtr, TapGestureDetector.getCPtr(rhs)), false);
177     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178     return ret;
179   }
180
181   public void SetMinimumTapsRequired(uint minimumTaps) {
182     NDalicPINVOKE.TapGestureDetector_SetMinimumTapsRequired(swigCPtr, minimumTaps);
183     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
184   }
185
186   public void SetMaximumTapsRequired(uint maximumTaps) {
187     NDalicPINVOKE.TapGestureDetector_SetMaximumTapsRequired(swigCPtr, maximumTaps);
188     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189   }
190
191   public uint GetMinimumTapsRequired() {
192     uint ret = NDalicPINVOKE.TapGestureDetector_GetMinimumTapsRequired(swigCPtr);
193     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194     return ret;
195   }
196
197   public uint GetMaximumTapsRequired() {
198     uint ret = NDalicPINVOKE.TapGestureDetector_GetMaximumTapsRequired(swigCPtr);
199     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200     return ret;
201   }
202
203   internal TapGestureDetectedSignal DetectedSignal() {
204     TapGestureDetectedSignal ret = new TapGestureDetectedSignal(NDalicPINVOKE.TapGestureDetector_DetectedSignal(swigCPtr), false);
205     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
206     return ret;
207   }
208
209 }
210
211 }