[NUI] TCSACR-226 code change (#1032)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / AdaptorSignalType.cs
1 /*
2  * Copyright(c) 2017 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
19 namespace Tizen.NUI
20 {
21     internal class AdaptorSignalType : Disposable
22     {
23         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
24         /// <summary>
25         /// swigCMemOwn
26         /// </summary>
27         /// <since_tizen> 4 </since_tizen>
28         /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
29         [EditorBrowsable(EditorBrowsableState.Never)]
30         protected bool swigCMemOwn;
31
32         internal AdaptorSignalType(global::System.IntPtr cPtr, bool cMemoryOwn)
33         {
34             swigCMemOwn = cMemoryOwn;
35             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
36         }
37
38         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AdaptorSignalType obj)
39         {
40             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
41         }
42
43         /// <summary>
44         /// Dispose
45         /// </summary>
46         /// <since_tizen> 4 </since_tizen>
47         /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
48         [EditorBrowsable(EditorBrowsableState.Never)]
49         protected override void Dispose(DisposeTypes type)
50         {
51             if (swigCPtr.Handle != global::System.IntPtr.Zero)
52             {
53                 if (swigCMemOwn)
54                 {
55                     swigCMemOwn = false;
56                     Interop.Adaptor.delete_AdaptorSignalType(swigCPtr);
57                 }
58                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
59             }
60             base.Dispose(type);
61         }
62
63         /// <summary>
64         /// Queries whether there are any connected slots.
65         /// </summary>
66         /// <returns>True if there are any slots connected to the signal</returns>
67         /// <since_tizen> 4 </since_tizen>
68         /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
69         [EditorBrowsable(EditorBrowsableState.Never)]
70         public bool Empty()
71         {
72             bool ret = Interop.Adaptor.AdaptorSignalType_Empty(swigCPtr);
73             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74             return ret;
75         }
76
77         /// <summary>
78         /// Queries the number of slots.
79         /// </summary>
80         /// <returns>The number of slots connected to this signal</returns>
81         /// <since_tizen> 4 </since_tizen>
82         /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
83         [EditorBrowsable(EditorBrowsableState.Never)]
84         public uint GetConnectionCount()
85         {
86             uint ret = Interop.Adaptor.AdaptorSignalType_GetConnectionCount(swigCPtr);
87             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
88             return ret;
89         }
90
91         /// <summary>
92         /// Connects a function.
93         /// </summary>
94         /// <param name="func">The function to connect</param>
95         /// <since_tizen> 4 </since_tizen>
96         /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
97         [EditorBrowsable(EditorBrowsableState.Never)]
98         public void Connect(System.Delegate func)
99         {
100             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
101             {
102                 Interop.Adaptor.AdaptorSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
103                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104             }
105         }
106
107         /// <summary>
108         /// Disconnects a function.
109         /// </summary>
110         /// <param name="func">The function to disconnect</param>
111         /// <since_tizen> 4 </since_tizen>
112         /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
113         [EditorBrowsable(EditorBrowsableState.Never)]
114         public void Disconnect(System.Delegate func)
115         {
116             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
117             {
118                 Interop.Adaptor.AdaptorSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
119                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
120             }
121         }
122
123         /// <summary>
124         /// Emits the signal.
125         /// </summary>
126         /// <param name="arg">The first value to pass to callbacks</param>
127         /// <since_tizen> 4 </since_tizen>
128         /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
129         [EditorBrowsable(EditorBrowsableState.Never)]
130         public void Emit(Adaptor arg)
131         {
132             Interop.Adaptor.AdaptorSignalType_Emit(swigCPtr, Adaptor.getCPtr(arg));
133             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134         }
135
136         /// <summary>
137         /// The contructor.
138         /// </summary>
139         /// <since_tizen> 4 </since_tizen>
140         /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
141         [EditorBrowsable(EditorBrowsableState.Never)]
142         public AdaptorSignalType() : this(Interop.Adaptor.new_AdaptorSignalType(), true)
143         {
144             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
145         }
146     }
147 }