ec068695b6dae4140437f0383f85620bc8bba60a
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / LongPressGesture.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16
17 namespace Tizen.NUI
18 {
19
20     /// <summary>
21     /// A long press gesture is emitted when the user holds the screen with the stated number of fingers.<br>
22     /// A long press gesture finishes when all touches have been released.<br>
23     /// </summary>
24     public class LongPressGesture : Gesture
25     {
26         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
27
28         internal LongPressGesture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.LongPressGesture_SWIGUpcast(cPtr), cMemoryOwn)
29         {
30             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
31         }
32
33         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LongPressGesture obj)
34         {
35             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
36         }
37
38         protected override void Dispose(DisposeTypes type)
39         {
40             if(disposed)
41             {
42                 return;
43             }
44
45             if(type == DisposeTypes.Explicit)
46             {
47                 //Called by User
48                 //Release your own managed resources here.
49                 //You should release all of your own disposable objects here.
50             }
51
52             //Release your own unmanaged resources here.
53             //You should not access any managed member here except static instance.
54             //because the execution order of Finalizes is non-deterministic.
55
56             if (swigCPtr.Handle != global::System.IntPtr.Zero)
57             {
58                 if (swigCMemOwn)
59                 {
60                     swigCMemOwn = false;
61                     NDalicPINVOKE.delete_LongPressGesture(swigCPtr);
62                 }
63                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
64             }
65
66             base.Dispose(type);
67         }
68
69
70         internal static LongPressGesture GetLongPressGestureFromPtr(global::System.IntPtr cPtr)
71         {
72             LongPressGesture ret = new LongPressGesture(cPtr, false);
73             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74             return ret;
75         }
76
77         /// <summary>
78         /// The number of touch points in this long press gesture, i.e., the number of fingers the user had
79         /// on the screen to generate the long press gesture.<br>
80         /// </summary>
81         /// <since_tizen> 3 </since_tizen>
82         public uint NumberOfTouches
83         {
84             get
85             {
86                 return numberOfTouches;
87             }
88         }
89
90         /// <summary>
91         /// This is the point, in screen coordinates, where the long press occurred.<br>
92         /// If a multi-touch long press, then this is the centroid of all the touch points.<br>
93         /// </summary>
94         /// <since_tizen> 3 </since_tizen>
95         public Vector2 ScreenPoint
96         {
97             get
98             {
99                 return screenPoint;
100             }
101         }
102
103         /// <summary>
104         /// This is the point, in local actor coordinates, where the long press occurred.<br>
105         /// If a multi-touch long press, then this is the centroid of all the touch points.<br>
106         /// </summary>
107         /// <since_tizen> 3 </since_tizen>
108         public Vector2 LocalPoint
109         {
110             get
111             {
112                 return localPoint;
113             }
114         }
115
116         /// <summary>
117         /// The constructor.
118         /// </summary>
119         /// <param name="state">The state of the gesture</param>
120         /// <since_tizen> 3 </since_tizen>
121         public LongPressGesture(Gesture.StateType state) : this(NDalicPINVOKE.new_LongPressGesture__SWIG_0((int)state), true)
122         {
123             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124         }
125
126
127         private uint numberOfTouches
128         {
129             set
130             {
131                 NDalicPINVOKE.LongPressGesture_numberOfTouches_set(swigCPtr, value);
132                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
133             }
134             get
135             {
136                 uint ret = NDalicPINVOKE.LongPressGesture_numberOfTouches_get(swigCPtr);
137                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
138                 return ret;
139             }
140         }
141
142         private Vector2 screenPoint
143         {
144             set
145             {
146                 NDalicPINVOKE.LongPressGesture_screenPoint_set(swigCPtr, Vector2.getCPtr(value));
147                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
148             }
149             get
150             {
151                 global::System.IntPtr cPtr = NDalicPINVOKE.LongPressGesture_screenPoint_get(swigCPtr);
152                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
153                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154                 return ret;
155             }
156         }
157
158         private Vector2 localPoint
159         {
160             set
161             {
162                 NDalicPINVOKE.LongPressGesture_localPoint_set(swigCPtr, Vector2.getCPtr(value));
163                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164             }
165             get
166             {
167                 global::System.IntPtr cPtr = NDalicPINVOKE.LongPressGesture_localPoint_get(swigCPtr);
168                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
169                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170                 return ret;
171             }
172         }
173
174     }
175
176 }