[NUI] Refactor dispose pattern to reduce duplication (#1112)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / ListEventSignalType.cs
1 /*
2  * Copyright(c) 2019 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;
18 using System.Runtime.InteropServices;
19 using System.ComponentModel;
20
21 namespace Tizen.NUI
22 {
23     internal class ListEventSignalType : Disposable
24     {
25
26         internal ListEventSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
27         {
28         }
29
30         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ListEventSignalType obj)
31         {
32             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
33         }
34
35         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
36         {
37             Interop.ListEventSignalType.delete_ListEventSignalType(swigCPtr);
38         }
39
40         /// <summary>
41         /// Queries whether there are any connected slots.
42         /// </summary>
43         /// <returns>True if there are any slots connected to the signal</returns>
44         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
45         [EditorBrowsable(EditorBrowsableState.Never)]
46         public bool Empty()
47         {
48             bool ret = Interop.ListEventSignalType.ListEventSignalType_Empty(swigCPtr);
49             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
50             return ret;
51         }
52
53         /// <summary>
54         /// Queries the number of slots.
55         /// </summary>
56         /// <returns>The number of slots connected to this signal</returns>
57         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
58         [EditorBrowsable(EditorBrowsableState.Never)]
59         public uint GetConnectionCount()
60         {
61             uint ret = Interop.ListEventSignalType.ListEventSignalType_GetConnectionCount(swigCPtr);
62             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63             return ret;
64         }
65
66         /// <summary>
67         /// Connects a function.
68         /// </summary>
69         /// <param name="func">The function to connect</param>
70         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
71         [EditorBrowsable(EditorBrowsableState.Never)]
72         public void Connect(System.Delegate func)
73         {
74             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
75             {
76                 Interop.ListEventSignalType.ListEventSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
77                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
78             }
79         }
80
81         /// <summary>
82         /// Disconnects a function.
83         /// </summary>
84         /// <param name="func">The function to disconnect</param>
85         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
86         [EditorBrowsable(EditorBrowsableState.Never)]
87         public void Disconnect(System.Delegate func)
88         {
89             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
90             {
91                 Interop.ListEventSignalType.ListEventSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
92                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93             }
94         }
95
96         /// <summary>
97         /// Emits the signal.
98         /// </summary>
99         /// <param name="arg1">The first value to pass to callbacks</param>
100         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
101         [EditorBrowsable(EditorBrowsableState.Never)]
102         public void Emit(BaseComponents.View arg1)
103         {
104             Interop.ListEventSignalType.ListEventSignalType_Emit(swigCPtr, BaseComponents.View.getCPtr(arg1));
105             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106         }
107
108         /// <summary>
109         /// The contructor.
110         /// </summary>
111         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
112         [EditorBrowsable(EditorBrowsableState.Never)]
113         public ListEventSignalType() : this(Interop.ListEventSignalType.new_ListEventSignalType(), true)
114         {
115             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116         }
117     }
118 }