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
32 /// <since_tizen> 3 </since_tizen>
33 protected bool swigCMemOwn;
36 /// A Flat to check if it is already disposed.
38 /// <since_tizen> 3 </since_tizen>
39 protected bool disposed = false;
41 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
43 //A Flag to check who called Dispose(). (By User or DisposeQueue)
44 private bool isDisposeQueued = false;
47 /// The Copy constructor.
49 /// <param name="rhs">A reference to the copied handle</param>
50 /// <since_tizen> 3 </since_tizen>
51 public Gesture(Gesture rhs) : this(NDalicPINVOKE.new_Gesture(Gesture.getCPtr(rhs)), true)
53 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
56 internal Gesture(global::System.IntPtr cPtr, bool cMemoryOwn)
58 swigCMemOwn = cMemoryOwn;
59 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
65 /// <since_tizen> 3 </since_tizen>
70 isDisposeQueued = true;
71 DisposeQueue.Instance.Add(this);
76 /// Enumeration for type of gesture.
78 /// <since_tizen> 3 </since_tizen>
79 public enum GestureType
82 /// When two touch points move away or towards each other.
84 /// <since_tizen> 3 </since_tizen>
87 /// When the user drags their finger(s) in a particular direction.
89 /// <since_tizen> 3 </since_tizen>
92 /// When the user taps the screen.
94 /// <since_tizen> 3 </since_tizen>
97 /// When the user continues to touch the same area on the screen for the device configured time.
99 /// <since_tizen> 3 </since_tizen>
104 /// Enumeration for state of the gesture.
106 /// <since_tizen> 3 </since_tizen>
107 public enum StateType
110 /// There is no state associated with this gesture.
112 /// <since_tizen> 3 </since_tizen>
115 /// The touched points on the screen have moved enough to be considered a gesture.
117 /// <since_tizen> 3 </since_tizen>
120 /// The gesture is continuing.
122 /// <since_tizen> 3 </since_tizen>
125 /// The user has lifted a finger or touched an additional point on the screen.
127 /// <since_tizen> 3 </since_tizen>
130 /// The gesture has been cancelled.
132 /// <since_tizen> 3 </since_tizen>
135 /// A gesture is possible.
137 /// <since_tizen> 3 </since_tizen>
142 /// The gesture type.
144 /// <since_tizen> 3 </since_tizen>
145 public Gesture.GestureType Type
154 /// The gesture state.
156 /// <since_tizen> 3 </since_tizen>
157 public Gesture.StateType State
166 /// The time the gesture took place.
168 /// <since_tizen> 3 </since_tizen>
177 private Gesture.GestureType type
181 NDalicPINVOKE.Gesture_type_set(swigCPtr, (int)value);
182 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186 Gesture.GestureType ret = (Gesture.GestureType)NDalicPINVOKE.Gesture_type_get(swigCPtr);
187 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192 private Gesture.StateType state
196 NDalicPINVOKE.Gesture_state_set(swigCPtr, (int)value);
197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
201 Gesture.StateType ret = (Gesture.StateType)NDalicPINVOKE.Gesture_state_get(swigCPtr);
202 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211 NDalicPINVOKE.Gesture_time_set(swigCPtr, value);
212 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
216 uint ret = NDalicPINVOKE.Gesture_time_get(swigCPtr);
217 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
225 /// <since_tizen> 3 </since_tizen>
226 public void Dispose()
228 //Throw excpetion if Dispose() is called in separate thread.
229 if (!Window.IsInstalled())
231 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
236 Dispose(DisposeTypes.Implicit);
240 Dispose(DisposeTypes.Explicit);
241 System.GC.SuppressFinalize(this);
245 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Gesture obj)
247 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
253 /// <since_tizen> 3 </since_tizen>
254 protected virtual void Dispose(DisposeTypes type)
261 if (type == DisposeTypes.Explicit)
264 //Release your own managed resources here.
265 //You should release all of your own disposable objects here.
268 //Release your own unmanaged resources here.
269 //You should not access any managed member here except static instance.
270 //because the execution order of Finalizes is non-deterministic.
272 if (swigCPtr.Handle != global::System.IntPtr.Zero)
277 NDalicPINVOKE.delete_Gesture(swigCPtr);
279 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);