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 public class Gesture : global::System.IDisposable
28 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
32 protected bool swigCMemOwn;
34 internal Gesture(global::System.IntPtr cPtr, bool cMemoryOwn)
36 swigCMemOwn = cMemoryOwn;
37 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
40 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Gesture obj)
42 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
45 //A Flag to check who called Dispose(). (By User or DisposeQueue)
46 private bool isDisposeQueued = false;
48 /// A Flat to check if it is already disposed.
50 protected bool disposed = false;
55 /// <since_tizen> 3 </since_tizen>
60 isDisposeQueued = true;
61 DisposeQueue.Instance.Add(this);
68 /// <since_tizen> 3 </since_tizen>
71 //Throw excpetion if Dispose() is called in separate thread.
72 if (!Window.IsInstalled())
74 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
79 Dispose(DisposeTypes.Implicit);
83 Dispose(DisposeTypes.Explicit);
84 System.GC.SuppressFinalize(this);
91 /// <since_tizen> 3 </since_tizen>
92 protected virtual void Dispose(DisposeTypes type)
99 if(type == DisposeTypes.Explicit)
102 //Release your own managed resources here.
103 //You should release all of your own disposable objects here.
106 //Release your own unmanaged resources here.
107 //You should not access any managed member here except static instance.
108 //because the execution order of Finalizes is non-deterministic.
110 if (swigCPtr.Handle != global::System.IntPtr.Zero)
115 NDalicPINVOKE.delete_Gesture(swigCPtr);
117 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
124 /// The gesture type.
126 /// <since_tizen> 3 </since_tizen>
127 public Gesture.GestureType Type
136 /// The gesture state.
138 /// <since_tizen> 3 </since_tizen>
139 public Gesture.StateType State
148 /// The time the gesture took place.
150 /// <since_tizen> 3 </since_tizen>
160 /// The Copy constructor.
162 /// <param name="rhs">A reference to the copied handle</param>
163 /// <since_tizen> 3 </since_tizen>
164 public Gesture(Gesture rhs) : this(NDalicPINVOKE.new_Gesture(Gesture.getCPtr(rhs)), true)
166 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169 private Gesture.GestureType type
173 NDalicPINVOKE.Gesture_type_set(swigCPtr, (int)value);
174 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178 Gesture.GestureType ret = (Gesture.GestureType)NDalicPINVOKE.Gesture_type_get(swigCPtr);
179 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
184 private Gesture.StateType state
188 NDalicPINVOKE.Gesture_state_set(swigCPtr, (int)value);
189 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193 Gesture.StateType ret = (Gesture.StateType)NDalicPINVOKE.Gesture_state_get(swigCPtr);
194 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203 NDalicPINVOKE.Gesture_time_set(swigCPtr, value);
204 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208 uint ret = NDalicPINVOKE.Gesture_time_get(swigCPtr);
209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215 /// Enumeration for type of gesture.
217 /// <since_tizen> 3 </since_tizen>
218 public enum GestureType
221 /// When two touch points move away or towards each other.
223 /// <since_tizen> 3 </since_tizen>
226 /// When the user drags their finger(s) in a particular direction.
228 /// <since_tizen> 3 </since_tizen>
231 /// When the user taps the screen.
233 /// <since_tizen> 3 </since_tizen>
236 /// When the user continues to touch the same area on the screen for the device configured time.
238 /// <since_tizen> 3 </since_tizen>
243 /// Enumeration for state of the gesture.
245 /// <since_tizen> 3 </since_tizen>
246 public enum StateType
249 /// There is no state associated with this gesture.
251 /// <since_tizen> 3 </since_tizen>
254 /// The touched points on the screen have moved enough to be considered a gesture.
256 /// <since_tizen> 3 </since_tizen>
259 /// The gesture is continuing.
261 /// <since_tizen> 3 </since_tizen>
264 /// The user has lifted a finger or touched an additional point on the screen.
266 /// <since_tizen> 3 </since_tizen>
269 /// The gesture has been cancelled.
271 /// <since_tizen> 3 </since_tizen>
274 /// A gesture is possible.
276 /// <since_tizen> 3 </since_tizen>