[NUI] Add source type to TapGesture.
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Events / TapGesture.cs
1 /*
2  * Copyright(c) 2020 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 TapGesture is emitted when the user taps the screen with the stated number of fingers a stated number of times.
24     /// </summary>
25     /// <since_tizen> 3 </since_tizen>
26     public class TapGesture : Gesture
27     {
28
29         /// <summary>
30         /// Creates a TapGesture.
31         /// </summary>
32         /// <since_tizen> 3 </since_tizen>
33         public TapGesture() : this(Interop.TapGesture.New(0), true)
34         {
35             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
36         }
37
38         internal TapGesture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
39         {
40         }
41
42         /// <summary>
43         /// The number of taps property (read-only).
44         /// </summary>
45         /// <since_tizen> 3 </since_tizen>
46         public uint NumberOfTaps
47         {
48             get
49             {
50                 return numberOfTaps;
51             }
52         }
53
54         /// <summary>
55         /// The number of touches property (read-only).
56         /// </summary>
57         /// <since_tizen> 3 </since_tizen>
58         public uint NumberOfTouches
59         {
60             get
61             {
62                 return numberOfTouches;
63             }
64         }
65
66         /// <summary>
67         /// The screen point property (read-only).
68         /// </summary>
69         /// <since_tizen> 3 </since_tizen>
70         public Vector2 ScreenPoint
71         {
72             get
73             {
74                 return screenPoint;
75             }
76         }
77
78         /// <summary>
79         /// The local point property (read-only).
80         /// </summary>
81         /// <since_tizen> 3 </since_tizen>
82         public Vector2 LocalPoint
83         {
84             get
85             {
86                 return localPoint;
87             }
88         }
89
90         /// <summary>
91         /// The gesture source type of touches property (read-only).
92         /// If you tap with a mouse button, this will tell you which mouse input you tapped.
93         /// Primary(Left), Secondary(Right). Tertiary(Wheel).
94         /// </summary>
95         [EditorBrowsable(EditorBrowsableState.Never)]
96         public GestureSourceType SourceType
97         {
98             get
99             {
100                 return sourceType;
101             }
102         }
103
104         private uint numberOfTaps
105         {
106             set
107             {
108                 Interop.TapGesture.NumberOfTapsSet(SwigCPtr, value);
109                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
110             }
111             get
112             {
113                 uint ret = Interop.TapGesture.NumberOfTapsGet(SwigCPtr);
114                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
115                 return ret;
116             }
117         }
118
119         private uint numberOfTouches
120         {
121             set
122             {
123                 Interop.TapGesture.NumberOfTouchesSet(SwigCPtr, value);
124                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125             }
126             get
127             {
128                 uint ret = Interop.TapGesture.NumberOfTouchesGet(SwigCPtr);
129                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
130                 return ret;
131             }
132         }
133
134         private Vector2 screenPoint
135         {
136             set
137             {
138                 Interop.TapGesture.ScreenPointSet(SwigCPtr, Vector2.getCPtr(value));
139                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140             }
141             get
142             {
143                 global::System.IntPtr cPtr = Interop.TapGesture.ScreenPointGet(SwigCPtr);
144                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
145                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
146                 return ret;
147             }
148         }
149
150         private Vector2 localPoint
151         {
152             set
153             {
154                 Interop.TapGesture.LocalPointSet(SwigCPtr, Vector2.getCPtr(value));
155                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156             }
157             get
158             {
159                 global::System.IntPtr cPtr = Interop.TapGesture.LocalPointGet(SwigCPtr);
160                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
161                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162                 return ret;
163             }
164         }
165
166         private GestureSourceType sourceType
167         {
168             get
169             {
170                 GestureSourceType ret = (GestureSourceType)Interop.TapGesture.SourceTypeGet(SwigCPtr);
171                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172                 return ret;
173             }
174         }
175
176         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TapGesture obj)
177         {
178             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
179         }
180
181         /// <summary>
182         /// Gets the TapGesture from the pointer.
183         /// </summary>
184         /// <param name="cPtr">The pointer to cast.</param>
185         /// <returns>The TapGesture object.</returns>
186         internal static TapGesture GetTapGestureFromPtr(global::System.IntPtr cPtr)
187         {
188             TapGesture ret = new TapGesture(cPtr, false);
189             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190             return ret;
191         }
192
193         /// This will not be public opened.
194         [EditorBrowsable(EditorBrowsableState.Never)]
195         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
196         {
197             Interop.TapGesture.DeleteTapGesture(swigCPtr);
198         }
199     }
200
201     /// <summary>
202     /// Gesture source type.
203     /// </summary>
204     [EditorBrowsable(EditorBrowsableState.Never)]
205     public enum GestureSourceType
206     {
207         /// <summary>
208         /// invalid data.
209         /// </summary>
210         [EditorBrowsable(EditorBrowsableState.Never)]
211         Invalid = -1,
212         /// <summary>
213         /// Primary.
214         /// </summary>
215         [EditorBrowsable(EditorBrowsableState.Never)]
216         Primary = 1,
217         /// <summary>
218         /// Secondary.
219         /// </summary>
220         [EditorBrowsable(EditorBrowsableState.Never)]
221         Secondary = 3,
222         /// <summary>
223         /// Third (tertiary)
224         /// </summary>
225         [EditorBrowsable(EditorBrowsableState.Never)]
226         Tertiary = 2,
227     }
228 }