[NUI] remove "_" and refactoring naming to pascal case.
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Hover.cs
1 /*
2  * Copyright(c) 2020 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 using System.ComponentModel;
18 using Tizen.NUI.BaseComponents;
19
20 namespace Tizen.NUI
21 {
22     /// <summary>
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 />
26     /// </summary>
27     /// <since_tizen> 3 </since_tizen>
28     public class Hover : BaseHandle
29     {
30
31         /// <summary>
32         /// The default constructor.
33         /// </summary>
34         /// <since_tizen> 3 </since_tizen>
35         public Hover() : this(Interop.Hover.New(0u), true)
36         {
37             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
38         }
39
40         /// <summary>
41         /// The constructor.
42         /// </summary>
43         /// <param name="time">The time the event occurred.</param>
44         internal Hover(uint time) : this(Interop.Hover.New(time), true)
45         {
46             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
47         }
48
49         internal Hover(Hover other) : this(Interop.Hover.NewHover(Hover.getCPtr(other)), true)
50         {
51             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
52         }
53
54         internal Hover(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Hover.Upcast(cPtr), cMemoryOwn)
55         {
56         }
57
58         /// <summary>
59         /// The time (in ms) that the hover event occurred.
60         /// </summary>
61         /// <since_tizen> 3 </since_tizen>
62         public uint Time
63         {
64             get
65             {
66                 uint ret = Interop.Hover.GetTime(swigCPtr);
67                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68                 return ret;
69             }
70         }
71
72         /// <summary>
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 />
77         /// </summary>
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)
82         {
83             int ret = Interop.Hover.GetDeviceId(swigCPtr, point);
84             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
85             return ret;
86         }
87
88         /// <summary>
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 />
91         /// </summary>
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)
96         {
97             PointStateType ret = (PointStateType)Interop.Hover.GetState(swigCPtr, point);
98             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99             return ret;
100         }
101
102         /// <summary>
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 />
105         /// </summary>
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)
110         {
111             global::System.IntPtr cPtr = Interop.Hover.GetHitActor(swigCPtr, point);
112             View ret = this.GetInstanceSafely<View>(cPtr);
113             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
114             return ret;
115         }
116
117         /// <summary>
118         /// Retrieves the coordinates relative to the top-left of the hit-view at the point specified.
119         /// </summary>
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)
124         {
125             Vector2 ret = new Vector2(Interop.Hover.GetLocalPosition(swigCPtr, point), false);
126             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
127             return ret;
128         }
129
130         /// <summary>
131         /// Retrieves the coordinates relative to the top-left of the screen of the point specified.
132         /// </summary>
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)
137         {
138             Vector2 ret = new Vector2(Interop.Hover.GetScreenPosition(swigCPtr, point), false);
139             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140             return ret;
141         }
142
143         /// <summary>
144         /// Returns the total number of points.
145         /// </summary>
146         /// <returns>Total number of points.</returns>
147         /// <since_tizen> 3 </since_tizen>
148         public uint GetPointCount()
149         {
150             uint ret = Interop.Hover.GetPointCount(swigCPtr);
151             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
152             return ret;
153         }
154
155         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Hover obj)
156         {
157             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
158         }
159
160         internal static Hover GetHoverFromPtr(global::System.IntPtr cPtr)
161         {
162             Hover ret = new Hover(cPtr, false);
163             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164             return ret;
165         }
166
167         /// This will not be public opened.
168         [EditorBrowsable(EditorBrowsableState.Never)]
169         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
170         {
171             Interop.Hover.DeleteHover(swigCPtr);
172         }
173     }
174 }