From 4e623c9551428cf98de8a930267304b9ea8dbff4 Mon Sep 17 00:00:00 2001 From: huiyueun <35286162+huiyueun@users.noreply.github.com> Date: Tue, 23 Jun 2020 11:25:03 +0900 Subject: [PATCH] [NUI] Modify Component-application window (#1711) Signed-off-by: huiyu.eun --- src/Tizen.NUI/src/internal/ComponentApplication.cs | 42 ++++++++-------------- .../src/internal/NUIComponentCoreBackend.cs | 4 +-- src/Tizen.NUI/src/public/NUIFrameComponent.cs | 18 +++++----- 3 files changed, 25 insertions(+), 39 deletions(-) diff --git a/src/Tizen.NUI/src/internal/ComponentApplication.cs b/src/Tizen.NUI/src/internal/ComponentApplication.cs index 6c186ab..e2ef652 100755 --- a/src/Tizen.NUI/src/internal/ComponentApplication.cs +++ b/src/Tizen.NUI/src/internal/ComponentApplication.cs @@ -8,12 +8,10 @@ namespace Tizen.NUI class ComponentApplication : Application { private global::System.Runtime.InteropServices.HandleRef swigCPtr; - private List _frameComponentList; 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) @@ -77,14 +75,14 @@ namespace Tizen.NUI return ret; } - + [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate IntPtr NUIComponentApplicationCreatenativeEventCallbackDelegate(IntPtr data); + private delegate IntPtr NUIComponentApplicationCreatenativeEventCallbackDelegate(); - public delegate IntPtr CreateNativeEventHandler(IntPtr data); - private CreateNativeEventHandler _applicationCreateNativeEventHandler; + public delegate IntPtr CreateNativeEventHandler(); + private CreateNativeEventHandler _applicationCreateNativeEventHandler; private NUIComponentApplicationCreatenativeEventCallbackDelegate _applicationCreateNativeEventCallbackDelegate; - + /** * @brief Event for Initialized signal which can be used to subscribe/unsubscribe the event handler @@ -152,31 +150,19 @@ namespace Tizen.NUI 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) + // Callback for Application InitSignal + private IntPtr OnApplicationCreateNative() { - _frameComponentList.Add(nuiFrameComponent); - } + IntPtr handle = IntPtr.Zero; - internal int GetFrameComponentCount() - { - return _frameComponentList.Count; - } + if (_applicationCreateNativeEventHandler != null) + { + handle = _applicationCreateNativeEventHandler.Invoke(); + } + return handle; + } } diff --git a/src/Tizen.NUI/src/internal/NUIComponentCoreBackend.cs b/src/Tizen.NUI/src/internal/NUIComponentCoreBackend.cs index c7c13d9..b5334c0 100755 --- a/src/Tizen.NUI/src/internal/NUIComponentCoreBackend.cs +++ b/src/Tizen.NUI/src/internal/NUIComponentCoreBackend.cs @@ -131,8 +131,7 @@ namespace Tizen.NUI /// /// Callback for Component Application CreateSignal /// - /// user data - private IntPtr OnCreateNative(IntPtr data) + private IntPtr OnCreateNative() { IntPtr nativeComponentFactoryMap = IntPtr.Zero; int n = 0; @@ -141,7 +140,6 @@ namespace Tizen.NUI nativeComponentFactoryMap = entry.Value.Bind(nativeComponentFactoryMap); n++; } - return nativeComponentFactoryMap; } diff --git a/src/Tizen.NUI/src/public/NUIFrameComponent.cs b/src/Tizen.NUI/src/public/NUIFrameComponent.cs index c6746bf..e9d577b 100755 --- a/src/Tizen.NUI/src/public/NUIFrameComponent.cs +++ b/src/Tizen.NUI/src/public/NUIFrameComponent.cs @@ -15,6 +15,7 @@ namespace Tizen.NUI [EditorBrowsable(EditorBrowsableState.Never)] public class NUIFrameComponent : FrameComponent { + private bool defaultWindowSet = false; internal NUIWindowInfo NUIWindowInfo { get; @@ -36,17 +37,18 @@ namespace Tizen.NUI public override IWindowInfo CreateWindowInfo() { ComponentApplication instance = ComponentApplication.Instance as ComponentApplication; - if(instance) + if (instance) { - instance.RegisterFrameComponent(this); - if(instance.GetFrameComponentCount() == 1) + if (!defaultWindowSet) { - Window = instance.GetWindow(); - } - else - { - Window = new Window(); + instance.GetWindow().WindowPositionSize = new Rectangle(0, 0, 1, 1); + instance.GetWindow().BackgroundColor = new Color(0, 0, 0, 0); + instance.GetWindow().Hide(); + defaultWindowSet = true; } + + Window = new Window(); + Window.Show(); } NUIWindowInfo = new NUIWindowInfo(Window); return NUIWindowInfo; -- 2.7.4