DALi C# Tizen GBS build:
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / automatic / csharp / PinchGestureDetector.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
33 public class PinchGestureDetector : GestureDetector {
34   private global::System.Runtime.InteropServices.HandleRef swigCPtr;
35
36   internal PinchGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PinchGestureDetector_SWIGUpcast(cPtr), cMemoryOwn) {
37     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
38   }
39
40   internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PinchGestureDetector obj) {
41     return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
42   }
43
44   ~PinchGestureDetector() {
45     Dispose();
46   }
47
48   public override void Dispose() {
49     lock(this) {
50       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
51         if (swigCMemOwn) {
52           swigCMemOwn = false;
53           NDalicPINVOKE.delete_PinchGestureDetector(swigCPtr);
54         }
55         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
56       }
57       global::System.GC.SuppressFinalize(this);
58       base.Dispose();
59     }
60   }
61
62
63 public class DetectedEventArgs : EventArgs
64 {
65    private Actor _actor;
66    private PinchGesture _pinchGesture;
67
68    public Actor Actor
69    {
70       get
71       {
72          return _actor;
73       }
74       set
75       {
76          _actor = value;
77       }
78    }
79
80    public PinchGesture PinchGesture
81    {
82       get
83       {
84          return _pinchGesture;
85       }
86       set
87       {
88          _pinchGesture = value;
89       }
90    }
91 }
92
93   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
94   private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr pinchGesture);
95   private DaliEventHandler<object,DetectedEventArgs> _pinchGestureEventHandler;
96   private DetectedCallbackDelegate _pinchGestureCallbackDelegate;
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 (_pinchGestureEventHandler == null)
107            {
108               _pinchGestureEventHandler += value;
109
110               _pinchGestureCallbackDelegate = new DetectedCallbackDelegate(OnPinchGestureDetected);
111               this.DetectedSignal().Connect(_pinchGestureCallbackDelegate);
112            }
113         }
114      }
115
116      remove
117      {
118         lock(this)
119         {
120            if (_pinchGestureEventHandler != null)
121            {
122               this.DetectedSignal().Disconnect(_pinchGestureCallbackDelegate);
123            }
124
125            _pinchGestureEventHandler -= value;
126         }
127      }
128   }
129
130  private void OnPinchGestureDetected(IntPtr actor, IntPtr pinchGesture)
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.PinchGesture = Dali.PinchGesture.GetPinchGestureFromPtr(pinchGesture);
137
138    if (_pinchGestureEventHandler != null)
139    {
140       //here we send all data to user event handlers
141       _pinchGestureEventHandler(this, e);
142    }
143
144   }
145
146
147 public static PinchGestureDetector GetPinchGestureDetectorFromPtr(global::System.IntPtr cPtr) {
148     PinchGestureDetector ret = new PinchGestureDetector(cPtr, false);
149    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150     return ret;
151   }
152
153
154   public PinchGestureDetector () : this (NDalicPINVOKE.PinchGestureDetector_New(), true) {
155       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156
157   }
158   public new static PinchGestureDetector DownCast(BaseHandle handle) {
159     PinchGestureDetector ret = new PinchGestureDetector(NDalicPINVOKE.PinchGestureDetector_DownCast(BaseHandle.getCPtr(handle)), true);
160     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161     return ret;
162   }
163
164   public PinchGestureDetector(PinchGestureDetector handle) : this(NDalicPINVOKE.new_PinchGestureDetector__SWIG_1(PinchGestureDetector.getCPtr(handle)), true) {
165     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166   }
167
168   public PinchGestureDetector Assign(PinchGestureDetector rhs) {
169     PinchGestureDetector ret = new PinchGestureDetector(NDalicPINVOKE.PinchGestureDetector_Assign(swigCPtr, PinchGestureDetector.getCPtr(rhs)), false);
170     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171     return ret;
172   }
173
174   public PinchGestureDetectedSignal DetectedSignal() {
175     PinchGestureDetectedSignal ret = new PinchGestureDetectedSignal(NDalicPINVOKE.PinchGestureDetector_DetectedSignal(swigCPtr), false);
176     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177     return ret;
178   }
179
180 }
181
182 }