From 674695c2ddcdc537b53b282e59da5e5cc0e80658 Mon Sep 17 00:00:00 2001 From: Sunghyun Kim Date: Thu, 8 Jul 2021 16:15:06 +0900 Subject: [PATCH] [NUI] Add Api for getting window from view In some case, The view needs to know which window it is added to. we can using this api in this case. --- src/Tizen.NUI/src/internal/Interop/Interop.Window.cs | 3 ++- src/Tizen.NUI/src/public/Window/Window.cs | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) mode change 100755 => 100644 src/Tizen.NUI/src/public/Window/Window.cs diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs index be9907c..a2a87a1 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs @@ -246,7 +246,8 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_RequestResizeToServer")] public static extern void RequestResizeToServer(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); - + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_GetWindow")] + public static extern global::System.IntPtr Get(global::System.Runtime.InteropServices.HandleRef jarg1); } } } diff --git a/src/Tizen.NUI/src/public/Window/Window.cs b/src/Tizen.NUI/src/public/Window/Window.cs old mode 100755 new mode 100644 index 376782b..2689d8b --- a/src/Tizen.NUI/src/public/Window/Window.cs +++ b/src/Tizen.NUI/src/public/Window/Window.cs @@ -59,6 +59,25 @@ namespace Tizen.NUI } /// + /// A helper method to get the current window where the view is added + /// + /// The View added to the window + /// A Window. + [EditorBrowsable(EditorBrowsableState.Never)] + static public Window Get(View view) + { + if(view == null) + { + NUILog.Error("if there is no view, it can not get a window"); + return null; + } + + Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Window.Get(View.getCPtr(view))) as Window; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// /// Creates a new Window.
/// This creates an extra window in addition to the default main window
///
-- 2.7.4