a435797590556298712e2d529408e5edf1ffbfe3
[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         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ActivatedSignalType obj)
31         {
32             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
33         }
34
35         /// <summary>
36         /// Dispose
37         /// </summary>
38         /// <since_tizen> 3 </since_tizen>
39         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
40         {
41             Interop.ActivatedSignalType.delete_ActivatedSignalType(swigCPtr);
42         }
43
44         /// <summary>
45         /// Queries whether there are any connected slots.
46         /// </summary>
47         /// <returns>True if there are any slots connected to the signal</returns>
48         /// <since_tizen> 3 </since_tizen>
49         public bool Empty()
50         {
51             bool ret = Interop.ActivatedSignalType.ActivatedSignalType_Empty(swigCPtr);
52             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
53             return ret;
54         }
55
56         /// <summary>
57         /// Queries the number of slots.
58         /// </summary>
59         /// <returns>The number of slots connected to this signal</returns>
60         /// <since_tizen> 3 </since_tizen>
61         public uint GetConnectionCount()
62         {
63             uint ret = Interop.ActivatedSignalType.ActivatedSignalType_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         /// <since_tizen> 3 </since_tizen>
73         public void Connect(System.Delegate func)
74         {
75             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
76             {
77                 Interop.ActivatedSignalType.ActivatedSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
78                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79             }
80         }
81
82         /// <summary>
83         /// Disconnects a function.
84         /// </summary>
85         /// <param name="func">The function to disconnect</param>
86         /// <since_tizen> 3 </since_tizen>
87         public void Disconnect(System.Delegate func)
88         {
89             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
90             {
91                 Interop.ActivatedSignalType.ActivatedSignalType_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="arg">The first value to pass to callbacks</param>
100         /// <since_tizen> 5 </since_tizen>
101         public void Emit(InputMethodContext arg)
102         {
103             Interop.ActivatedSignalType.ActivatedSignalType_Emit(swigCPtr, InputMethodContext.getCPtr(arg));
104             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
105         }
106
107         /// <summary>
108         /// The contructor.
109         /// </summary>
110         /// <since_tizen> 3 </since_tizen>
111         public ActivatedSignalType() : this(Interop.ActivatedSignalType.new_ActivatedSignalType(), true)
112         {
113             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
114         }
115     }
116 }