[NUI] Remove duplicate getCPtr from BaseHandle subclasses (#3545)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Events / PinchGesture.cs
1 /*
2  * Copyright(c) 2021 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     /// <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         internal PinchGesture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
29         {
30         }
31
32         /// <summary>
33         /// The scale factor from the start of the pinch gesture till the latest pinch gesture.<br />
34         /// If the user is moving their fingers away from each other, then
35         /// this value increases. Conversely, if the user is moving their
36         /// fingers towards each other, this value will decrease.<br />
37         /// </summary>
38         /// <since_tizen> 3 </since_tizen>
39         public float Scale
40         {
41             get
42             {
43                 return scale;
44             }
45         }
46
47         /// <summary>
48         /// The speed at which the user is moving their fingers.<br />
49         /// This is the pixel movement per second.<br />
50         /// </summary>
51         /// <since_tizen> 3 </since_tizen>
52         public float Speed
53         {
54             get
55             {
56                 return speed;
57             }
58         }
59
60         /// <summary>
61         /// The center point of the two points that caused the pinch gesture in screen coordinates.
62         /// </summary>
63         /// <since_tizen> 3 </since_tizen>
64         public Vector2 ScreenCenterPoint
65         {
66             get
67             {
68                 return screenCenterPoint;
69             }
70         }
71
72         /// <summary>
73         /// The center point of the two points that caused the pinch gesture in local actor coordinates.
74         /// </summary>
75         /// <since_tizen> 3 </since_tizen>
76         public Vector2 LocalCenterPoint
77         {
78             get
79             {
80                 return localCenterPoint;
81             }
82         }
83
84         /// <summary>
85         /// The default constructor.
86         /// </summary>
87         /// <param name="state">The state of the gesture.</param>
88         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
89         [EditorBrowsable(EditorBrowsableState.Never)]
90         public PinchGesture(Gesture.StateType state) : this(Interop.PinchGesture.New((int)state), true)
91         {
92             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93         }
94
95         private float scale
96         {
97             set
98             {
99                 Interop.PinchGesture.ScaleSet(SwigCPtr, value);
100                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
101             }
102             get
103             {
104                 float ret = Interop.PinchGesture.ScaleGet(SwigCPtr);
105                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106                 return ret;
107             }
108         }
109
110         private float speed
111         {
112             set
113             {
114                 Interop.PinchGesture.SpeedSet(SwigCPtr, value);
115                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116             }
117             get
118             {
119                 float ret = Interop.PinchGesture.SpeedGet(SwigCPtr);
120                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121                 return ret;
122             }
123         }
124
125         private Vector2 screenCenterPoint
126         {
127             set
128             {
129                 Interop.PinchGesture.ScreenCenterPointSet(SwigCPtr, Vector2.getCPtr(value));
130                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131             }
132             get
133             {
134                 global::System.IntPtr cPtr = Interop.PinchGesture.ScreenCenterPointGet(SwigCPtr);
135                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
136                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
137                 return ret;
138             }
139         }
140
141         private Vector2 localCenterPoint
142         {
143             set
144             {
145                 Interop.PinchGesture.LocalCenterPointSet(SwigCPtr, Vector2.getCPtr(value));
146                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
147             }
148             get
149             {
150                 global::System.IntPtr cPtr = Interop.PinchGesture.LocalCenterPointGet(SwigCPtr);
151                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
152                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153                 return ret;
154             }
155         }
156
157         internal static PinchGesture GetPinchGestureFromPtr(global::System.IntPtr cPtr)
158         {
159             PinchGesture ret = new PinchGesture(cPtr, false);
160             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161             return ret;
162         }
163
164         /// This will not be public opened.
165         [EditorBrowsable(EditorBrowsableState.Never)]
166         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
167         {
168             Interop.PinchGesture.DeletePinchGesture(swigCPtr);
169         }
170     }
171 }