2 using System.Collections.Generic;
4 using System.Runtime.InteropServices;
8 class ComponentApplication : Application
10 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
11 private List<NUIFrameComponent> _frameComponentList;
13 internal ComponentApplication(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
15 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
16 _frameComponentList = new List<NUIFrameComponent>();
19 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ComponentApplication obj)
21 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
24 protected override void Dispose(DisposeTypes type)
31 //Release your own unmanaged resources here.
32 //You should not access any managed member here except static instance.
33 //because the execution order of Finalizes is non-deterministic.
34 if (swigCPtr.Handle != global::System.IntPtr.Zero)
39 Interop.ComponentApplication.delete_ComponentApplication(swigCPtr);
41 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
46 public static ComponentApplication NewComponentApplication(string[] args, string stylesheet)
48 ComponentApplication ret = New(args, stylesheet);
49 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
54 public static ComponentApplication New(string[] args, string stylesheet)
56 int argc = args.Length;
57 string argvStr = string.Join(" ", args);
59 IntPtr widgetIntPtr = Interop.ComponentApplication.ComponentApplication_New(argc, argvStr, stylesheet);
61 ComponentApplication ret = new ComponentApplication(widgetIntPtr, false);
63 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68 internal ComponentApplication(ComponentApplication componentApplication) : this(Interop.ComponentApplication.new_ComponentApplication__SWIG_1(ComponentApplication.getCPtr(componentApplication)), true)
70 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
73 internal ComponentApplication Assign(ComponentApplication componentApplication)
75 ComponentApplication ret = new ComponentApplication(Interop.ComponentApplication.ComponentApplication_Assign(swigCPtr, ComponentApplication.getCPtr(componentApplication)), false);
76 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
82 private delegate IntPtr NUIComponentApplicationCreatenativeEventCallbackDelegate(IntPtr data);
84 public delegate IntPtr CreateNativeEventHandler(IntPtr data);
85 private CreateNativeEventHandler _applicationCreateNativeEventHandler;
86 private NUIComponentApplicationCreatenativeEventCallbackDelegate _applicationCreateNativeEventCallbackDelegate;
90 * @brief Event for Initialized signal which can be used to subscribe/unsubscribe the event handler
91 * provided by the user. Initialized signal is emitted when application is initialised
93 public event CreateNativeEventHandler CreateNative
99 // Restricted to only one listener
100 if (_applicationCreateNativeEventHandler == null)
102 _applicationCreateNativeEventHandler += value;
104 _applicationCreateNativeEventCallbackDelegate = new NUIComponentApplicationCreatenativeEventCallbackDelegate(OnApplicationCreateNative);
105 Connect(_applicationCreateNativeEventCallbackDelegate);
114 if (_applicationCreateNativeEventHandler != null)
116 Disconnect(_applicationCreateNativeEventCallbackDelegate);
119 _applicationCreateNativeEventHandler -= value;
125 public void Connect(System.Delegate func)
127 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
129 Interop.ComponentApplication.ComponentApplication_CreateNativeSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
130 if (NDalicPINVOKE.SWIGPendingException.Pending)
132 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
137 public void Disconnect(System.Delegate func)
139 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
141 Interop.ComponentApplication.ComponentApplication_CreateNativeSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
142 if (NDalicPINVOKE.SWIGPendingException.Pending)
144 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
149 internal ApplicationSignal CreateNativeSignal()
151 ApplicationSignal ret = new ApplicationSignal(Interop.ComponentApplication.ComponentApplication_CreateNativeSignal(swigCPtr), false);
152 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158 // Callback for Application InitSignal
159 private IntPtr OnApplicationCreateNative(IntPtr data)
161 IntPtr ptr = IntPtr.Zero;
163 if (_applicationCreateNativeEventHandler != null)
165 ptr = _applicationCreateNativeEventHandler.Invoke(data);
170 internal void RegisterFrameComponent(NUIFrameComponent nuiFrameComponent)
172 _frameComponentList.Add(nuiFrameComponent);
175 internal int GetFrameComponentCount()
177 return _frameComponentList.Count;