//------------------------------------------------------------------------------
//
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 3.0.9
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
namespace Tizen.NUI
{
///
/// Touch events are a collection of points at a specific moment in time.
/// When a multi-touch event occurs, each point represents the points that are currently being
/// touched or the points where a touch has stopped.
///
public class Touch : BaseHandle
{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
internal Touch(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Touch_SWIGUpcast(cPtr), cMemoryOwn)
{
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Touch obj)
{
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
~Touch()
{
DisposeQueue.Instance.Add(this);
}
public override void Dispose()
{
if (!Stage.IsInstalled())
{
DisposeQueue.Instance.Add(this);
return;
}
lock (this)
{
if (swigCPtr.Handle != global::System.IntPtr.Zero)
{
if (swigCMemOwn)
{
swigCMemOwn = false;
NDalicPINVOKE.delete_Touch(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
global::System.GC.SuppressFinalize(this);
base.Dispose();
}
}
internal static Touch GetTouchFromPtr(global::System.IntPtr cPtr)
{
Touch ret = new Touch(cPtr, false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// An uninitialized Touch instance.
/// Calling member functions with an uninitialized Touch handle is not allowed.
///
public Touch() : this(NDalicPINVOKE.new_Touch__SWIG_0(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal Touch(Touch other) : this(NDalicPINVOKE.new_Touch__SWIG_1(Touch.getCPtr(other)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal Touch Assign(Touch other)
{
Touch ret = new Touch(NDalicPINVOKE.Touch_Assign(swigCPtr, Touch.getCPtr(other)), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Returns the time (in ms) that the touch event occurred.
///
/// The time (in ms) that the touch event occurred
public uint GetTime()
{
uint ret = NDalicPINVOKE.Touch_GetTime(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Returns the total number of points in this TouchData.
///
/// Total number of Points
public uint GetPointCount()
{
uint ret = NDalicPINVOKE.Touch_GetPointCount(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Returns the ID of the device used for the Point specified.
/// Each point has a unique device ID which specifies the device used for that
/// point. This is returned by this method.
/// If point is greater than GetPointCount() then this method will return -1.
///
/// The point required
/// The Device ID of this point
public int GetDeviceId(uint point)
{
int ret = NDalicPINVOKE.Touch_GetDeviceId(swigCPtr, point);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Retrieves the State of the point specified.
/// If point is greater than GetPointCount() then this method will return PointState.Finished.
///
/// The point required
/// The state of the point specified
public PointStateType GetState(uint point)
{
PointStateType ret = (PointStateType)NDalicPINVOKE.Touch_GetState(swigCPtr, point);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Retrieves the actor that was underneath the point specified.
/// If point is greater than GetPointCount() then this method will return an empty handle.
///
/// The point required
/// The actor that was underneath the point specified
public Actor GetHitActor(uint point)
{
Actor ret = new Actor(NDalicPINVOKE.Touch_GetHitActor(swigCPtr, point), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Retrieves the co-ordinates relative to the top-left of the hit-actor at the point specified.
/// The top-left of an actor is (0.0, 0.0, 0.5).
/// If you require the local coordinates of another actor (e.g the parent of the hit actor),
/// then you should use Actor::ScreenToLocal().
/// If point is greater than GetPointCount() then this method will return Vector2.Zero.
///
/// The point required
/// The co-ordinates relative to the top-left of the hit-actor of the point specified
public Vector2 GetLocalPosition(uint point)
{
Vector2 ret = new Vector2(NDalicPINVOKE.Touch_GetLocalPosition(swigCPtr, point), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Retrieves the co-ordinates relative to the top-left of the screen of the point specified.
/// If point is greater than GetPointCount() then this method will return Vector2.Zero.
///
/// The point required
/// The co-ordinates relative to the top-left of the screen of the point specified
public Vector2 GetScreenPosition(uint point)
{
Vector2 ret = new Vector2(NDalicPINVOKE.Touch_GetScreenPosition(swigCPtr, point), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Retrieves the radius of the press point.
/// This is the average of both the horizontal and vertical radii of the press point.
/// If point is greater than GetPointCount() then this method will return 0.0f.
///
/// The point required
/// The radius of the press point
public float GetRadius(uint point)
{
float ret = NDalicPINVOKE.Touch_GetRadius(swigCPtr, point);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Retrieves BOTH the horizontal and the vertical radii of the press point.
/// If point is greater than GetPointCount() then this method will return Vector2.Zero.
///
/// The point required
/// The horizontal and vertical radii of the press point
public Vector2 GetEllipseRadius(uint point)
{
Vector2 ret = new Vector2(NDalicPINVOKE.Touch_GetEllipseRadius(swigCPtr, point), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Retrieves the touch pressure.
/// The pressure range starts at 0.0f.
/// Normal pressure is defined as 1.0f.
/// A value between 0.0f and 1.0f means light pressure has been applied.
/// A value greater than 1.0f means more pressure than normal has been applied.
/// If point is greater than GetPointCount() then this method will return 1.0f.
///
/// point The point required
/// The touch pressure
public float GetPressure(uint point)
{
float ret = NDalicPINVOKE.Touch_GetPressure(swigCPtr, point);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal Degree GetAngle(uint point)
{
Degree ret = new Degree(NDalicPINVOKE.Touch_GetAngle(swigCPtr, point), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
///
/// Enumeration for point state type.
///
public enum PointStateType
{
Started,
Finished,
Down = Started,
Up = Finished,
Motion,
Leave,
Stationary,
Interrupted
}
}