4ab070af2e187bd64ae3ab002c1c9a4e803bfb47
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / PinchGesture.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
17 namespace Tizen.NUI
18 {
19
20     /// <summary>
21     /// A PinchGesture is emitted when the user moves two fingers towards or away from each other.<br>
22     /// A pinch gesture will continue to be sent to the actor under the center point of the pinch until the pinch ends.<br>
23     /// </summary>
24     public class PinchGesture : Gesture
25     {
26         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
27
28         internal PinchGesture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PinchGesture_SWIGUpcast(cPtr), cMemoryOwn)
29         {
30             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
31         }
32
33         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PinchGesture obj)
34         {
35             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
36         }
37
38         protected override void Dispose(DisposeTypes type)
39         {
40             if(disposed)
41             {
42                 return;
43             }
44
45             if(type == DisposeTypes.Explicit)
46             {
47                 //Called by User
48                 //Release your own managed resources here.
49                 //You should release all of your own disposable objects here.
50             }
51
52             //Release your own unmanaged resources here.
53             //You should not access any managed member here except static instance.
54             //because the execution order of Finalizes is non-deterministic.
55
56             if (swigCPtr.Handle != global::System.IntPtr.Zero)
57             {
58                 if (swigCMemOwn)
59                 {
60                     swigCMemOwn = false;
61                     NDalicPINVOKE.delete_PinchGesture(swigCPtr);
62                 }
63                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
64             }
65
66             base.Dispose(type);
67         }
68
69
70         internal static PinchGesture GetPinchGestureFromPtr(global::System.IntPtr cPtr)
71         {
72             PinchGesture ret = new PinchGesture(cPtr, false);
73             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74             return ret;
75         }
76
77         /// <summary>
78         /// The scale factor from the start of the pinch gesture till the latest pinch gesture.<br>
79         /// If the user is moving their fingers away from each other, then
80         /// this value increases. Conversely, if the user is moving their
81         /// fingers towards each other, this value will decrease.<br>
82         /// </summary>
83         /// <since_tizen> 3 </since_tizen>
84         public float Scale
85         {
86             get
87             {
88                 return scale;
89             }
90         }
91
92         /// <summary>
93         /// The speed at which the user is moving their fingers.<br>
94         /// This is the pixel movement per second.<br>
95         /// </summary>
96         /// <since_tizen> 3 </since_tizen>
97         public float Speed
98         {
99             get
100             {
101                 return speed;
102             }
103         }
104
105         /// <summary>
106         /// The center point of the two points that caused the pinch gesture in screen coordinates.
107         /// </summary>
108         /// <since_tizen> 3 </since_tizen>
109         public Vector2 ScreenCenterPoint
110         {
111             get
112             {
113                 return screenCenterPoint;
114             }
115         }
116
117         /// <summary>
118         /// The center point of the two points that caused the pinch gesture in local actor coordinates.
119         /// </summary>
120         /// <since_tizen> 3 </since_tizen>
121         public Vector2 LocalCenterPoint
122         {
123             get
124             {
125                 return localCenterPoint;
126             }
127         }
128
129         /// <summary>
130         /// The default constructor.
131         /// </summary>
132         /// <param name="state">The state of the gesture.</param>
133         internal PinchGesture(Gesture.StateType state) : this(NDalicPINVOKE.new_PinchGesture__SWIG_0((int)state), true)
134         {
135             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
136         }
137
138         private float scale
139         {
140             set
141             {
142                 NDalicPINVOKE.PinchGesture_scale_set(swigCPtr, value);
143                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144             }
145             get
146             {
147                 float ret = NDalicPINVOKE.PinchGesture_scale_get(swigCPtr);
148                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
149                 return ret;
150             }
151         }
152
153         private float speed
154         {
155             set
156             {
157                 NDalicPINVOKE.PinchGesture_speed_set(swigCPtr, value);
158                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159             }
160             get
161             {
162                 float ret = NDalicPINVOKE.PinchGesture_speed_get(swigCPtr);
163                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164                 return ret;
165             }
166         }
167
168         private Vector2 screenCenterPoint
169         {
170             set
171             {
172                 NDalicPINVOKE.PinchGesture_screenCenterPoint_set(swigCPtr, Vector2.getCPtr(value));
173                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174             }
175             get
176             {
177                 global::System.IntPtr cPtr = NDalicPINVOKE.PinchGesture_screenCenterPoint_get(swigCPtr);
178                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
179                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180                 return ret;
181             }
182         }
183
184         private Vector2 localCenterPoint
185         {
186             set
187             {
188                 NDalicPINVOKE.PinchGesture_localCenterPoint_set(swigCPtr, Vector2.getCPtr(value));
189                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190             }
191             get
192             {
193                 global::System.IntPtr cPtr = NDalicPINVOKE.PinchGesture_localCenterPoint_get(swigCPtr);
194                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
195                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196                 return ret;
197             }
198         }
199
200     }
201
202 }