[NUI] Add WindowMouseInOutEvent (#5242)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Interop / NDalicPINVOKE.cs
1 /*
2  * Copyright(c) 2021 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
18 using System;
19 using System.ComponentModel;
20 using System.Runtime.CompilerServices;
21
22 namespace Tizen.NUI
23 {
24     class NDalicPINVOKE
25     {
26         public const string Lib = "libdali2-csharp-binder.so";
27         protected class SWIGExceptionHelper
28         {
29             /// <since_tizen> 3 </since_tizen>
30             public delegate void ExceptionDelegate(string message);
31             /// <since_tizen> 3 </since_tizen>
32             public delegate void ExceptionArgumentDelegate(string message, string paramName);
33             static ExceptionDelegate applicationDelegate = new ExceptionDelegate(SetPendingApplicationException);
34             static ExceptionDelegate arithmeticDelegate = new ExceptionDelegate(SetPendingArithmeticException);
35             static ExceptionDelegate divideByZeroDelegate = new ExceptionDelegate(SetPendingDivideByZeroException);
36             static ExceptionDelegate indexOutOfRangeDelegate = new ExceptionDelegate(SetPendingIndexOutOfRangeException);
37             static ExceptionDelegate invalidCastDelegate = new ExceptionDelegate(SetPendingInvalidCastException);
38             static ExceptionDelegate invalidOperationDelegate = new ExceptionDelegate(SetPendingInvalidOperationException);
39             static ExceptionDelegate ioDelegate = new ExceptionDelegate(SetPendingIOException);
40             static ExceptionDelegate nullReferenceDelegate = new ExceptionDelegate(SetPendingNullReferenceException);
41             static ExceptionDelegate outOfMemoryDelegate = new ExceptionDelegate(SetPendingOutOfMemoryException);
42             static ExceptionDelegate overflowDelegate = new ExceptionDelegate(SetPendingOverflowException);
43             static ExceptionDelegate systemDelegate = new ExceptionDelegate(SetPendingSystemException);
44             static ExceptionArgumentDelegate argumentDelegate = new ExceptionArgumentDelegate(SetPendingArgumentException);
45             static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException);
46             static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException);
47
48             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "SWIGRegisterExceptionCallbacks_NDalic")]
49             public static extern void SWIGRegisterExceptionCallbacksNDalic(
50                                         ExceptionDelegate applicationDelegate,
51                                         ExceptionDelegate arithmeticDelegate,
52                                         ExceptionDelegate divideByZeroDelegate,
53                                         ExceptionDelegate indexOutOfRangeDelegate,
54                                         ExceptionDelegate invalidCastDelegate,
55                                         ExceptionDelegate invalidOperationDelegate,
56                                         ExceptionDelegate ioDelegate,
57                                         ExceptionDelegate nullReferenceDelegate,
58                                         ExceptionDelegate outOfMemoryDelegate,
59                                         ExceptionDelegate overflowDelegate,
60                                         ExceptionDelegate systemExceptionDelegate);
61
62             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "SWIGRegisterExceptionArgumentCallbacks_NDalic")]
63             public static extern void SWIGRegisterExceptionArgumentCallbacksNDalic(
64                                         ExceptionArgumentDelegate argumentDelegate,
65                                         ExceptionArgumentDelegate argumentNullDelegate,
66                                         ExceptionArgumentDelegate argumentOutOfRangeDelegate);
67             static void SetPendingApplicationException(string message)
68             {
69                 SWIGPendingException.Set(new global::System.ApplicationException(message, SWIGPendingException.Retrieve()));
70             }
71             static void SetPendingArithmeticException(string message)
72             {
73                 SWIGPendingException.Set(new global::System.ArithmeticException(message, SWIGPendingException.Retrieve()));
74             }
75             static void SetPendingDivideByZeroException(string message)
76             {
77                 SWIGPendingException.Set(new global::System.DivideByZeroException(message, SWIGPendingException.Retrieve()));
78             }
79             static void SetPendingIndexOutOfRangeException(string message)
80             {
81                 SWIGPendingException.Set(new global::System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve()));
82             }
83             static void SetPendingInvalidCastException(string message)
84             {
85                 SWIGPendingException.Set(new global::System.InvalidCastException(message, SWIGPendingException.Retrieve()));
86             }
87             static void SetPendingInvalidOperationException(string message)
88             {
89                 SWIGPendingException.Set(new global::System.InvalidOperationException(message, SWIGPendingException.Retrieve()));
90             }
91             static void SetPendingIOException(string message)
92             {
93                 SWIGPendingException.Set(new global::System.IO.IOException(message, SWIGPendingException.Retrieve()));
94             }
95             static void SetPendingNullReferenceException(string message)
96             {
97                 SWIGPendingException.Set(new global::System.NullReferenceException(message, SWIGPendingException.Retrieve()));
98             }
99             static void SetPendingOutOfMemoryException(string message)
100             {
101                 SWIGPendingException.Set(new global::System.OutOfMemoryException(message, SWIGPendingException.Retrieve()));
102             }
103             static void SetPendingOverflowException(string message)
104             {
105                 SWIGPendingException.Set(new global::System.OverflowException(message, SWIGPendingException.Retrieve()));
106             }
107             static void SetPendingSystemException(string message)
108             {
109                 SWIGPendingException.Set(new global::System.SystemException(message, SWIGPendingException.Retrieve()));
110             }
111
112             static void SetPendingArgumentException(string message, string paramName)
113             {
114                 SWIGPendingException.Set(new global::System.ArgumentException(message, paramName, SWIGPendingException.Retrieve()));
115             }
116             static void SetPendingArgumentNullException(string message, string paramName)
117             {
118                 global::System.Exception e = SWIGPendingException.Retrieve();
119                 if (e != null) message = message + " Inner Exception: " + e.Message;
120                 SWIGPendingException.Set(new global::System.ArgumentNullException(message, paramName));
121             }
122             static void SetPendingArgumentOutOfRangeException(string message, string paramName)
123             {
124                 global::System.Exception e = SWIGPendingException.Retrieve();
125                 if (e != null) message = message + " Inner Exception: " + e.Message;
126                 SWIGPendingException.Set(new global::System.ArgumentOutOfRangeException(paramName, message));
127             }
128             static SWIGExceptionHelper()
129             {
130                 SWIGRegisterExceptionCallbacksNDalic(
131                                           applicationDelegate,
132                                           arithmeticDelegate,
133                                           divideByZeroDelegate,
134                                           indexOutOfRangeDelegate,
135                                           invalidCastDelegate,
136                                           invalidOperationDelegate,
137                                           ioDelegate,
138                                           nullReferenceDelegate,
139                                           outOfMemoryDelegate,
140                                           overflowDelegate,
141                                           systemDelegate);
142
143                 SWIGRegisterExceptionArgumentCallbacksNDalic(
144                                           argumentDelegate,
145                                           argumentNullDelegate,
146                                           argumentOutOfRangeDelegate);
147             }
148         }
149         protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper();
150
151         [MethodImpl(MethodImplOptions.AggressiveInlining)]
152         internal static void ThrowExceptionIfExists()
153         {
154             if (SWIGPendingException.Pending) throw SWIGPendingException.Retrieve();
155         }
156
157         [System.Diagnostics.Conditional("DEBUG")]
158         internal static void ThrowExceptionIfExistsDebug()
159         {
160             if (SWIGPendingException.Pending) throw SWIGPendingException.Retrieve();
161         }
162
163         /// <since_tizen> 3 </since_tizen>
164         public class SWIGPendingException
165         {
166             [global::System.ThreadStatic]
167             private static global::System.Exception pendingException = null;
168             private static int numExceptionsPending = 0;
169             private static readonly object exceptionPendingLock = new object();
170
171             /// <since_tizen> 3 </since_tizen>
172             public static bool Pending
173             {
174                 get
175                 {
176                     bool pending = false;
177                     if (numExceptionsPending > 0)
178                         if (pendingException != null)
179                             pending = true;
180                     return pending;
181                 }
182             }
183
184             /// <since_tizen> 3 </since_tizen>
185             public static void Set(global::System.Exception e)
186             {
187                 if (pendingException != null)
188                     throw new global::System.ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e);
189                 pendingException = e;
190                 lock (exceptionPendingLock)
191                 {
192                     numExceptionsPending++;
193                 }
194             }
195
196             /// <since_tizen> 3 </since_tizen>
197             public static global::System.Exception Retrieve()
198             {
199                 global::System.Exception e = null;
200                 if (numExceptionsPending > 0)
201                 {
202                     if (pendingException != null)
203                     {
204                         e = pendingException;
205                         pendingException = null;
206                         lock (exceptionPendingLock)
207                         {
208                             numExceptionsPending--;
209                         }
210                     }
211                 }
212                 if (e == null)
213                 {
214                     e = new global::System.ApplicationException($"FATAL: Exception e is null, numExceptionsPending : {numExceptionsPending}");
215                 }
216                 return e;
217             }
218         }
219         public class SWIGStringHelper
220         {
221             /// <since_tizen> 3 </since_tizen>
222             public delegate string SWIGStringDelegate(string message);
223             static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);
224
225             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "SWIGRegisterStringCallback_NDalic")]
226             public static extern void SWIGRegisterStringCallbackNDalic(SWIGStringDelegate stringDelegate);
227             static string CreateString(string cString)
228             {
229                 return cString;
230             }
231             static SWIGStringHelper()
232             {
233                 SWIGRegisterStringCallbackNDalic(stringDelegate);
234             }
235
236             [Obsolete("Do not use this, that is deprecated in API9 and will be removed in API11. Delete this if currently used.")]
237             [EditorBrowsable(EditorBrowsableState.Never)]
238             public static void RegistCallback()
239             {
240                 //do nothing!
241             }
242         }
243         static protected SWIGStringHelper swigStringHelper = new SWIGStringHelper();
244         static NDalicPINVOKE()
245         {
246         }
247
248         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_BaseHandle")]
249         public static extern void DeleteBaseHandle(global::System.Runtime.InteropServices.HandleRef jarg1);
250
251         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_SWIGUpcast")]
252         public static extern global::System.IntPtr ApplicationUpcast(global::System.IntPtr jarg1);
253
254         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_New__MANUAL_4")]
255         public static extern global::System.IntPtr ApplicationNewManual4(int jarg1, string jarg2, string jarg3, int jarg4);
256
257         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_New_WithWindowSizePosition")]
258         public static extern global::System.IntPtr ApplicationNewWithWindowSizePosition(int jarg1, string jarg2, string jarg3, int jarg4, global::System.Runtime.InteropServices.HandleRef jarg5);
259
260         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_MainLoop__SWIG_0")]
261         public static extern void ApplicationMainLoop(global::System.Runtime.InteropServices.HandleRef jarg1);
262
263         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_InitSignal")]
264         public static extern global::System.IntPtr ApplicationInitSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
265
266         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_TerminateSignal")]
267         public static extern global::System.IntPtr ApplicationTerminateSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
268
269         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_PauseSignal")]
270         public static extern global::System.IntPtr ApplicationPauseSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
271
272         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_ResumeSignal")]
273         public static extern global::System.IntPtr ApplicationResumeSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
274
275         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_ResetSignal")]
276         public static extern global::System.IntPtr ApplicationResetSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
277
278         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_AppControlSignal")]
279         public static extern global::System.IntPtr ApplicationAppControlSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
280
281         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_LanguageChangedSignal")]
282         public static extern global::System.IntPtr ApplicationLanguageChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
283
284         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_RegionChangedSignal")]
285         public static extern global::System.IntPtr ApplicationRegionChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
286
287         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_LowBatterySignal")]
288         public static extern global::System.IntPtr ApplicationLowBatterySignal(global::System.Runtime.InteropServices.HandleRef jarg1);
289
290         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_LowMemorySignal")]
291         public static extern global::System.IntPtr ApplicationLowMemorySignal(global::System.Runtime.InteropServices.HandleRef jarg1);
292
293         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_DeviceOrientationChangedSignal")]
294         public static extern global::System.IntPtr ApplicationDeviceOrientationChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
295
296         //Task
297         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_TaskInitSignal")]
298         public static extern global::System.IntPtr ApplicationTaskInitSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
299
300         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_TaskTerminateSignal")]
301         public static extern global::System.IntPtr ApplicationTaskTerminateSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
302
303         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_TaskAppControlSignal")]
304         public static extern global::System.IntPtr ApplicationTaskAppControlSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
305
306         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_TaskLanguageChangedSignal")]
307         public static extern global::System.IntPtr ApplicationTaskLanguageChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
308
309         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_TaskRegionChangedSignal")]
310         public static extern global::System.IntPtr ApplicationTaskRegionChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
311
312         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_TaskLowBatterySignal")]
313         public static extern global::System.IntPtr ApplicationTaskLowBatterySignal(global::System.Runtime.InteropServices.HandleRef jarg1);
314
315         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_TaskLowMemorySignal")]
316         public static extern global::System.IntPtr ApplicationTaskLowMemorySignal(global::System.Runtime.InteropServices.HandleRef jarg1);
317
318         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_TaskDeviceOrientationChangedSignal")]
319         public static extern global::System.IntPtr ApplicationTaskDeviceOrientationChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
320
321         [Obsolete("This has been deprecated in API9 and will be removed in API11. Use NDalicPINVOKE.DeleteBaseHandle(...) instead.")]
322         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_BaseHandle")]
323         public static extern void delete_BaseHandle(global::System.Runtime.InteropServices.HandleRef jarg1);
324     }
325
326     internal static class NDalicExtension
327     {
328         [MethodImpl(MethodImplOptions.AggressiveInlining)]
329         internal static global::System.Runtime.InteropServices.HandleRef ToHandleRef(this Delegate caller, object wrapper)
330         {
331             return new global::System.Runtime.InteropServices.HandleRef(wrapper, global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<Delegate>(caller));
332         }
333     }
334 }