[NUI] Add WindowMouseInOutEvent (#5242)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Window / MouseInOut.cs
1 /*
2  * Copyright(c) 2023 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     /// MouseInOut is used when the mouse enters or exits a window.
24     /// </summary>
25     [EditorBrowsable(EditorBrowsableState.Never)]
26     public class MouseInOut : Disposable
27     {
28
29         /// <summary>
30         /// The default constructor.
31         /// </summary>
32         [EditorBrowsable(EditorBrowsableState.Never)]
33         public MouseInOut() : this(Interop.MouseInOut.NewMouseInOut((int)MouseInOut.StateType.None, 0, Vector2.getCPtr(new Vector2(0, 0)), 0), true)
34         {
35             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
36         }
37
38         /// <summary>
39         /// The constructor.
40         /// </summary>
41         /// <param name="state">The state of the event.</param>
42         /// <param name="modifiers">Modifier keys pressed during the event (such as Shift, Alt, and Ctrl).</param>
43         /// <param name="point">The coordinates of the cursor relative to the top-left of the screen.</param>
44         /// <param name="timeStamp">The time the event is being started.</param>
45         [EditorBrowsable(EditorBrowsableState.Never)]
46         public MouseInOut(MouseInOut.StateType state, uint modifiers, Vector2 point, uint timeStamp) : this(Interop.MouseInOut.NewMouseInOut((int)state, modifiers, Vector2.getCPtr(point), timeStamp), true)
47         {
48             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
49         }
50
51         internal MouseInOut(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
52         {
53         }
54
55         /// <summary>
56         /// The state of the mouse event.
57         /// </summary>
58         [EditorBrowsable(EditorBrowsableState.Never)]
59         public enum StateType
60         {
61             /// <summary>
62             /// Default value
63             /// </summary>
64             [EditorBrowsable(EditorBrowsableState.Never)]
65             None,
66
67             /// <summary>
68             /// Mouse entered
69             /// </summary>
70             [EditorBrowsable(EditorBrowsableState.Never)]
71             In,
72
73             /// <summary>
74             /// Mouse exited
75             /// </summary>
76             [EditorBrowsable(EditorBrowsableState.Never)]
77             Out
78         }
79
80         /// <summary>
81         /// The state of the mouse event.
82         /// </summary>
83         [EditorBrowsable(EditorBrowsableState.Never)]
84         public MouseInOut.StateType State
85         {
86             get
87             {
88                 return state;
89             }
90         }
91
92         /// <summary>
93         /// Modifier keys pressed during the event (such as Shift, Alt, and Ctrl).
94         /// </summary>
95         [EditorBrowsable(EditorBrowsableState.Never)]
96         public uint Modifiers
97         {
98             get
99             {
100                 return modifiers;
101             }
102         }
103
104         /// <summary>
105         /// The coordinates of the cursor relative to the top-left of the screen.
106         /// </summary>
107         [EditorBrowsable(EditorBrowsableState.Never)]
108         public Vector2 Point
109         {
110             get
111             {
112                 return point;
113             }
114         }
115
116         /// <summary>
117         /// The time the mouse evnet is being started
118         /// </summary>
119         [EditorBrowsable(EditorBrowsableState.Never)]
120         public uint TimeStamp
121         {
122             get
123             {
124                 return timeStamp;
125             }
126         }
127
128         /// <summary>
129         /// Get the device class the mouse event originated from.
130         /// </summary>
131         [EditorBrowsable(EditorBrowsableState.Never)]
132         public DeviceClassType DeviceClass
133         {
134             get
135             {
136                 return deviceClass;
137             }
138         }
139
140         /// <summary>
141         /// Get the device subclass the mouse event originated from.
142         /// </summary>
143         [EditorBrowsable(EditorBrowsableState.Never)]
144         public DeviceSubClassType DeviceSubClass
145         {
146             get
147             {
148                 return deviceSubClass;
149             }
150         }
151
152         private MouseInOut.StateType state
153         {
154             get
155             {
156                 MouseInOut.StateType ret = (MouseInOut.StateType)Interop.MouseInOut.TypeGet(SwigCPtr);
157                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158                 return ret;
159             }
160         }
161
162         private uint modifiers
163         {
164             get
165             {
166                 uint ret = Interop.MouseInOut.ModifiersGet(SwigCPtr);
167                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168                 return ret;
169             }
170         }
171
172         private Vector2 point
173         {
174             get
175             {
176                 global::System.IntPtr cPtr = Interop.MouseInOut.PointGet(SwigCPtr);
177                 Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false);
178                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179                 return ret;
180             }
181         }
182
183         private uint timeStamp
184         {
185             get
186             {
187                 uint ret = Interop.MouseInOut.TimeStampGet(SwigCPtr);
188                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189                 return ret;
190             }
191         }
192
193         private DeviceClassType deviceClass
194         {
195             get
196             {
197                 int ret = Interop.MouseInOut.DeviceClassGet(SwigCPtr);
198                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
199                 return (DeviceClassType)ret;
200             }
201         }
202
203         private DeviceSubClassType deviceSubClass
204         {
205             get
206             {
207                 int ret = Interop.MouseInOut.DeviceSubClassGet(SwigCPtr);
208                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
209                 return (DeviceSubClassType)ret;
210             }
211         }
212
213         internal static MouseInOut GetMouseInOutFromPtr(global::System.IntPtr cPtr)
214         {
215             MouseInOut ret = new MouseInOut(cPtr, false);
216             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
217             return ret;
218         }
219
220         /// This will not be public opened.
221         [EditorBrowsable(EditorBrowsableState.Never)]
222         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
223         {
224             Interop.MouseInOut.DeleteMouseInOut(swigCPtr);
225         }
226     }
227 }