/* * Copyright(c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using System.ComponentModel; namespace Tizen.NUI { /// /// Base structure for different gestures that an application can receive.
/// A Gesture is an event that is produced from a combination of several touch events /// in a particular order or within a certain time frame (for example, pinch).
///
/// 3 public class Gesture : BaseHandle { /// /// The Copy constructor. /// /// A reference to the copied handle /// 3 public Gesture(Gesture rhs) : this(Interop.Gesture.NewGesture(Gesture.getCPtr(rhs)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal Gesture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) { } /// /// Enumeration for type of gesture. /// /// 3 public enum GestureType { /// /// When two touch points move away or towards each other. /// /// 3 Pinch = 1 << 0, /// /// When the user drags their finger(s) in a particular direction. /// /// 3 Pan = 1 << 1, /// /// When the user taps the screen. /// /// 3 Tap = 1 << 2, /// /// When the user continues to touch the same area on the screen for the device configured time. /// /// 3 LongPress = 1 << 3 } /// /// Enumeration for state of the gesture. /// /// 3 public enum StateType { /// /// There is no state associated with this gesture. /// /// 3 Clear, /// /// The touched points on the screen have moved enough to be considered a gesture. /// /// 3 Started, /// /// The gesture is continuing. /// /// 3 Continuing, /// /// The user has lifted a finger or touched an additional point on the screen. /// /// 3 Finished, /// /// The gesture has been cancelled. /// /// 3 Cancelled, /// /// A gesture is possible. /// /// 3 Possible } /// /// This is the value of which source the gesture was started with. (ex : mouse) /// [EditorBrowsable(EditorBrowsableState.Never)] public enum SourceType { /// /// invalid data. /// [EditorBrowsable(EditorBrowsableState.Never)] Invalid, /// /// Mouse. /// [EditorBrowsable(EditorBrowsableState.Never)] Mouse, /// /// Touch. /// [EditorBrowsable(EditorBrowsableState.Never)] Touch, } /// /// This is the data of source type /// [EditorBrowsable(EditorBrowsableState.Never)] public enum SourceDataType { /// /// invalid data. /// [EditorBrowsable(EditorBrowsableState.Never)] Invalid = -1, /// /// Primary(Left) mouse button. /// [EditorBrowsable(EditorBrowsableState.Never)] MousePrimary = 1, /// /// Secondary(Right) mouse button. /// [EditorBrowsable(EditorBrowsableState.Never)] MouseSecondary = 3, /// /// Tertiary(Third) mouse button. /// [EditorBrowsable(EditorBrowsableState.Never)] MouseTertiary = 2, } /// /// The gesture type. /// /// 3 public Gesture.GestureType Type { get { return type; } } /// /// The gesture state. /// /// 3 public Gesture.StateType State { get { return state; } } /// /// The time the gesture took place. /// /// 3 public uint Time { get { return time; } } /// /// This is the property of which source type the gesture (read-only). /// If you started the gesture with the mouse, it will tell you what type of mouse it is. /// [EditorBrowsable(EditorBrowsableState.Never)] public Gesture.SourceType Source { get { return sourceType; } } /// /// This is a property of the source type data (read-only). /// If you started the gesture with the mouse, it will tell you which mouse button you started the gesture with. /// [EditorBrowsable(EditorBrowsableState.Never)] public Gesture.SourceDataType SourceData { get { return sourceDataType; } } private Gesture.GestureType type { set { Interop.Gesture.TypeSet(SwigCPtr, (int)value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } get { Gesture.GestureType ret = (Gesture.GestureType)Interop.Gesture.TypeGet(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } } private Gesture.StateType state { set { Interop.Gesture.StateSet(SwigCPtr, (int)value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } get { Gesture.StateType ret = (Gesture.StateType)Interop.Gesture.StateGet(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } } private uint time { set { Interop.Gesture.TimeSet(SwigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } get { uint ret = Interop.Gesture.TimeGet(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } } private Gesture.SourceType sourceType { get { Gesture.SourceType ret = (Gesture.SourceType)Interop.Gesture.SourceTypeGet(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } } private Gesture.SourceDataType sourceDataType { get { Gesture.SourceDataType ret = (Gesture.SourceDataType)Interop.Gesture.SourceDataGet(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } } internal static Gesture GetGestureFromPtr(global::System.IntPtr cPtr) { Gesture ret = new Gesture(cPtr, false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// This will not be public opened. [EditorBrowsable(EditorBrowsableState.Never)] protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) { Interop.Gesture.DeleteGesture(swigCPtr); } } }