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