1 //------------------------------------------------------------------------------
4 // This file was automatically generated by SWIG (http://www.swig.org).
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
14 /// Touch events are a collection of points at a specific moment in time.<br>
15 /// When a multi-touch event occurs, each point represents the points that are currently being
16 /// touched or the points where a touch has stopped.<br>
18 public class Touch : BaseHandle
20 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
22 internal Touch(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Touch_SWIGUpcast(cPtr), cMemoryOwn)
24 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
27 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Touch obj)
29 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
34 DisposeQueue.Instance.Add(this);
37 public override void Dispose()
39 if (!Stage.IsInstalled())
41 DisposeQueue.Instance.Add(this);
47 if (swigCPtr.Handle != global::System.IntPtr.Zero)
52 NDalicPINVOKE.delete_Touch(swigCPtr);
54 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
56 global::System.GC.SuppressFinalize(this);
62 internal static Touch GetTouchFromPtr(global::System.IntPtr cPtr)
64 Touch ret = new Touch(cPtr, false);
65 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
70 /// An uninitialized Touch instance.<br>
71 /// Calling member functions with an uninitialized Touch handle is not allowed.<br>
73 public Touch() : this(NDalicPINVOKE.new_Touch__SWIG_0(), true)
75 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
78 internal Touch(Touch other) : this(NDalicPINVOKE.new_Touch__SWIG_1(Touch.getCPtr(other)), true)
80 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
83 internal Touch Assign(Touch other)
85 Touch ret = new Touch(NDalicPINVOKE.Touch_Assign(swigCPtr, Touch.getCPtr(other)), false);
86 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91 /// Returns the time (in ms) that the touch event occurred.
93 /// <returns>The time (in ms) that the touch event occurred</returns>
96 uint ret = NDalicPINVOKE.Touch_GetTime(swigCPtr);
97 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
102 /// Returns the total number of points in this TouchData.
104 /// <returns>Total number of Points</returns>
105 public uint GetPointCount()
107 uint ret = NDalicPINVOKE.Touch_GetPointCount(swigCPtr);
108 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113 /// Returns the ID of the device used for the Point specified.<br>
114 /// Each point has a unique device ID which specifies the device used for that
115 /// point. This is returned by this method.<br>
116 /// If point is greater than GetPointCount() then this method will return -1.<br>
118 /// <param name="point">The point required</param>
119 /// <returns>The Device ID of this point</returns>
120 public int GetDeviceId(uint point)
122 int ret = NDalicPINVOKE.Touch_GetDeviceId(swigCPtr, point);
123 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
128 /// Retrieves the State of the point specified.<br>
129 /// If point is greater than GetPointCount() then this method will return PointState.Finished.<br>
131 /// <param name="point">The point required</param>
132 /// <returns>The state of the point specified</returns>
133 public PointStateType GetState(uint point)
135 PointStateType ret = (PointStateType)NDalicPINVOKE.Touch_GetState(swigCPtr, point);
136 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141 /// Retrieves the actor that was underneath the point specified.<br>
142 /// If point is greater than GetPointCount() then this method will return an empty handle.<br>
144 /// <param name="point">The point required</param>
145 /// <returns>The actor that was underneath the point specified</returns>
146 public Actor GetHitActor(uint point)
148 Actor ret = new Actor(NDalicPINVOKE.Touch_GetHitActor(swigCPtr, point), true);
149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154 /// Retrieves the co-ordinates relative to the top-left of the hit-actor at the point specified.<br>
155 /// The top-left of an actor is (0.0, 0.0, 0.5).<br>
156 /// If you require the local coordinates of another actor (e.g the parent of the hit actor),
157 /// then you should use Actor::ScreenToLocal().<br>
158 /// If point is greater than GetPointCount() then this method will return Vector2.Zero.<br>
160 /// <param name="point">The point required</param>
161 /// <returns>The co-ordinates relative to the top-left of the hit-actor of the point specified</returns>
162 public Vector2 GetLocalPosition(uint point)
164 Vector2 ret = new Vector2(NDalicPINVOKE.Touch_GetLocalPosition(swigCPtr, point), false);
165 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170 /// Retrieves the co-ordinates relative to the top-left of the screen of the point specified.<br>
171 /// If point is greater than GetPointCount() then this method will return Vector2.Zero.<br>
173 /// <param name="point">The point required</param>
174 /// <returns>The co-ordinates relative to the top-left of the screen of the point specified</returns>
175 public Vector2 GetScreenPosition(uint point)
177 Vector2 ret = new Vector2(NDalicPINVOKE.Touch_GetScreenPosition(swigCPtr, point), false);
178 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183 /// Retrieves the radius of the press point.<br>
184 /// This is the average of both the horizontal and vertical radii of the press point.<br>
185 /// If point is greater than GetPointCount() then this method will return 0.0f.<br>
187 /// <param name="point">The point required</param>
188 /// <returns>The radius of the press point</returns>
189 public float GetRadius(uint point)
191 float ret = NDalicPINVOKE.Touch_GetRadius(swigCPtr, point);
192 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197 /// Retrieves BOTH the horizontal and the vertical radii of the press point.<br>
198 /// If point is greater than GetPointCount() then this method will return Vector2.Zero.<br>
200 /// <param name="point">The point required</param>
201 /// <returns>The horizontal and vertical radii of the press point</returns>
202 public Vector2 GetEllipseRadius(uint point)
204 Vector2 ret = new Vector2(NDalicPINVOKE.Touch_GetEllipseRadius(swigCPtr, point), false);
205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210 /// Retrieves the touch pressure.<br>
211 /// The pressure range starts at 0.0f.<br>
212 /// Normal pressure is defined as 1.0f.<br>
213 /// A value between 0.0f and 1.0f means light pressure has been applied.<br>
214 /// A value greater than 1.0f means more pressure than normal has been applied.<br>
215 /// If point is greater than GetPointCount() then this method will return 1.0f.<br>
217 /// <param name="point">point The point required</param>
218 /// <returns>The touch pressure</returns>
219 public float GetPressure(uint point)
221 float ret = NDalicPINVOKE.Touch_GetPressure(swigCPtr, point);
222 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
226 internal Degree GetAngle(uint point)
228 Degree ret = new Degree(NDalicPINVOKE.Touch_GetAngle(swigCPtr, point), true);
229 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
236 /// Enumeration for point state type.
238 public enum PointStateType
241 /// Touch or hover started
245 /// Touch or hover finished
257 /// Finger dragged or hovered
261 /// Leave the boundary of an actor
265 /// No change from last event. <br>
266 /// Useful when a multi-point event occurs where all points are sent but indicates that this particular point has not changed since the last time.
270 /// A system event has occurred which has interrupted the touch or hover event sequence.