1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
21 /// Base structure for different gestures that an application can receive.<br>
22 /// A Gesture is an event that is produced from a combination of several touch events
23 /// in a particular order or within a certain time frame (for example, pinch).<br>
25 public class Gesture : global::System.IDisposable
27 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
28 protected bool swigCMemOwn;
30 internal Gesture(global::System.IntPtr cPtr, bool cMemoryOwn)
32 swigCMemOwn = cMemoryOwn;
33 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
36 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Gesture obj)
38 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
41 //A Flag to check who called Dispose(). (By User or DisposeQueue)
42 private bool isDisposeQueued = false;
43 //A Flat to check if it is already disposed.
44 protected bool disposed = false;
50 isDisposeQueued = true;
51 DisposeQueue.Instance.Add(this);
57 //Throw excpetion if Dispose() is called in separate thread.
58 if (!Window.IsInstalled())
60 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
65 Dispose(DisposeTypes.Implicit);
69 Dispose(DisposeTypes.Explicit);
70 System.GC.SuppressFinalize(this);
74 protected virtual void Dispose(DisposeTypes type)
81 if(type == DisposeTypes.Explicit)
84 //Release your own managed resources here.
85 //You should release all of your own disposable objects here.
88 //Release your own unmanaged resources here.
89 //You should not access any managed member here except static instance.
90 //because the execution order of Finalizes is non-deterministic.
92 if (swigCPtr.Handle != global::System.IntPtr.Zero)
97 NDalicPINVOKE.delete_Gesture(swigCPtr);
99 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
106 /// The gesture type.
108 public Gesture.GestureType Type
117 /// The gesture state.
119 public Gesture.StateType State
128 /// The time the gesture took place.
139 /// The Copy constructor.
141 /// <param name="rhs">A reference to the copied handle</param>
142 public Gesture(Gesture rhs) : this(NDalicPINVOKE.new_Gesture(Gesture.getCPtr(rhs)), true)
144 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
147 private Gesture.GestureType type
151 NDalicPINVOKE.Gesture_type_set(swigCPtr, (int)value);
152 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156 Gesture.GestureType ret = (Gesture.GestureType)NDalicPINVOKE.Gesture_type_get(swigCPtr);
157 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162 private Gesture.StateType state
166 NDalicPINVOKE.Gesture_state_set(swigCPtr, (int)value);
167 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171 Gesture.StateType ret = (Gesture.StateType)NDalicPINVOKE.Gesture_state_get(swigCPtr);
172 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181 NDalicPINVOKE.Gesture_time_set(swigCPtr, value);
182 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186 uint ret = NDalicPINVOKE.Gesture_time_get(swigCPtr);
187 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193 /// Enumeration for type of gesture.
195 public enum GestureType
204 /// Enumeration for state of the gesture.
206 public enum StateType