merging dali-sharp class scope with nui
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / PinchGestureDetector.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
30     using System;
31     using System.Runtime.InteropServices;
32     using Tizen.NUI.BaseComponents;
33
34
35     internal class PinchGestureDetector : GestureDetector
36     {
37         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
38
39         internal PinchGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PinchGestureDetector_SWIGUpcast(cPtr), cMemoryOwn)
40         {
41             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
42         }
43
44         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PinchGestureDetector obj)
45         {
46             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
47         }
48
49
50         protected override void Dispose(DisposeTypes type)
51         {
52             if (disposed)
53             {
54                 return;
55             }
56
57             if (type == DisposeTypes.Explicit)
58             {
59                 //Called by User
60                 //Release your own managed resources here.
61                 //You should release all of your own disposable objects here.
62
63             }
64
65             //Release your own unmanaged resources here.
66             //You should not access any managed member here except static instance.
67             //because the execution order of Finalizes is non-deterministic.
68
69
70             if (swigCPtr.Handle != global::System.IntPtr.Zero)
71             {
72                 if (swigCMemOwn)
73                 {
74                     swigCMemOwn = false;
75                     NDalicPINVOKE.delete_PinchGestureDetector(swigCPtr);
76                 }
77                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
78             }
79
80             base.Dispose(type);
81         }
82
83
84         public class DetectedEventArgs : EventArgs
85         {
86             private View _view;
87             private PinchGesture _pinchGesture;
88
89             public View View
90             {
91                 get
92                 {
93                     return _view;
94                 }
95                 set
96                 {
97                     _view = value;
98                 }
99             }
100
101             public PinchGesture PinchGesture
102             {
103                 get
104                 {
105                     return _pinchGesture;
106                 }
107                 set
108                 {
109                     _pinchGesture = value;
110                 }
111             }
112         }
113
114         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
115         private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr pinchGesture);
116         private DaliEventHandler<object, DetectedEventArgs> _pinchGestureEventHandler;
117         private DetectedCallbackDelegate _pinchGestureCallbackDelegate;
118
119
120         public event DaliEventHandler<object, DetectedEventArgs> Detected
121         {
122             add
123             {
124                 lock (this)
125                 {
126                     // Restricted to only one listener
127                     if (_pinchGestureEventHandler == null)
128                     {
129                         _pinchGestureEventHandler += value;
130
131                         _pinchGestureCallbackDelegate = new DetectedCallbackDelegate(OnPinchGestureDetected);
132                         this.DetectedSignal().Connect(_pinchGestureCallbackDelegate);
133                     }
134                 }
135             }
136
137             remove
138             {
139                 lock (this)
140                 {
141                     if (_pinchGestureEventHandler != null)
142                     {
143                         this.DetectedSignal().Disconnect(_pinchGestureCallbackDelegate);
144                     }
145
146                     _pinchGestureEventHandler -= value;
147                 }
148             }
149         }
150
151         private void OnPinchGestureDetected(IntPtr actor, IntPtr pinchGesture)
152         {
153             DetectedEventArgs e = new DetectedEventArgs();
154
155             // Populate all members of "e" (DetectedEventArgs) with real data
156             e.View = View.GetViewFromPtr(actor);
157             e.PinchGesture = Tizen.NUI.PinchGesture.GetPinchGestureFromPtr(pinchGesture);
158
159             if (_pinchGestureEventHandler != null)
160             {
161                 //here we send all data to user event handlers
162                 _pinchGestureEventHandler(this, e);
163             }
164
165         }
166
167
168         public static PinchGestureDetector GetPinchGestureDetectorFromPtr(global::System.IntPtr cPtr)
169         {
170             PinchGestureDetector ret = new PinchGestureDetector(cPtr, false);
171             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172             return ret;
173         }
174
175
176         public PinchGestureDetector() : this(NDalicPINVOKE.PinchGestureDetector_New(), true)
177         {
178             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179
180         }
181         public new static PinchGestureDetector DownCast(BaseHandle handle)
182         {
183             PinchGestureDetector ret = new PinchGestureDetector(NDalicPINVOKE.PinchGestureDetector_DownCast(BaseHandle.getCPtr(handle)), true);
184             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185             return ret;
186         }
187
188         public PinchGestureDetector(PinchGestureDetector handle) : this(NDalicPINVOKE.new_PinchGestureDetector__SWIG_1(PinchGestureDetector.getCPtr(handle)), true)
189         {
190             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
191         }
192
193         public PinchGestureDetector Assign(PinchGestureDetector rhs)
194         {
195             PinchGestureDetector ret = new PinchGestureDetector(NDalicPINVOKE.PinchGestureDetector_Assign(swigCPtr, PinchGestureDetector.getCPtr(rhs)), false);
196             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197             return ret;
198         }
199
200         internal PinchGestureDetectedSignal DetectedSignal()
201         {
202             PinchGestureDetectedSignal ret = new PinchGestureDetectedSignal(NDalicPINVOKE.PinchGestureDetector_DetectedSignal(swigCPtr), false);
203             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204             return ret;
205         }
206
207     }
208
209 }