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