2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 /// Base structure for different gestures that an application can receive.<br />
23 /// A Gesture is an event that is produced from a combination of several touch events
24 /// in a particular order or within a certain time frame (for example, pinch).<br />
26 /// <since_tizen> 3 </since_tizen>
27 public class Gesture : global::System.IDisposable
29 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
33 /// <since_tizen> 3 </since_tizen>
34 protected bool swigCMemOwn;
36 internal Gesture(global::System.IntPtr cPtr, bool cMemoryOwn)
38 swigCMemOwn = cMemoryOwn;
39 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
42 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Gesture obj)
44 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
47 //A Flag to check who called Dispose(). (By User or DisposeQueue)
48 private bool isDisposeQueued = false;
50 /// A Flat to check if it is already disposed.
52 /// <since_tizen> 3 </since_tizen>
53 protected bool disposed = false;
58 /// <since_tizen> 3 </since_tizen>
63 isDisposeQueued = true;
64 DisposeQueue.Instance.Add(this);
71 /// <since_tizen> 3 </since_tizen>
74 //Throw excpetion if Dispose() is called in separate thread.
75 if (!Window.IsInstalled())
77 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
82 Dispose(DisposeTypes.Implicit);
86 Dispose(DisposeTypes.Explicit);
87 System.GC.SuppressFinalize(this);
94 /// <since_tizen> 3 </since_tizen>
95 protected virtual void Dispose(DisposeTypes type)
102 if(type == DisposeTypes.Explicit)
105 //Release your own managed resources here.
106 //You should release all of your own disposable objects here.
109 //Release your own unmanaged resources here.
110 //You should not access any managed member here except static instance.
111 //because the execution order of Finalizes is non-deterministic.
113 if (swigCPtr.Handle != global::System.IntPtr.Zero)
118 NDalicPINVOKE.delete_Gesture(swigCPtr);
120 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
127 /// The gesture type.
129 /// <since_tizen> 3 </since_tizen>
130 public Gesture.GestureType Type
139 /// The gesture state.
141 /// <since_tizen> 3 </since_tizen>
142 public Gesture.StateType State
151 /// The time the gesture took place.
153 /// <since_tizen> 3 </since_tizen>
163 /// The Copy constructor.
165 /// <param name="rhs">A reference to the copied handle</param>
166 /// <since_tizen> 3 </since_tizen>
167 public Gesture(Gesture rhs) : this(NDalicPINVOKE.new_Gesture(Gesture.getCPtr(rhs)), true)
169 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172 private Gesture.GestureType type
176 NDalicPINVOKE.Gesture_type_set(swigCPtr, (int)value);
177 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181 Gesture.GestureType ret = (Gesture.GestureType)NDalicPINVOKE.Gesture_type_get(swigCPtr);
182 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
187 private Gesture.StateType state
191 NDalicPINVOKE.Gesture_state_set(swigCPtr, (int)value);
192 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196 Gesture.StateType ret = (Gesture.StateType)NDalicPINVOKE.Gesture_state_get(swigCPtr);
197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
206 NDalicPINVOKE.Gesture_time_set(swigCPtr, value);
207 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211 uint ret = NDalicPINVOKE.Gesture_time_get(swigCPtr);
212 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
218 /// Enumeration for type of gesture.
220 /// <since_tizen> 3 </since_tizen>
221 public enum GestureType
224 /// When two touch points move away or towards each other.
226 /// <since_tizen> 3 </since_tizen>
229 /// When the user drags their finger(s) in a particular direction.
231 /// <since_tizen> 3 </since_tizen>
234 /// When the user taps the screen.
236 /// <since_tizen> 3 </since_tizen>
239 /// When the user continues to touch the same area on the screen for the device configured time.
241 /// <since_tizen> 3 </since_tizen>
246 /// Enumeration for state of the gesture.
248 /// <since_tizen> 3 </since_tizen>
249 public enum StateType
252 /// There is no state associated with this gesture.
254 /// <since_tizen> 3 </since_tizen>
257 /// The touched points on the screen have moved enough to be considered a gesture.
259 /// <since_tizen> 3 </since_tizen>
262 /// The gesture is continuing.
264 /// <since_tizen> 3 </since_tizen>
267 /// The user has lifted a finger or touched an additional point on the screen.
269 /// <since_tizen> 3 </since_tizen>
272 /// The gesture has been cancelled.
274 /// <since_tizen> 3 </since_tizen>
277 /// A gesture is possible.
279 /// <since_tizen> 3 </since_tizen>