[NUI] Add WindowMouseInOutEvent (#5242)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Window / WindowMouseInOutEventSignal.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 Tizen.NUI.BaseComponents;
18
19 namespace Tizen.NUI
20 {
21     internal class WindowMouseInOutEventSignal : Disposable
22     {
23         internal WindowMouseInOutEventSignal(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
24         {
25         }
26
27         /// <summary>
28         /// Dispose
29         /// </summary>
30         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
31         {
32             Interop.WindowMouseInOutEventSignal.DeleteWindowMouseInOutEventSignal(swigCPtr);
33         }
34
35         /// <summary>
36         /// Queries whether there are any connected slots.
37         /// </summary>
38         /// <returns>True if there are any slots connected to the signal</returns>
39         public bool Empty()
40         {
41             bool ret = Interop.WindowMouseInOutEventSignal.Empty(SwigCPtr);
42             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
43             return ret;
44         }
45
46         /// <summary>
47         /// Queries the number of slots.
48         /// </summary>
49         /// <returns>The number of slots connected to this signal</returns>
50         public uint GetConnectionCount()
51         {
52             uint ret = Interop.WindowMouseInOutEventSignal.GetConnectionCount(SwigCPtr);
53             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
54             return ret;
55         }
56
57         /// <summary>
58         /// Connects a function.
59         /// </summary>
60         /// <param name="func">The function to connect</param>
61         public void Connect(System.Delegate func)
62         {
63             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
64             {
65                 Interop.WindowMouseInOutEventSignal.Connect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
66                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
67             }
68         }
69
70         /// <summary>
71         /// Disconnects a function.
72         /// </summary>
73         /// <param name="func">The function to disconnect</param>
74         public void Disconnect(System.Delegate func)
75         {
76             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
77             {
78                 Interop.WindowMouseInOutEventSignal.Disconnect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
79                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
80             }
81         }
82
83         /// <summary>
84         /// Emits the signal.
85         /// </summary>
86         /// <param name="window">The first value to pass to callbacks</param>
87         /// <param name="mouseInOut">The second value to pass to callbacks</param>
88         public void Emit(Window window, MouseInOut mouseInOut)
89         {
90             Interop.WindowMouseInOutEventSignal.Emit(SwigCPtr, Window.getCPtr(window), MouseInOut.getCPtr(mouseInOut));
91             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
92         }
93
94         /// <summary>
95         /// The constructor.
96         /// </summary>
97         public WindowMouseInOutEventSignal(Window window) : this(Interop.WindowMouseInOutEventSignal.GetSignal(Window.getCPtr(window)), false)
98         {
99             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100         }
101     }
102 }