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.
18 using System.ComponentModel;
19 using Tizen.NUI.BaseComponents;
24 /// Hover events are a collection of points at a specific moment in time.<br />
25 /// When a multi-event occurs, each point represents the points that are currently being
26 /// hovered or the points where a hover has stopped.<br />
28 /// <since_tizen> 3 </since_tizen>
29 public class Hover : BaseHandle
33 /// The default constructor.
35 /// <since_tizen> 3 </since_tizen>
36 public Hover() : this(Interop.Hover.New(0u), true)
38 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
44 /// <param name="time">The time the event occurred.</param>
45 internal Hover(uint time) : this(Interop.Hover.New(time), true)
47 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
50 internal Hover(Hover other) : this(Interop.Hover.NewHover(Hover.getCPtr(other)), true)
52 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
55 internal Hover(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
59 internal Hover(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister)
64 /// The time (in ms) that the hover event occurred.
66 /// <since_tizen> 3 </since_tizen>
71 uint ret = Interop.Hover.GetTime(SwigCPtr);
72 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
78 /// Returns the ID of the device used for the point specified.<br />
79 /// Each point has a unique device ID which specifies the device used for that
80 /// point. This is returned by this method.<br />
81 /// If a point is greater than GetPointCount(), then this method will return -1.<br />
83 /// <param name="point">The point required.</param>
84 /// <returns>The device ID of this point.</returns>
85 /// <since_tizen> 3 </since_tizen>
86 public int GetDeviceId(uint point)
88 int ret = Interop.Hover.GetDeviceId(SwigCPtr, point);
89 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94 /// Retrieves the state of the point specified.<br />
95 /// If a point is greater than GetPointCount(), then this method will return PointState.Finished.<br />
97 /// <param name="point">The point required.</param>
98 /// <returns>The state of the point specified.</returns>
99 /// <since_tizen> 3 </since_tizen>
100 public PointStateType GetState(uint point)
102 PointStateType ret = (PointStateType)Interop.Hover.GetState(SwigCPtr, point);
103 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
108 /// Retrieves the view that was underneath the point specified.<br />
109 /// If a point is greater than GetPointCount(), then this method will return an empty handle.<br />
111 /// <param name="point">The point required.</param>
112 /// <returns>The view that was underneath the point specified.</returns>
113 /// <since_tizen> 3 </since_tizen>
114 public View GetHitView(uint point)
116 global::System.IntPtr cPtr = Interop.Hover.GetHitActor(SwigCPtr, point);
117 View ret = this.GetInstanceSafely<View>(cPtr);
118 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 /// Retrieves the coordinates relative to the top-left of the hit-view at the point specified.
125 /// <param name="point">The point required.</param>
126 /// <returns>The coordinates relative to the top-left of the hit-view of the point specified.</returns>
127 /// <since_tizen> 3 </since_tizen>
128 public Vector2 GetLocalPosition(uint point)
130 Vector2 ret = new Vector2(Interop.Hover.GetLocalPosition(SwigCPtr, point), false);
131 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
136 /// Retrieves the coordinates relative to the top-left of the screen of the point specified.
138 /// <param name="point">The point required.</param>
139 /// <returns>The coordinates relative to the top-left of the screen of the point specified.</returns>
140 /// <since_tizen> 3 </since_tizen>
141 public Vector2 GetScreenPosition(uint point)
143 Vector2 ret = new Vector2(Interop.Hover.GetScreenPosition(SwigCPtr, point), false);
144 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
149 /// Returns the total number of points.
151 /// <returns>Total number of points.</returns>
152 /// <since_tizen> 3 </since_tizen>
153 public uint GetPointCount()
155 uint ret = Interop.Hover.GetPointCount(SwigCPtr);
156 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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.DeleteHover(swigCPtr);