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