2 using System.Collections.Generic;
4 using System.Runtime.InteropServices;
8 class ComponentApplication : Application
10 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
12 internal ComponentApplication(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
14 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
17 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ComponentApplication obj)
19 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
22 protected override void Dispose(DisposeTypes type)
29 //Release your own unmanaged resources here.
30 //You should not access any managed member here except static instance.
31 //because the execution order of Finalizes is non-deterministic.
32 if (swigCPtr.Handle != global::System.IntPtr.Zero)
37 Interop.ComponentApplication.DeleteComponentApplication(swigCPtr);
39 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
44 public static ComponentApplication NewComponentApplication(string[] args, string stylesheet)
46 ComponentApplication ret = New(args, stylesheet);
47 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
52 public static ComponentApplication New(string[] args, string stylesheet)
54 int argc = args.Length;
55 string argvStr = string.Join(" ", args);
57 IntPtr widgetIntPtr = Interop.ComponentApplication.New(argc, argvStr, stylesheet);
59 ComponentApplication ret = new ComponentApplication(widgetIntPtr, false);
61 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
66 internal ComponentApplication(ComponentApplication componentApplication) : this(Interop.ComponentApplication.NewComponentApplication(ComponentApplication.getCPtr(componentApplication)), true)
68 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
71 internal ComponentApplication Assign(ComponentApplication componentApplication)
73 ComponentApplication ret = new ComponentApplication(Interop.ComponentApplication.Assign(swigCPtr, ComponentApplication.getCPtr(componentApplication)), false);
74 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
80 private delegate IntPtr NUIComponentApplicationCreatenativeEventCallbackDelegate();
82 public delegate IntPtr CreateNativeEventHandler();
83 private CreateNativeEventHandler _applicationCreateNativeEventHandler;
84 private NUIComponentApplicationCreatenativeEventCallbackDelegate _applicationCreateNativeEventCallbackDelegate;
88 * @brief Event for Initialized signal which can be used to subscribe/unsubscribe the event handler
89 * provided by the user. Initialized signal is emitted when application is initialised
91 public event CreateNativeEventHandler CreateNative
95 // Restricted to only one listener
96 if (_applicationCreateNativeEventHandler == null)
98 _applicationCreateNativeEventHandler += value;
100 _applicationCreateNativeEventCallbackDelegate = new NUIComponentApplicationCreatenativeEventCallbackDelegate(OnApplicationCreateNative);
101 Connect(_applicationCreateNativeEventCallbackDelegate);
107 if (_applicationCreateNativeEventHandler != null)
109 Disconnect(_applicationCreateNativeEventCallbackDelegate);
112 _applicationCreateNativeEventHandler -= value;
117 public void Connect(System.Delegate func)
119 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
121 Interop.ComponentApplication.CreateNativeSignalConnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
122 if (NDalicPINVOKE.SWIGPendingException.Pending)
124 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129 public void Disconnect(System.Delegate func)
131 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
133 Interop.ComponentApplication.CreateNativeSignalDisconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
134 if (NDalicPINVOKE.SWIGPendingException.Pending)
136 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141 internal ApplicationSignal CreateNativeSignal()
143 ApplicationSignal ret = new ApplicationSignal(Interop.ComponentApplication.CreateNativeSignal(swigCPtr), false);
144 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
148 // Callback for Application InitSignal
149 private IntPtr OnApplicationCreateNative()
151 IntPtr handle = IntPtr.Zero;
153 if (_applicationCreateNativeEventHandler != null)
155 handle = _applicationCreateNativeEventHandler.Invoke();