Release 4.0.0-preview1-00301
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / ImfVoidSignalType.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;
18 using System.Runtime.InteropServices;
19 using System.ComponentModel;
20
21 namespace Tizen.NUI
22 {
23     /// <summary>
24     /// Please do not use! this will be deprecated
25     /// </summary>
26     /// <since_tizen> 3 </since_tizen>
27     [EditorBrowsable(EditorBrowsableState.Never)]
28     public class ImfVoidSignalType : global::System.IDisposable
29     {
30         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
31         /// <summary>
32         /// swigCMemOwn
33         /// </summary>
34         /// <since_tizen> 3 </since_tizen>
35         protected bool swigCMemOwn;
36
37         internal ImfVoidSignalType(global::System.IntPtr cPtr, bool cMemoryOwn)
38         {
39             swigCMemOwn = cMemoryOwn;
40             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
41         }
42
43         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfVoidSignalType obj)
44         {
45             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
46         }
47
48         //A Flag to check who called Dispose(). (By User or DisposeQueue)
49         private bool isDisposeQueued = false;
50         /// <summary>
51         /// A Flat to check if it is already disposed.
52         /// </summary>
53         /// <since_tizen> 3 </since_tizen>
54         protected bool disposed = false;
55
56         /// <summary>
57         /// Dispose
58         /// </summary>
59         /// <since_tizen> 3 </since_tizen>
60         ~ImfVoidSignalType()
61         {
62             if (!isDisposeQueued)
63             {
64                 isDisposeQueued = true;
65                 DisposeQueue.Instance.Add(this);
66             }
67         }
68
69         /// <summary>
70         /// Dispose
71         /// </summary>
72         /// <since_tizen> 3 </since_tizen>
73         public void Dispose()
74         {
75             //Throw excpetion if Dispose() is called in separate thread.
76             if (!Window.IsInstalled())
77             {
78                 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
79             }
80
81             if (isDisposeQueued)
82             {
83                 Dispose(DisposeTypes.Implicit);
84             }
85             else
86             {
87                 Dispose(DisposeTypes.Explicit);
88                 System.GC.SuppressFinalize(this);
89             }
90         }
91
92         /// <summary>
93         /// Dispose
94         /// </summary>
95         /// <since_tizen> 3 </since_tizen>
96         protected virtual void Dispose(DisposeTypes type)
97         {
98             if (disposed)
99             {
100                 return;
101             }
102
103             if (type == DisposeTypes.Explicit)
104             {
105                 //Called by User
106                 //Release your own managed resources here.
107                 //You should release all of your own disposable objects here.
108
109             }
110
111             //Release your own unmanaged resources here.
112             //You should not access any managed member here except static instance.
113             //because the execution order of Finalizes is non-deterministic.
114
115             if (swigCPtr.Handle != global::System.IntPtr.Zero)
116             {
117                 if (swigCMemOwn)
118                 {
119                     swigCMemOwn = false;
120                     NDalicManualPINVOKE.delete_ImfVoidSignalType(swigCPtr);
121                 }
122                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
123             }
124
125             disposed = true;
126         }
127
128         /// <summary>
129         /// The contructor.
130         /// </summary>
131         /// <since_tizen> 3 </since_tizen>
132         public ImfVoidSignalType() : this(NDalicManualPINVOKE.new_ImfVoidSignalType(), true)
133         {
134             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
135         }
136
137         /// <summary>
138         /// Queries whether there are any connected slots.
139         /// </summary>
140         /// <returns>True if there are any slots connected to the signal</returns>
141         /// <since_tizen> 3 </since_tizen>
142         public bool Empty()
143         {
144             bool ret = NDalicManualPINVOKE.ImfVoidSignalType_Empty(swigCPtr);
145             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
146             return ret;
147         }
148
149         /// <summary>
150         /// Queries the number of slots.
151         /// </summary>
152         /// <returns>The number of slots connected to this signal</returns>
153         /// <since_tizen> 3 </since_tizen>
154         public uint GetConnectionCount()
155         {
156             uint ret = NDalicManualPINVOKE.ImfVoidSignalType_GetConnectionCount(swigCPtr);
157             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158             return ret;
159         }
160
161         /// <summary>
162         /// Connects a function.
163         /// </summary>
164         /// <param name="func">The function to connect</param>
165         /// <since_tizen> 3 </since_tizen>
166         public void Connect(System.Delegate func)
167         {
168             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
169             {
170                 NDalicManualPINVOKE.ImfVoidSignalType_Connect__SWIG_0(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
171                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172             }
173         }
174
175         /// <summary>
176         /// Disconnects a function.
177         /// </summary>
178         /// <param name="func">The function to disconnect</param>
179         /// <since_tizen> 3 </since_tizen>
180         public void Disconnect(System.Delegate func)
181         {
182             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
183             {
184                 NDalicManualPINVOKE.ImfVoidSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
185                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186             }
187         }
188         /// <summary>
189         /// Connects a member function.
190         /// </summary>
191         /// <param name="connectionTracker">An object which must implement the ConnectionTrackerInterface</param>
192         /// <param name="arg1">The member function to connect</param>
193         /// <since_tizen> 3 </since_tizen>
194         public void Connect(ConnectionTrackerInterface connectionTracker, SWIGTYPE_p_Dali__FunctorDelegate arg1)
195         {
196             NDalicManualPINVOKE.ImfVoidSignalType_Connect__SWIG_4(swigCPtr, ConnectionTrackerInterface.getCPtr(connectionTracker), SWIGTYPE_p_Dali__FunctorDelegate.getCPtr(arg1));
197             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198         }
199
200         /// <summary>
201         /// Emits the signal.
202         /// </summary>
203         /// <since_tizen> 3 </since_tizen>
204         public void Emit()
205         {
206             NDalicManualPINVOKE.ImfVoidSignalType_Emit(swigCPtr);
207             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208         }
209
210     }
211
212 }