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