2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 using System.ComponentModel;
20 using System.Runtime.CompilerServices;
26 public const string Lib = "libdali2-csharp-binder.so";
27 protected class SWIGExceptionHelper
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);
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);
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)
69 SWIGPendingException.Set(new global::System.ApplicationException(message, SWIGPendingException.Retrieve()));
71 static void SetPendingArithmeticException(string message)
73 SWIGPendingException.Set(new global::System.ArithmeticException(message, SWIGPendingException.Retrieve()));
75 static void SetPendingDivideByZeroException(string message)
77 SWIGPendingException.Set(new global::System.DivideByZeroException(message, SWIGPendingException.Retrieve()));
79 static void SetPendingIndexOutOfRangeException(string message)
81 SWIGPendingException.Set(new global::System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve()));
83 static void SetPendingInvalidCastException(string message)
85 SWIGPendingException.Set(new global::System.InvalidCastException(message, SWIGPendingException.Retrieve()));
87 static void SetPendingInvalidOperationException(string message)
89 SWIGPendingException.Set(new global::System.InvalidOperationException(message, SWIGPendingException.Retrieve()));
91 static void SetPendingIOException(string message)
93 SWIGPendingException.Set(new global::System.IO.IOException(message, SWIGPendingException.Retrieve()));
95 static void SetPendingNullReferenceException(string message)
97 SWIGPendingException.Set(new global::System.NullReferenceException(message, SWIGPendingException.Retrieve()));
99 static void SetPendingOutOfMemoryException(string message)
101 SWIGPendingException.Set(new global::System.OutOfMemoryException(message, SWIGPendingException.Retrieve()));
103 static void SetPendingOverflowException(string message)
105 SWIGPendingException.Set(new global::System.OverflowException(message, SWIGPendingException.Retrieve()));
107 static void SetPendingSystemException(string message)
109 SWIGPendingException.Set(new global::System.SystemException(message, SWIGPendingException.Retrieve()));
112 static void SetPendingArgumentException(string message, string paramName)
114 SWIGPendingException.Set(new global::System.ArgumentException(message, paramName, SWIGPendingException.Retrieve()));
116 static void SetPendingArgumentNullException(string message, string paramName)
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));
122 static void SetPendingArgumentOutOfRangeException(string message, string paramName)
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));
128 static SWIGExceptionHelper()
130 SWIGRegisterExceptionCallbacksNDalic(
133 divideByZeroDelegate,
134 indexOutOfRangeDelegate,
136 invalidOperationDelegate,
138 nullReferenceDelegate,
143 SWIGRegisterExceptionArgumentCallbacksNDalic(
145 argumentNullDelegate,
146 argumentOutOfRangeDelegate);
149 protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper();
151 [MethodImpl(MethodImplOptions.AggressiveInlining)]
152 internal static void ThrowExceptionIfExists()
154 if (SWIGPendingException.Pending) throw SWIGPendingException.Retrieve();
157 [System.Diagnostics.Conditional("DEBUG")]
158 internal static void ThrowExceptionIfExistsDebug()
160 if (SWIGPendingException.Pending) throw SWIGPendingException.Retrieve();
163 /// <since_tizen> 3 </since_tizen>
164 public class SWIGPendingException
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();
171 /// <since_tizen> 3 </since_tizen>
172 public static bool Pending
176 bool pending = false;
177 if (numExceptionsPending > 0)
178 if (pendingException != null)
184 /// <since_tizen> 3 </since_tizen>
185 public static void Set(global::System.Exception e)
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)
192 numExceptionsPending++;
196 /// <since_tizen> 3 </since_tizen>
197 public static global::System.Exception Retrieve()
199 global::System.Exception e = null;
200 if (numExceptionsPending > 0)
202 if (pendingException != null)
204 e = pendingException;
205 pendingException = null;
206 lock (exceptionPendingLock)
208 numExceptionsPending--;
214 e = new global::System.ApplicationException($"FATAL: Exception e is null, numExceptionsPending : {numExceptionsPending}");
219 public class SWIGStringHelper
221 /// <since_tizen> 3 </since_tizen>
222 public delegate string SWIGStringDelegate(string message);
223 static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);
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)
231 static SWIGStringHelper()
233 SWIGRegisterStringCallbackNDalic(stringDelegate);
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()
243 static protected SWIGStringHelper swigStringHelper = new SWIGStringHelper();
244 static NDalicPINVOKE()
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
326 internal static class NDalicExtension
328 [MethodImpl(MethodImplOptions.AggressiveInlining)]
329 internal static global::System.Runtime.InteropServices.HandleRef ToHandleRef(this Delegate caller, object wrapper)
331 return new global::System.Runtime.InteropServices.HandleRef(wrapper, global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<Delegate>(caller));