From 553e4e32554a37365d1a7b68a3e8d7c703bb114d Mon Sep 17 00:00:00 2001 From: huiyueun <35286162+huiyueun@users.noreply.github.com> Date: Fri, 29 Nov 2019 14:25:42 +0900 Subject: [PATCH] [NUI] Add Component Application (#1148) * Add component Signed-off-by: huiyu.eun * Change Bug Signed-off-by: huiyu.eun * [NUI]Modify Last Signed-off-by: huiyu.eun * Add to mange frame component Signed-off-by: huiyu.eun * Change Sln file Signed-off-by: huiyu.eun * Change mod Signed-off-by: huiyu.eun * Change sln Signed-off-by: huiyu.eun * [NUI] fix comment Signed-off-by: huiyu.eun --- .../AssemblyAttr.cs | 16 ++ src/Tizen.NUI/Tizen.NUI.csproj | 1 + src/Tizen.NUI/Tizen.NUI.sln | 2 + src/Tizen.NUI/src/internal/ComponentApplication.cs | 193 +++++++++++++++++++++ .../Interop/Interop.ComponentApplication.cs | 50 ++++++ .../src/internal/Interop/Interop.Window.cs | 3 + .../src/internal/NUIComponentCoreBackend.cs | 172 ++++++++++++++++++ src/Tizen.NUI/src/internal/NUIWindowInfo.cs | 76 ++++++++ .../src/public/NUIComponentApplication.cs | 122 +++++++++++++ src/Tizen.NUI/src/public/NUIFrameComponent.cs | 110 ++++++++++++ src/Tizen.NUI/src/public/Window.cs | 13 ++ 11 files changed, 758 insertions(+) create mode 100755 src/Tizen.Applications.ComponentBased/AssemblyAttr.cs create mode 100755 src/Tizen.NUI/src/internal/ComponentApplication.cs create mode 100755 src/Tizen.NUI/src/internal/Interop/Interop.ComponentApplication.cs create mode 100755 src/Tizen.NUI/src/internal/NUIComponentCoreBackend.cs create mode 100755 src/Tizen.NUI/src/internal/NUIWindowInfo.cs create mode 100755 src/Tizen.NUI/src/public/NUIComponentApplication.cs create mode 100755 src/Tizen.NUI/src/public/NUIFrameComponent.cs diff --git a/src/Tizen.Applications.ComponentBased/AssemblyAttr.cs b/src/Tizen.Applications.ComponentBased/AssemblyAttr.cs new file mode 100755 index 0000000..4134475 --- /dev/null +++ b/src/Tizen.Applications.ComponentBased/AssemblyAttr.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Tizen.NUI, " + PublicKey.Value)] + +internal static class PublicKey +{ + internal const string Value = + "PublicKey=0024000004800000940000000602000000240000525341310004000001000100d115b100424841" + + "6b12d21b626cfb17149c9303fe394693fd3b32d7872e89559a4fa96c98110c2e62eea48aca693b" + + "ddbe17094ca8ea2e2cd79970ca590fb672b9b371b5d7002076817321f62d6483ea50c56dbd1f37" + + "b185a4c24c47718876e6ae6d266508c551170d4cbdda3f82edaff9405ee3d7857282d8269e8e518d2f0fb2"; +} \ No newline at end of file diff --git a/src/Tizen.NUI/Tizen.NUI.csproj b/src/Tizen.NUI/Tizen.NUI.csproj index 18c7bc6..7df2266 100755 --- a/src/Tizen.NUI/Tizen.NUI.csproj +++ b/src/Tizen.NUI/Tizen.NUI.csproj @@ -14,6 +14,7 @@ + diff --git a/src/Tizen.NUI/Tizen.NUI.sln b/src/Tizen.NUI/Tizen.NUI.sln index b086733..bcf6ac3 100755 --- a/src/Tizen.NUI/Tizen.NUI.sln +++ b/src/Tizen.NUI/Tizen.NUI.sln @@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\T EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{2AEDCAA7-543F-48A1-BEA3-CF3E14F6EDC2}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.ComponentBased", "..\Tizen.Applications.ComponentBased\Tizen.Applications.ComponentBased.csproj", "{A9B4744E-EECC-44B6-8357-843DD20617EC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/src/Tizen.NUI/src/internal/ComponentApplication.cs b/src/Tizen.NUI/src/internal/ComponentApplication.cs new file mode 100755 index 0000000..ed07bcb --- /dev/null +++ b/src/Tizen.NUI/src/internal/ComponentApplication.cs @@ -0,0 +1,193 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + class ComponentApplication : Application + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + private List _frameComponentList; + private static ComponentApplication _instance; //singleton + + internal ComponentApplication(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + _frameComponentList = new List(); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ComponentApplication obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + Interop.ComponentApplication.delete_ComponentApplication(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + base.Dispose(type); + } + + public new static ComponentApplication Instance + { + get + { + return _instance; + } + } + + public static ComponentApplication NewComponentApplication(string[] args, string stylesheet) + { + ComponentApplication ret = New(args, stylesheet); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + _instance = ret; + return ret; + } + + public static ComponentApplication New(string[] args, string stylesheet) + { + int argc = args.Length; + string argvStr = string.Join(" ", args); + + IntPtr widgetIntPtr = Interop.ComponentApplication.ComponentApplication_New(argc, argvStr, stylesheet); + + ComponentApplication ret = new ComponentApplication(widgetIntPtr, false); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + return ret; + } + + internal ComponentApplication(ComponentApplication componentApplication) : this(Interop.ComponentApplication.new_ComponentApplication__SWIG_1(ComponentApplication.getCPtr(componentApplication)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal ComponentApplication Assign(ComponentApplication componentApplication) + { + ComponentApplication ret = new ComponentApplication(Interop.ComponentApplication.ComponentApplication_Assign(swigCPtr, ComponentApplication.getCPtr(componentApplication)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate IntPtr NUIComponentApplicationCreatenativeEventCallbackDelegate(IntPtr data); + + public delegate IntPtr CreateNativeEventHandler(IntPtr data); + private CreateNativeEventHandler _applicationCreateNativeEventHandler; + private NUIComponentApplicationCreatenativeEventCallbackDelegate _applicationCreateNativeEventCallbackDelegate; + + + /** + * @brief Event for Initialized signal which can be used to subscribe/unsubscribe the event handler + * provided by the user. Initialized signal is emitted when application is initialised + */ + public event CreateNativeEventHandler CreateNative + { + add + { + lock (this) + { + // Restricted to only one listener + if (_applicationCreateNativeEventHandler == null) + { + _applicationCreateNativeEventHandler += value; + + _applicationCreateNativeEventCallbackDelegate = new NUIComponentApplicationCreatenativeEventCallbackDelegate(OnApplicationCreateNative); + Connect(_applicationCreateNativeEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_applicationCreateNativeEventHandler != null) + { + Disconnect(_applicationCreateNativeEventCallbackDelegate); + } + + _applicationCreateNativeEventHandler -= value; + } + } + } + + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + Interop.ComponentApplication.ComponentApplication_CreateNativeSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + { + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + Interop.ComponentApplication.ComponentApplication_CreateNativeSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + { + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + } + + internal ApplicationSignal CreateNativeSignal() + { + ApplicationSignal ret = new ApplicationSignal(Interop.ComponentApplication.ComponentApplication_CreateNativeSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + + // Callback for Application InitSignal + private IntPtr OnApplicationCreateNative(IntPtr data) + { + IntPtr ptr = IntPtr.Zero; + + if (_applicationCreateNativeEventHandler != null) + { + ptr = _applicationCreateNativeEventHandler.Invoke(data); + } + return ptr; + } + + internal void RegisterFrameComponent(NUIFrameComponent nuiFrameComponent) + { + _frameComponentList.Add(nuiFrameComponent); + } + + internal int GetFrameComponentCount() + { + return _frameComponentList.Count; + } + + + } + + +} diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.ComponentApplication.cs b/src/Tizen.NUI/src/internal/Interop/Interop.ComponentApplication.cs new file mode 100755 index 0000000..dab1716 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Interop/Interop.ComponentApplication.cs @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tizen.NUI +{ + internal static partial class Interop + { + internal static partial class ComponentApplication + { + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_ComponentApplication")] + public static extern global::System.IntPtr ComponentApplication_New(int argc, string argv, string styleSheet); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_ComponentApplication_SWIG1")] + public static extern global::System.IntPtr new_ComponentApplication__SWIG_1(global::System.Runtime.InteropServices.HandleRef swigCPtr); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_assign_ComponentApplication")] + public static extern global::System.IntPtr ComponentApplication_Assign(global::System.Runtime.InteropServices.HandleRef swigCPtr, global::System.Runtime.InteropServices.HandleRef swigCPtr2); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_ComponentApplication")] + public static extern global::System.IntPtr delete_ComponentApplication(global::System.Runtime.InteropServices.HandleRef swigCPtr); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_ComponentApplication_CreateNativeSignal")] + public static extern global::System.IntPtr ComponentApplication_CreateNativeSignal(global::System.Runtime.InteropServices.HandleRef swigCPtr); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_ComponentApplication_CreateNativeSignal_Connect")] + public static extern global::System.IntPtr ComponentApplication_CreateNativeSignal_Connect(global::System.Runtime.InteropServices.HandleRef swigCPtr, global::System.Runtime.InteropServices.HandleRef func); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_ComponentApplication_CreateNativeSignal_Disconnect")] + public static extern global::System.IntPtr ComponentApplication_CreateNativeSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef swigCPtr, global::System.Runtime.InteropServices.HandleRef func); + } + } +} diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs index bf1bef6..bd225aa 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs @@ -112,6 +112,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GetType")] public static extern int GetType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GetResourceID")] + public static extern int GetResouceID(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_SetNotificationLevel")] public static extern bool SetNotificationLevel(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); diff --git a/src/Tizen.NUI/src/internal/NUIComponentCoreBackend.cs b/src/Tizen.NUI/src/internal/NUIComponentCoreBackend.cs new file mode 100755 index 0000000..c7c13d9 --- /dev/null +++ b/src/Tizen.NUI/src/internal/NUIComponentCoreBackend.cs @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; +using System.Collections.Generic; +using Tizen.Applications.CoreBackend; +using Tizen.Applications; +using Tizen.Applications.ComponentBased.Common; + +namespace Tizen.NUI +{ + class NUIComponentCoreBackend : ICoreBackend + { + private Dictionary _componentFactories; + public Dictionary ComponentFactories + { + set + { + _componentFactories = value; + } + get + { + return _componentFactories; + } + } + + /// + /// Application instance to connect event. + /// + protected ComponentApplication _application; + private string _stylesheet = ""; + + /// + /// Dictionary to contain each type of event callback. + /// + protected IDictionary Handlers = new Dictionary(); + + /// + /// Adds NUIApplication event to Application. + /// Puts each type of event callback in Dictionary. + /// + /// The type of event. + /// The event callback. + public void AddEventHandler(EventType evType, Action handler) + { + Handlers.Add(evType, handler); + } + + /// + /// Adds NUIApplication event to Application. + /// Puts each type of event callback in Dictionary. + /// + /// The argument type for the event. + /// The type of event. + /// The event callback. + public void AddEventHandler(EventType evType, Action handler) where TEventArgs : EventArgs + { + Handlers.Add(evType, handler); + } + + /// + /// The default Constructor. + /// + public NUIComponentCoreBackend() + { + } + + /// + /// The constructor with stylesheet. + /// + public NUIComponentCoreBackend(string stylesheet) + { + _stylesheet = stylesheet; + } + + /// + /// Dispose function. + /// + public void Dispose() + { + if (_application != null) + { + _application.Dispose(); + } + } + + /// + /// Exit Application. + /// + public void Exit() + { + if (_application != null) + { + _application.Quit(); + } + } + + /// + /// Run Application. + /// + /// Arguments from commandline. + public void Run(string[] args) + { + TizenSynchronizationContext.Initialize(); + + args[0] = Tizen.Applications.Application.Current.ApplicationInfo.ExecutablePath; + _application = ComponentApplication.NewComponentApplication(args, _stylesheet); + + _application.Initialized += OnInitialized; + _application.CreateNative += OnCreateNative; + _application.Terminating += OnTerminated; + + _application.MainLoop(); + } + + + /// + /// Callback for Component Application CreateSignal + /// + /// user data + private IntPtr OnCreateNative(IntPtr data) + { + IntPtr nativeComponentFactoryMap = IntPtr.Zero; + int n = 0; + foreach (KeyValuePair entry in _componentFactories) + { + nativeComponentFactoryMap = entry.Value.Bind(nativeComponentFactoryMap); + n++; + } + + return nativeComponentFactoryMap; + } + + /// + /// The Initialized event callback function. + /// + /// The application instance. + /// The event argument for Initialized. + private void OnInitialized(object source, NUIApplicationInitEventArgs e) + { + var createHandler = Handlers[EventType.Created] as Action; + createHandler?.Invoke(); + } + + /// + /// The Terminated event callback function. + /// + /// The application instance. + /// The event argument for Terminated. + private void OnTerminated(object source, NUIApplicationTerminatingEventArgs e) + { + var handler = Handlers[EventType.Terminated] as Action; + handler?.Invoke(); + } + + } +} + diff --git a/src/Tizen.NUI/src/internal/NUIWindowInfo.cs b/src/Tizen.NUI/src/internal/NUIWindowInfo.cs new file mode 100755 index 0000000..9d71e20 --- /dev/null +++ b/src/Tizen.NUI/src/internal/NUIWindowInfo.cs @@ -0,0 +1,76 @@ +using System; +using Tizen.NUI; +using Tizen.Applications.ComponentBased.Common; + +namespace Tizen.NUI +{ + /// + /// Window information class for ComponentApplication + /// + internal class NUIWindowInfo : IWindowInfo + { + private const string LogTag = "Tizen.NUI"; + private Window _win; + private int _resId; + private bool _disposed = false; + + /// + /// Initializes the NUI Window class. + /// + /// The window object of component. + /// 6 + internal NUIWindowInfo(Window win) + { + _win = win; + } + + /// + /// Gets the resource ID of window + /// + /// The native handle of window + public int ResourceId + { + get + { + if (_resId == 0) + { + _resId = _win.ResourceID; + if (_resId != 0) + Log.Info(LogTag, "Fail to get resource ID"); + } + + return _resId; + } + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + _win.Dispose(); + _win = null; + } + _disposed = true; + } + + /// + /// Dispose the window resources + /// + /// + /// 6 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + } + +} + diff --git a/src/Tizen.NUI/src/public/NUIComponentApplication.cs b/src/Tizen.NUI/src/public/NUIComponentApplication.cs new file mode 100755 index 0000000..602bb54 --- /dev/null +++ b/src/Tizen.NUI/src/public/NUIComponentApplication.cs @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using Tizen.Applications; +using Tizen.Applications.ComponentBased; +using Tizen.Applications.ComponentBased.Common; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + /// + /// The class for supporting multi-components application model. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class NUIComponentApplication : CoreApplication + { + private Dictionary _componentFactories = new Dictionary(); + + /// + /// Initializes the ComponentApplication class. + /// + /// The component type information. + /// The key should be a class type of FrameComponent or SubComponent subclass. + /// The value should be a component id which is declared in tizen-manifest.xml. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public NUIComponentApplication(IDictionary typeInfo) : base(new NUIComponentCoreBackend()) + { + foreach (var component in typeInfo) + { + RegisterComponent(component.Key, component.Value); + } + (Backend as NUIComponentCoreBackend).ComponentFactories = _componentFactories; + } + + /// + /// Registers a component. + /// + /// Class type + /// Component ID + /// Thrown when component type is already added or not sub-class of FrameComponent or ServiceComponent + [EditorBrowsable(EditorBrowsableState.Never)] + public void RegisterComponent(Type compType, string compId) + { + if (_componentFactories.ContainsKey(compType)) + { + throw new ArgumentException("Already exist type"); + } + + if (typeof(FrameComponent).IsAssignableFrom(compType)) + { + _componentFactories.Add(compType, new FrameComponentStateManager(compType, compId, null)); + } + else if (typeof(ServiceComponent).IsAssignableFrom(compType)) + { + _componentFactories.Add(compType, new ServiceComponentStateManager(compType, compId, null)); + } + else + { + throw new ArgumentException("compType must be sub type of FrameComponent or ServiceComponent", "compType"); + } + } + + + /// + /// Runs the application's main loop. + /// + /// Arguments from commandline. + /// Thrown when component type is already added to the component. + [EditorBrowsable(EditorBrowsableState.Never)] + public override void Run(string[] args) + { + //Register Callback. + base.Run(args); + } + + /// + /// Exits the main loop of the application. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override void Exit() + { + base.Exit(); + } + + /// + /// This method will be called before running main-loop + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void OnCreate() + { + base.OnCreate(); + } + + /// + /// This method will be called after exiting main-loop + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void OnTerminate() + { + base.OnTerminate(); + } + } +} + diff --git a/src/Tizen.NUI/src/public/NUIFrameComponent.cs b/src/Tizen.NUI/src/public/NUIFrameComponent.cs new file mode 100755 index 0000000..2be71ae --- /dev/null +++ b/src/Tizen.NUI/src/public/NUIFrameComponent.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Text; +using Tizen.Applications; +using Tizen.Applications.ComponentBased.Common; +using Tizen.NUI; + +namespace Tizen.NUI +{ + /// + /// The class for showing UI module + /// + /// 6 + [EditorBrowsable(EditorBrowsableState.Never)] + public class NUIFrameComponent : FrameComponent + { + internal NUIWindowInfo NUIWindowInfo + { + get; + set; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public Window Window + { + get; + set; + } + + /// + /// Overrides this method to create window. It will be called before OnCreate method. + /// + /// Window object to use + [EditorBrowsable(EditorBrowsableState.Never)] + public override IWindowInfo CreateWindowInfo() + { + ComponentApplication.Instance.RegisterFrameComponent(this); + if(ComponentApplication.Instance.GetFrameComponentCount() == 1) + { + Window = ComponentApplication.Instance.GetWindow(); + } + else + { + Window = new Window(); + } + + NUIWindowInfo = new NUIWindowInfo(Window); + return NUIWindowInfo; + } + + /// + /// Overrides this method to handle behavior when the component is launched. + /// + /// True if a service component is successfully created + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool OnCreate() + { + return true; + } + + /// + /// Overrides this method if want to handle behavior when the component receives the appcontrol message. + /// + /// appcontrol object + /// True if it was restarted + [EditorBrowsable(EditorBrowsableState.Never)] + public override void OnStart(AppControl appControl, bool restarted) + { + base.OnStart(appControl, restarted); + } + + /// + /// Overrides this method if you want to handle the behavior when the component is resumed. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override void OnResume() + { + base.OnResume(); + } + + /// + /// Overrides this method if you want to handle the behavior when the component is paused. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override void OnPause() + { + base.OnPause(); + } + + /// + /// Overrides this method if you want to handle the behavior when the component is stopped. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override void OnStop() + { + base.OnStop(); + } + + /// + /// Overrides this method if want to handle behavior when the component is destroyed. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override void OnDestroy() + { + base.OnDestroy(); + } + } +} + diff --git a/src/Tizen.NUI/src/public/Window.cs b/src/Tizen.NUI/src/public/Window.cs index b1749fe..a103a1e 100755 --- a/src/Tizen.NUI/src/public/Window.cs +++ b/src/Tizen.NUI/src/public/Window.cs @@ -207,6 +207,19 @@ namespace Tizen.NUI } /// + /// Get Resource ID of window + /// + internal int ResourceID + { + get + { + int ret = Interop.Window.GetResouceID(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// /// Gets or sets a window type. /// /// 3 -- 2.7.4