From: Sunghyun Kim Date: Thu, 8 Jul 2021 07:15:06 +0000 (+0900) Subject: [NUI] Add Api for getting window from view X-Git-Tag: accepted/tizen/unified/20231205.024657~1698 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=674695c2ddcdc537b53b282e59da5e5cc0e80658;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [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. --- 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
///