2 * Copyright(c) 2020 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.
17 using System.ComponentModel;
18 using Tizen.NUI.BaseComponents;
23 /// Hover events are a collection of points at a specific moment in time.<br />
24 /// When a multi-event occurs, each point represents the points that are currently being
25 /// hovered or the points where a hover has stopped.<br />
27 /// <since_tizen> 3 </since_tizen>
28 public class Hover : BaseHandle
32 /// The default constructor.
34 /// <since_tizen> 3 </since_tizen>
35 public Hover() : this(Interop.Hover.Hover_New(0u), true)
37 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
43 /// <param name="time">The time the event occurred.</param>
44 internal Hover(uint time) : this(Interop.Hover.Hover_New(time), true)
46 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
49 internal Hover(Hover other) : this(Interop.Hover.new_Hover__SWIG_1(Hover.getCPtr(other)), true)
51 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
54 internal Hover(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Hover.Hover_SWIGUpcast(cPtr), cMemoryOwn)
59 /// The time (in ms) that the hover event occurred.
61 /// <since_tizen> 3 </since_tizen>
66 uint ret = Interop.Hover.Hover_GetTime(swigCPtr);
67 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
73 /// Returns the ID of the device used for the point specified.<br />
74 /// Each point has a unique device ID which specifies the device used for that
75 /// point. This is returned by this method.<br />
76 /// If a point is greater than GetPointCount(), then this method will return -1.<br />
78 /// <param name="point">The point required.</param>
79 /// <returns>The device ID of this point.</returns>
80 /// <since_tizen> 3 </since_tizen>
81 public int GetDeviceId(uint point)
83 int ret = Interop.Hover.Hover_GetDeviceId(swigCPtr, point);
84 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89 /// Retrieves the state of the point specified.<br />
90 /// If a point is greater than GetPointCount(), then this method will return PointState.Finished.<br />
92 /// <param name="point">The point required.</param>
93 /// <returns>The state of the point specified.</returns>
94 /// <since_tizen> 3 </since_tizen>
95 public PointStateType GetState(uint point)
97 PointStateType ret = (PointStateType)Interop.Hover.Hover_GetState(swigCPtr, point);
98 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103 /// Retrieves the view that was underneath the point specified.<br />
104 /// If a point is greater than GetPointCount(), then this method will return an empty handle.<br />
106 /// <param name="point">The point required.</param>
107 /// <returns>The view that was underneath the point specified.</returns>
108 /// <since_tizen> 3 </since_tizen>
109 public View GetHitView(uint point)
111 global::System.IntPtr cPtr = Interop.Hover.Hover_GetHitActor(swigCPtr, point);
112 View ret = this.GetInstanceSafely<View>(cPtr);
113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118 /// Retrieves the coordinates relative to the top-left of the hit-view at the point specified.
120 /// <param name="point">The point required.</param>
121 /// <returns>The coordinates relative to the top-left of the hit-view of the point specified.</returns>
122 /// <since_tizen> 3 </since_tizen>
123 public Vector2 GetLocalPosition(uint point)
125 Vector2 ret = new Vector2(Interop.Hover.Hover_GetLocalPosition(swigCPtr, point), false);
126 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131 /// Retrieves the coordinates relative to the top-left of the screen of the point specified.
133 /// <param name="point">The point required.</param>
134 /// <returns>The coordinates relative to the top-left of the screen of the point specified.</returns>
135 /// <since_tizen> 3 </since_tizen>
136 public Vector2 GetScreenPosition(uint point)
138 Vector2 ret = new Vector2(Interop.Hover.Hover_GetScreenPosition(swigCPtr, point), false);
139 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144 /// Returns the total number of points.
146 /// <returns>Total number of points.</returns>
147 /// <since_tizen> 3 </since_tizen>
148 public uint GetPointCount()
150 uint ret = Interop.Hover.Hover_GetPointCount(swigCPtr);
151 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
155 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Hover obj)
157 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
160 internal static Hover GetHoverFromPtr(global::System.IntPtr cPtr)
162 Hover ret = new Hover(cPtr, false);
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 /// This will not be public opened.
168 [EditorBrowsable(EditorBrowsableState.Never)]
169 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
171 Interop.Hover.delete_Hover(swigCPtr);