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