Merge "fixup! DALi C# binding - Generic Delegates support for EventHandlers" into...
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / automatic / csharp / TapGestureDetector.cs
1 /** Copyright (c) 2016 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 Dali {
28
29 using System;
30 using System.Runtime.InteropServices;
31
32 public class TapGestureDetector : GestureDetector {
33   private global::System.Runtime.InteropServices.HandleRef swigCPtr;
34
35   internal TapGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TapGestureDetector_SWIGUpcast(cPtr), cMemoryOwn) {
36     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
37   }
38
39   internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TapGestureDetector obj) {
40     return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
41   }
42
43   ~TapGestureDetector() {
44     Dispose();
45   }
46
47   public override void Dispose() {
48     lock(this) {
49       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
50         if (swigCMemOwn) {
51           swigCMemOwn = false;
52           NDalicPINVOKE.delete_TapGestureDetector(swigCPtr);
53         }
54         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
55       }
56       global::System.GC.SuppressFinalize(this);
57       base.Dispose();
58     }
59   }
60
61
62
63 public class DetectedEventArgs : EventArgs
64 {
65    private Actor _actor;
66    private TapGesture _tapGesture;
67
68    public Actor Actor
69    {
70       get
71       {
72          return _actor;
73       }
74       set
75       {
76          _actor = value;
77       }
78    }
79
80    public TapGesture TapGesture
81    {
82       get
83       {
84          return _tapGesture;
85       }
86       set
87       {
88          _tapGesture = value;
89       }
90    }
91 }
92
93   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
94   private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr TapGesture);
95   private DaliEventHandler<object,DetectedEventArgs> _tapGestureEventHandler;
96   private DetectedCallbackDelegate _tapGestureCallbackDelegate;
97
98
99   public event DaliEventHandler<object,DetectedEventArgs> Detected
100   {
101      add
102      {
103         lock(this)
104         {
105            // Restricted to only one listener
106            if (_tapGestureEventHandler == null)
107            {
108               _tapGestureEventHandler += value;
109
110               _tapGestureCallbackDelegate = new DetectedCallbackDelegate(OnTapGestureDetected);
111               this.DetectedSignal().Connect(_tapGestureCallbackDelegate);
112            }
113         }
114      }
115
116      remove
117      {
118         lock(this)
119         {
120            if (_tapGestureEventHandler != null)
121            {
122               this.DetectedSignal().Disconnect(_tapGestureCallbackDelegate);
123            }
124
125            _tapGestureEventHandler -= value;
126         }
127      }
128   }
129
130  private void OnTapGestureDetected(IntPtr actor, IntPtr tapGesture)
131   {
132    DetectedEventArgs e = new DetectedEventArgs();
133
134    // Populate all members of "e" (DetectedEventArgs) with real data
135    e.Actor = Actor.GetActorFromPtr(actor);
136    e.TapGesture = Dali.TapGesture.GetTapGestureFromPtr(tapGesture);
137
138    if (_tapGestureEventHandler != null)
139    {
140       //here we send all data to user event handlers
141       _tapGestureEventHandler(this, e);
142    }
143
144   }
145
146
147 public static TapGestureDetector GetTapGestureDetectorFromPtr(global::System.IntPtr cPtr) {
148     TapGestureDetector ret = new TapGestureDetector(cPtr, false);
149    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150     return ret;
151   }
152
153
154   public TapGestureDetector () : this (NDalicPINVOKE.TapGestureDetector_New__SWIG_0(), true) {
155       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156
157   }
158   public TapGestureDetector (uint tapsRequired) : this (NDalicPINVOKE.TapGestureDetector_New__SWIG_1(tapsRequired), true) {
159       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
160
161   }
162   public new static TapGestureDetector DownCast(BaseHandle handle) {
163     TapGestureDetector ret = new TapGestureDetector(NDalicPINVOKE.TapGestureDetector_DownCast(BaseHandle.getCPtr(handle)), true);
164     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165     return ret;
166   }
167
168   public TapGestureDetector(TapGestureDetector handle) : this(NDalicPINVOKE.new_TapGestureDetector__SWIG_1(TapGestureDetector.getCPtr(handle)), true) {
169     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170   }
171
172   public TapGestureDetector Assign(TapGestureDetector rhs) {
173     TapGestureDetector ret = new TapGestureDetector(NDalicPINVOKE.TapGestureDetector_Assign(swigCPtr, TapGestureDetector.getCPtr(rhs)), false);
174     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
175     return ret;
176   }
177
178   public void SetMinimumTapsRequired(uint minimumTaps) {
179     NDalicPINVOKE.TapGestureDetector_SetMinimumTapsRequired(swigCPtr, minimumTaps);
180     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181   }
182
183   public void SetMaximumTapsRequired(uint maximumTaps) {
184     NDalicPINVOKE.TapGestureDetector_SetMaximumTapsRequired(swigCPtr, maximumTaps);
185     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186   }
187
188   public uint GetMinimumTapsRequired() {
189     uint ret = NDalicPINVOKE.TapGestureDetector_GetMinimumTapsRequired(swigCPtr);
190     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
191     return ret;
192   }
193
194   public uint GetMaximumTapsRequired() {
195     uint ret = NDalicPINVOKE.TapGestureDetector_GetMaximumTapsRequired(swigCPtr);
196     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197     return ret;
198   }
199
200   public TapGestureDetectedSignal DetectedSignal() {
201     TapGestureDetectedSignal ret = new TapGestureDetectedSignal(NDalicPINVOKE.TapGestureDetector_DetectedSignal(swigCPtr), false);
202     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203     return ret;
204   }
205
206 }
207
208 }