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