f497012e2c2193cb22a2a38a1588d590993e8690
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / LongPressGesture.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 long press gesture is emitted when the user holds the screen with the stated number of fingers.<br />
23     /// A long press gesture finishes when all touches have been released.<br />
24     /// </summary>
25     /// <since_tizen> 3 </since_tizen>
26     public class LongPressGesture : Gesture
27     {
28         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
29
30         /// <summary>
31         /// The constructor.
32         /// </summary>
33         /// <param name="state">The state of the gesture</param>
34         /// <since_tizen> 3 </since_tizen>
35         public LongPressGesture(Gesture.StateType state) : this(Interop.LongPressGesture.new_LongPressGesture__SWIG_0((int)state), true)
36         {
37             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
38         }
39
40         internal LongPressGesture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.LongPressGesture.LongPressGesture_SWIGUpcast(cPtr), cMemoryOwn)
41         {
42             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
43         }
44
45         /// <summary>
46         /// The number of touch points in this long press gesture, i.e., the number of fingers the user had
47         /// on the screen to generate the long press gesture.<br />
48         /// </summary>
49         /// <since_tizen> 3 </since_tizen>
50         public uint NumberOfTouches
51         {
52             get
53             {
54                 return numberOfTouches;
55             }
56         }
57
58         /// <summary>
59         /// This is the point, in screen coordinates, where the long press occurred.<br />
60         /// If a multi-touch long press, then this is the centroid of all the touch points.<br />
61         /// </summary>
62         /// <since_tizen> 3 </since_tizen>
63         public Vector2 ScreenPoint
64         {
65             get
66             {
67                 return screenPoint;
68             }
69         }
70
71         /// <summary>
72         /// This is the point, in local actor coordinates, where the long press occurred.<br />
73         /// If a multi-touch long press, then this is the centroid of all the touch points.<br />
74         /// </summary>
75         /// <since_tizen> 3 </since_tizen>
76         public Vector2 LocalPoint
77         {
78             get
79             {
80                 return localPoint;
81             }
82         }
83
84
85         private uint numberOfTouches
86         {
87             set
88             {
89                 Interop.LongPressGesture.LongPressGesture_numberOfTouches_set(swigCPtr, value);
90                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91             }
92             get
93             {
94                 uint ret = Interop.LongPressGesture.LongPressGesture_numberOfTouches_get(swigCPtr);
95                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96                 return ret;
97             }
98         }
99
100         private Vector2 screenPoint
101         {
102             set
103             {
104                 Interop.LongPressGesture.LongPressGesture_screenPoint_set(swigCPtr, Vector2.getCPtr(value));
105                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106             }
107             get
108             {
109                 global::System.IntPtr cPtr = Interop.LongPressGesture.LongPressGesture_screenPoint_get(swigCPtr);
110                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
111                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112                 return ret;
113             }
114         }
115
116         private Vector2 localPoint
117         {
118             set
119             {
120                 Interop.LongPressGesture.LongPressGesture_localPoint_set(swigCPtr, Vector2.getCPtr(value));
121                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
122             }
123             get
124             {
125                 global::System.IntPtr cPtr = Interop.LongPressGesture.LongPressGesture_localPoint_get(swigCPtr);
126                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
127                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
128                 return ret;
129             }
130         }
131
132         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LongPressGesture obj)
133         {
134             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
135         }
136
137         internal static LongPressGesture GetLongPressGestureFromPtr(global::System.IntPtr cPtr)
138         {
139             LongPressGesture ret = new LongPressGesture(cPtr, false);
140             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141             return ret;
142         }
143
144         /// <summary>
145         /// Dispose.
146         /// </summary>
147         /// <since_tizen> 3 </since_tizen>
148         protected override void Dispose(DisposeTypes type)
149         {
150             if(disposed)
151             {
152                 return;
153             }
154
155             //Release your own unmanaged resources here.
156             //You should not access any managed member here except static instance.
157             //because the execution order of Finalizes is non-deterministic.
158
159             if (swigCPtr.Handle != global::System.IntPtr.Zero)
160             {
161                 if (swigCMemOwn)
162                 {
163                     swigCMemOwn = false;
164                     Interop.LongPressGesture.delete_LongPressGesture(swigCPtr);
165                 }
166                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
167             }
168
169             base.Dispose(type);
170         }
171     }
172 }