adc49607852ab082aebc26c38b69eaa39197e488
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / ActivatedSignalType.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 ActivatedSignalType : Disposable
24     {
25
26         internal ActivatedSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
27         {
28         }
29
30         /// <summary>
31         /// Dispose
32         /// </summary>
33         /// <since_tizen> 3 </since_tizen>
34         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
35         {
36             Interop.ActivatedSignalType.DeleteActivatedSignalType(swigCPtr);
37         }
38
39         /// <summary>
40         /// Queries whether there are any connected slots.
41         /// </summary>
42         /// <returns>True if there are any slots connected to the signal</returns>
43         /// <since_tizen> 3 </since_tizen>
44         public bool Empty()
45         {
46             bool ret = Interop.ActivatedSignalType.ActivatedSignalTypeEmpty(swigCPtr);
47             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
48             return ret;
49         }
50
51         /// <summary>
52         /// Queries the number of slots.
53         /// </summary>
54         /// <returns>The number of slots connected to this signal</returns>
55         /// <since_tizen> 3 </since_tizen>
56         public uint GetConnectionCount()
57         {
58             uint ret = Interop.ActivatedSignalType.ActivatedSignalTypeGetConnectionCount(swigCPtr);
59             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
60             return ret;
61         }
62
63         /// <summary>
64         /// Connects a function.
65         /// </summary>
66         /// <param name="func">The function to connect</param>
67         /// <since_tizen> 3 </since_tizen>
68         public void Connect(System.Delegate func)
69         {
70             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
71             {
72                 Interop.ActivatedSignalType.ActivatedSignalTypeConnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
73                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74             }
75         }
76
77         /// <summary>
78         /// Disconnects a function.
79         /// </summary>
80         /// <param name="func">The function to disconnect</param>
81         /// <since_tizen> 3 </since_tizen>
82         public void Disconnect(System.Delegate func)
83         {
84             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
85             {
86                 Interop.ActivatedSignalType.ActivatedSignalTypeDisconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
87                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
88             }
89         }
90
91         /// <summary>
92         /// Emits the signal.
93         /// </summary>
94         /// <param name="arg">The first value to pass to callbacks</param>
95         /// <since_tizen> 5 </since_tizen>
96         public void Emit(InputMethodContext arg)
97         {
98             Interop.ActivatedSignalType.ActivatedSignalTypeEmit(swigCPtr, InputMethodContext.getCPtr(arg));
99             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100         }
101
102         /// <summary>
103         /// The contructor.
104         /// </summary>
105         /// <since_tizen> 3 </since_tizen>
106         public ActivatedSignalType() : this(Interop.ActivatedSignalType.NewActivatedSignalType(), true)
107         {
108             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
109         }
110     }
111 }