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) : base(cPtr, cMemoryOwn)
60 /// The time (in ms) that the hover event occurred.
62 /// <since_tizen> 3 </since_tizen>
67 uint ret = Interop.Hover.GetTime(SwigCPtr);
68 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
74 /// Returns the ID of the device used for the point specified.<br />
75 /// Each point has a unique device ID which specifies the device used for that
76 /// point. This is returned by this method.<br />
77 /// If a point is greater than GetPointCount(), then this method will return -1.<br />
79 /// <param name="point">The point required.</param>
80 /// <returns>The device ID of this point.</returns>
81 /// <since_tizen> 3 </since_tizen>
82 public int GetDeviceId(uint point)
84 int ret = Interop.Hover.GetDeviceId(SwigCPtr, point);
85 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90 /// Retrieves the state of the point specified.<br />
91 /// If a point is greater than GetPointCount(), then this method will return PointState.Finished.<br />
93 /// <param name="point">The point required.</param>
94 /// <returns>The state of the point specified.</returns>
95 /// <since_tizen> 3 </since_tizen>
96 public PointStateType GetState(uint point)
98 PointStateType ret = (PointStateType)Interop.Hover.GetState(SwigCPtr, point);
99 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104 /// Retrieves the view that was underneath the point specified.<br />
105 /// If a point is greater than GetPointCount(), then this method will return an empty handle.<br />
107 /// <param name="point">The point required.</param>
108 /// <returns>The view that was underneath the point specified.</returns>
109 /// <since_tizen> 3 </since_tizen>
110 public View GetHitView(uint point)
112 global::System.IntPtr cPtr = Interop.Hover.GetHitActor(SwigCPtr, point);
113 View ret = this.GetInstanceSafely<View>(cPtr);
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119 /// Retrieves the coordinates relative to the top-left of the hit-view at the point specified.
121 /// <param name="point">The point required.</param>
122 /// <returns>The coordinates relative to the top-left of the hit-view of the point specified.</returns>
123 /// <since_tizen> 3 </since_tizen>
124 public Vector2 GetLocalPosition(uint point)
126 Vector2 ret = new Vector2(Interop.Hover.GetLocalPosition(SwigCPtr, point), false);
127 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
132 /// Retrieves the coordinates relative to the top-left of the screen of the point specified.
134 /// <param name="point">The point required.</param>
135 /// <returns>The coordinates relative to the top-left of the screen of the point specified.</returns>
136 /// <since_tizen> 3 </since_tizen>
137 public Vector2 GetScreenPosition(uint point)
139 Vector2 ret = new Vector2(Interop.Hover.GetScreenPosition(SwigCPtr, point), false);
140 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
145 /// Returns the total number of points.
147 /// <returns>Total number of points.</returns>
148 /// <since_tizen> 3 </since_tizen>
149 public uint GetPointCount()
151 uint ret = Interop.Hover.GetPointCount(SwigCPtr);
152 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156 internal static Hover GetHoverFromPtr(global::System.IntPtr cPtr)
158 Hover ret = new Hover(cPtr, false);
159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163 /// This will not be public opened.
164 [EditorBrowsable(EditorBrowsableState.Never)]
165 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
167 Interop.Hover.DeleteHover(swigCPtr);