[NUI] Refactor dispose pattern to reduce duplication (#1112)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / ContentReceivedSignalType.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 ContentReceivedSignalType : Disposable
24     {
25         /// <summary>
26         /// ContentReceivedSignalType
27         /// </summary>
28
29         internal ContentReceivedSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
30         {
31         }
32
33         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ContentReceivedSignalType obj)
34         {
35             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
36         }
37
38         /// <summary>
39         /// Dispose
40         /// </summary>
41         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
42         {
43             Interop.ContentReceivedSignalType.delete_ContentReceivedSignalType(swigCPtr);
44         }
45
46         /// <summary>
47         /// Queries whether there are any connected slots.
48         /// </summary>
49         /// <returns>True if there are any slots connected to the signal</returns>
50         public bool Empty()
51         {
52             bool ret = Interop.ContentReceivedSignalType.ContentReceivedSignalType_Empty(swigCPtr);
53             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
54             return ret;
55         }
56
57         /// <summary>
58         /// Queries the number of slots.
59         /// </summary>
60         /// <returns>The number of slots connected to this signal</returns>
61         public uint GetConnectionCount()
62         {
63             uint ret = Interop.ContentReceivedSignalType.ContentReceivedSignalType_GetConnectionCount(swigCPtr);
64             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
65             return ret;
66         }
67
68         /// <summary>
69         /// Connects a function.
70         /// </summary>
71         /// <param name="func">The function to connect</param>
72         public void Connect(System.Delegate func)
73         {
74             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
75             {
76                 Interop.ContentReceivedSignalType.ContentReceivedSignalType_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         public void Disconnect(System.Delegate func)
86         {
87             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
88             {
89                 Interop.ContentReceivedSignalType.ContentReceivedSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
90                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91             }
92         }
93
94         /// <summary>
95         /// Connects a member function.
96         /// </summary>
97         /// <param name="arg1">The member function to connect</param>
98         /// <param name="arg2">The member function to connect</param>
99         /// <param name="arg3">The member function to connect</param>
100         public void Emit(string arg1, string arg2, string arg3)
101         {
102             Interop.ContentReceivedSignalType.ContentReceivedSignalType_Emit(swigCPtr, arg1, arg2, arg3);
103             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104         }
105
106         /// <summary>
107         /// The contructor.
108         /// </summary>
109         public ContentReceivedSignalType() : this(Interop.ContentReceivedSignalType.new_ContentReceivedSignalType(), true)
110         {
111             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112         }
113     }
114 }