From 33a2741d99f17fa81da4f24b6faee256962980a0 Mon Sep 17 00:00:00 2001 From: huiyueun <35286162+huiyueun@users.noreply.github.com> Date: Tue, 4 Jun 2019 18:40:33 +0900 Subject: [PATCH] [NUI] Add API for NUI Multi WIndow (#875) * [NUI] Clean code ImageView Signed-off-by: huiyu.eun * Add API for NUI Multi Window --- .../src/internal/Interop/Interop.Window.cs | 19 ++ .../src/public/BaseComponents/ImageView.cs | 223 ++++++++---------- src/Tizen.NUI/src/public/Layer.cs | 22 +- src/Tizen.NUI/src/public/NUIApplication.cs | 8 - src/Tizen.NUI/src/public/Window.cs | 111 +++++++-- 5 files changed, 224 insertions(+), 159 deletions(-) diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs index 099ac9817..570eb6655 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs @@ -196,7 +196,26 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Adaptor_RenderOnce")] public static extern void Window_RenderOnce(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_Add")] + public static extern void Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_Remove")] + public static extern void Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_SetBackgroundColor")] + public static extern void SetBackgroundColor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_GetBackgroundColor")] + public static extern global::System.IntPtr GetBackgroundColor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_GetRootLayer")] + public static extern global::System.IntPtr GetRootLayer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_KeyEventSignal")] + public static extern global::System.IntPtr KeyEventSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_TouchSignal")] + public static extern global::System.IntPtr TouchSignal(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GrabKeyTopmost")] public static extern bool GrabKeyTopmost(System.IntPtr Window, int DaliKey); diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs index 9c27b0116..6074ba7bb 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs @@ -34,21 +34,18 @@ namespace Tizen.NUI.BaseComponents public static readonly BindableProperty ResourceUrlProperty = BindableProperty.Create(nameof(ImageView.ResourceUrl), typeof(string), typeof(ImageView), string.Empty, propertyChanged: (bindable, oldValue, newValue) => { var imageView = (ImageView)bindable; - if (newValue != null) - { - string url = (string)newValue; - imageView._url = url; - imageView.UpdateImage(); - } + string url = (string)newValue; + url = (url == null ? "" : url); + + imageView.UpdateImage(ImageVisualProperty.URL, new PropertyValue(url)); }, defaultValueCreator: (bindable) => { var imageView = (ImageView)bindable; - if(imageView._imageType == ImageType.Normal) - { - Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.IMAGE).Get(out imageView._url); - } - return imageView._url; + string ret = ""; + PropertyMap imageMap = (PropertyMap)imageView.GetValue(ImageProperty); + imageMap.Find(ImageVisualProperty.URL)?.Get(out ret); + return ret; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. @@ -62,8 +59,7 @@ namespace Tizen.NUI.BaseComponents if (imageView._border == null) { - imageView._image = map; - imageView.UpdateImage(); + Tizen.NUI.Object.SetProperty(imageView.swigCPtr, ImageView.Property.IMAGE, new Tizen.NUI.PropertyValue(map)); } } }, @@ -124,10 +120,14 @@ namespace Tizen.NUI.BaseComponents public static readonly BindableProperty BorderProperty = BindableProperty.Create("Border", typeof(Rectangle), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) => { var imageView = (ImageView)bindable; + imageView._border = (Rectangle)newValue; if (newValue != null) { - imageView._border = (Rectangle)newValue; - imageView.UpdateImage(); + imageView.UpdateImage(ImageVisualProperty.Border, new PropertyValue(imageView._border)); + } + else + { + imageView.UpdateImage(ImageVisualProperty.Border, new PropertyValue(new Rectangle(0,0,0,0))); } }, defaultValueCreator: (bindable) => @@ -143,14 +143,16 @@ namespace Tizen.NUI.BaseComponents var imageView = (ImageView)bindable; if (newValue != null) { - imageView._borderOnly = (bool)newValue; - imageView.UpdateImage(); + imageView.UpdateImage(ImageVisualProperty.BorderOnly, new PropertyValue((bool)newValue)); } }, defaultValueCreator: (bindable) => { var imageView = (ImageView)bindable; - return imageView._borderOnly ?? false; + bool ret = false; + PropertyMap imageMap = (PropertyMap)imageView.GetValue(ImageProperty); + imageMap.Find(ImageVisualProperty.BorderOnly)?.Get(out ret); + return ret; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. @@ -160,14 +162,16 @@ namespace Tizen.NUI.BaseComponents var imageView = (ImageView)bindable; if (newValue != null) { - imageView._synchronousLoading = (bool)newValue; - imageView.UpdateImage(); + imageView.UpdateImage(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)newValue)); } }, defaultValueCreator: (bindable) => { var imageView = (ImageView)bindable; - return imageView._synchronousLoading ?? false; + bool ret = false; + PropertyMap imageMap = (PropertyMap)imageView.GetValue(ImageProperty); + imageMap.Find(ImageVisualProperty.SynchronousLoading)?.Get(out ret); + return ret; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. @@ -177,14 +181,18 @@ namespace Tizen.NUI.BaseComponents var imageView = (ImageView)bindable; if (newValue != null) { - imageView._orientationCorrection = (bool)newValue; - imageView.UpdateImage(); + imageView.UpdateImage(ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)newValue)); } }, defaultValueCreator: (bindable) => { var imageView = (ImageView)bindable; - return imageView._orientationCorrection ?? false; + + bool ret = false; + PropertyMap imageMap = (PropertyMap)imageView.GetValue(ImageProperty); + imageMap?.Find(ImageVisualProperty.OrientationCorrection)?.Get(out ret); + + return ret; }); private global::System.Runtime.InteropServices.HandleRef swigCPtr; @@ -194,13 +202,6 @@ namespace Tizen.NUI.BaseComponents private _resourceLoadedCallbackType _resourceLoadedCallback; private Rectangle _border; - private PropertyMap _nPatchMap; - private bool? _synchronousLoading; - private bool? _borderOnly; - private string _url; - private bool? _orientationCorrection; - private PropertyMap _image; - private ImageType _imageType; /// /// Creates an initialized ImageView. @@ -219,13 +220,13 @@ namespace Tizen.NUI.BaseComponents /// 3 public ImageView(string url) : this(Interop.ImageView.ImageView_New__SWIG_2(url), true) { - _url = url; + UpdateImage(ImageVisualProperty.URL, new PropertyValue(url)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal ImageView(string url, Uint16Pair size) : this(Interop.ImageView.ImageView_New__SWIG_3(url, Uint16Pair.getCPtr(size)), true) { - _url = url; + UpdateImage(ImageVisualProperty.URL, new PropertyValue(url)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -329,18 +330,8 @@ namespace Tizen.NUI.BaseComponents } set { - _url = (value == null ? "" : value); - SetValue(ResourceUrlProperty, _url); - NotifyPropertyChanged(); - - PropertyMap temp = new PropertyMap(); - temp.Insert(ImageVisualProperty.URL, new PropertyValue(value)); - - PropertyMap imageMap = Image; - imageMap.Merge(temp); - - SetValue(ImageProperty, imageMap); - + SetValue(ResourceUrlProperty, value); + NotifyPropertyChanged(); } } @@ -370,7 +361,6 @@ namespace Tizen.NUI.BaseComponents { if (_border == null) { - if (_url != null) { value.Add("url", new PropertyValue(_url)); } SetProperty(ImageView.Property.IMAGE, new Tizen.NUI.PropertyValue(value)); NotifyPropertyChanged(); } @@ -552,9 +542,7 @@ namespace Tizen.NUI.BaseComponents /// 3 public void SetImage(string url) { - _url = url; - Interop.ImageView.ImageView_SetImage__SWIG_1(swigCPtr, url); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + UpdateImage(ImageVisualProperty.URL, new PropertyValue(url)); } /// @@ -618,7 +606,8 @@ namespace Tizen.NUI.BaseComponents get { string ret = ""; - Image.Find(ImageVisualProperty.AlphaMaskURL)?.Get(out ret); + PropertyMap imageMap = (PropertyMap)GetValue(ImageProperty); + imageMap?.Find(ImageVisualProperty.AlphaMaskURL)?.Get(out ret); return ret; } @@ -632,11 +621,12 @@ namespace Tizen.NUI.BaseComponents PropertyMap temp = new PropertyMap(); temp.Insert(ImageVisualProperty.AlphaMaskURL, new PropertyValue(value)); - PropertyMap imageMap = Image; + PropertyMap imageMap = (PropertyMap)GetValue(ImageProperty); + imageMap.Merge(temp); - - SetValue(ImageProperty, imageMap); - NotifyPropertyChanged(); + + SetValue(ImageProperty, imageMap); + NotifyPropertyChanged(); } } @@ -651,7 +641,8 @@ namespace Tizen.NUI.BaseComponents get { bool ret = false; - Image.Find(ImageVisualProperty.CropToMask)?.Get(out ret); + PropertyMap imageMap = (PropertyMap)GetValue(ImageProperty); + imageMap?.Find(ImageVisualProperty.CropToMask)?.Get(out ret); return ret; } @@ -659,8 +650,8 @@ namespace Tizen.NUI.BaseComponents { PropertyMap temp = new PropertyMap(); temp.Insert(ImageVisualProperty.CropToMask, new PropertyValue(value)); - - PropertyMap imageMap = Image; + + PropertyMap imageMap = (PropertyMap)GetValue(ImageProperty); imageMap.Merge(temp); SetValue(ImageProperty, imageMap); @@ -682,7 +673,8 @@ namespace Tizen.NUI.BaseComponents get { int ret = (int)FittingModeType.ShrinkToFit; - Image.Find(ImageVisualProperty.FittingMode)?.Get(out ret); + PropertyMap imageMap = (PropertyMap)GetValue(ImageProperty); + imageMap?.Find(ImageVisualProperty.FittingMode)?.Get(out ret); return (FittingModeType)ret; } @@ -690,10 +682,10 @@ namespace Tizen.NUI.BaseComponents { PropertyMap temp = new PropertyMap(); temp.Insert(ImageVisualProperty.FittingMode, new PropertyValue((int)value)); - - PropertyMap imageMap = Image; + + PropertyMap imageMap = (PropertyMap)GetValue(ImageProperty); imageMap.Merge(temp); - + SetValue(ImageProperty, imageMap); NotifyPropertyChanged(); } @@ -714,7 +706,8 @@ namespace Tizen.NUI.BaseComponents get { int ret = -1; - Image.Find(ImageVisualProperty.DesiredWidth)?.Get(out ret); + PropertyMap imageMap = (PropertyMap)GetValue(ImageProperty); + imageMap?.Find(ImageVisualProperty.DesiredWidth)?.Get(out ret); return ret; } @@ -722,10 +715,10 @@ namespace Tizen.NUI.BaseComponents { PropertyMap temp = new PropertyMap(); temp.Insert(ImageVisualProperty.DesiredWidth, new PropertyValue(value)); - - PropertyMap imageMap = Image; + + PropertyMap imageMap = (PropertyMap)GetValue(ImageProperty); imageMap.Merge(temp); - + SetValue(ImageProperty, imageMap); NotifyPropertyChanged(); } @@ -744,7 +737,8 @@ namespace Tizen.NUI.BaseComponents get { int ret = -1; - Image.Find(ImageVisualProperty.DesiredHeight)?.Get(out ret); + PropertyMap imageMap = (PropertyMap)GetValue(ImageProperty); + imageMap?.Find(ImageVisualProperty.DesiredHeight)?.Get(out ret); return ret; } @@ -752,10 +746,10 @@ namespace Tizen.NUI.BaseComponents { PropertyMap temp = new PropertyMap(); temp.Insert(ImageVisualProperty.DesiredHeight, new PropertyValue(value)); - - PropertyMap imageMap = Image; + + PropertyMap imageMap = (PropertyMap)GetValue(ImageProperty); imageMap.Merge(temp); - + SetValue(ImageProperty, imageMap); NotifyPropertyChanged(); } @@ -776,7 +770,8 @@ namespace Tizen.NUI.BaseComponents get { int ret = (int)WrapModeType.Default; - Image.Find(ImageVisualProperty.WrapModeU)?.Get(out ret); + PropertyMap imageMap = (PropertyMap)GetValue(ImageProperty); + imageMap?.Find(ImageVisualProperty.WrapModeU)?.Get(out ret); return (WrapModeType)ret; } @@ -784,10 +779,10 @@ namespace Tizen.NUI.BaseComponents { PropertyMap temp = new PropertyMap(); temp.Insert(ImageVisualProperty.WrapModeU, new PropertyValue((int)value)); - - PropertyMap imageMap = Image; + + PropertyMap imageMap = (PropertyMap)GetValue(ImageProperty); imageMap.Merge(temp); - + SetValue(ImageProperty, imageMap); NotifyPropertyChanged(); } @@ -808,7 +803,8 @@ namespace Tizen.NUI.BaseComponents get { int ret = (int)WrapModeType.Default; - Image.Find(ImageVisualProperty.WrapModeV)?.Get(out ret); + PropertyMap imageMap = (PropertyMap)GetValue(ImageProperty); + imageMap?.Find(ImageVisualProperty.WrapModeV)?.Get(out ret); return (WrapModeType)ret; } @@ -816,15 +812,16 @@ namespace Tizen.NUI.BaseComponents { PropertyMap temp = new PropertyMap(); temp.Insert(ImageVisualProperty.WrapModeV, new PropertyValue((int)value)); - - PropertyMap imageMap = Image; + + PropertyMap imageMap = (PropertyMap)GetValue(ImageProperty); imageMap.Merge(temp); - + SetValue(ImageProperty, imageMap); NotifyPropertyChanged(); } } + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImageView obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; @@ -832,9 +829,10 @@ namespace Tizen.NUI.BaseComponents internal void SetImage(string url, Uint16Pair size) { - _url = url; Interop.ImageView.ImageView_SetImage__SWIG_2(swigCPtr, url, Uint16Pair.getCPtr(size)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + UpdateImage(ImageVisualProperty.URL, new PropertyValue(url)); } internal ViewResourceReadySignal ResourceReadySignal(View view) @@ -868,10 +866,6 @@ namespace Tizen.NUI.BaseComponents //You should release all of your own disposable objects here. _border?.Dispose(); _border = null; - _nPatchMap?.Dispose(); - _nPatchMap = null; - _image?.Dispose(); - _image = null; } //Release your own unmanaged resources here. @@ -906,59 +900,30 @@ namespace Tizen.NUI.BaseComponents } } - private void UpdateImage() + private void UpdateImage(int key, PropertyValue value) { - if (_url != null && _url != "") + PropertyMap temp = new PropertyMap(); + temp.Insert(key, value); + + if (_border != null) { - if (_border != null) - { // for nine-patch image - _nPatchMap = new PropertyMap(); - _nPatchMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch)); - _nPatchMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url)); - _nPatchMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); - if (_borderOnly != null) { _nPatchMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); } - if (_synchronousLoading != null) { _nPatchMap.Add(NpatchImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); } - if (_orientationCorrection != null) { _nPatchMap.Add(ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)_orientationCorrection)); } - SetProperty(ImageView.Property.IMAGE, new PropertyValue(_nPatchMap)); - _imageType = ImageType.Npatch; - } - else if (_synchronousLoading != null || _orientationCorrection != null) - { // for normal image, with synchronous loading property - PropertyMap imageMap = new PropertyMap(); - imageMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image)); - imageMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); - if (_synchronousLoading != null) { imageMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); } - if (_orientationCorrection != null) { imageMap.Add(ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)_orientationCorrection)); } - SetProperty(ImageView.Property.IMAGE, new PropertyValue(imageMap)); - - _imageType = ImageType.Specific; - } - else - { // just for normal image - SetProperty(ImageView.Property.IMAGE, new PropertyValue(_url)); - _imageType = ImageType.Normal; - } + temp.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch)); } else { - //Image property is set and used - PropertyMap map = new PropertyMap(); - map.Insert(ImageVisualProperty.URL, new PropertyValue("")); - if (_synchronousLoading != null) - { - map.Insert(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); - } - if (_orientationCorrection != null) - { - map.Insert(ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)_orientationCorrection)); - } - if (_image != null) - { - map.Merge(_image); - } - SetProperty(ImageView.Property.IMAGE, new PropertyValue(map)); - _imageType = ImageType.Normal; + temp.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image)); + temp.Insert(ImageVisualProperty.BorderOnly, new PropertyValue((false))); } + + + PropertyMap imageMap = (PropertyMap)GetValue(ImageProperty); + imageMap.Merge(temp); + + SetValue(ImageProperty, imageMap); + NotifyPropertyChanged(); + + temp.Dispose(); + temp = null; } private void OnResourceLoaded(IntPtr view) diff --git a/src/Tizen.NUI/src/public/Layer.cs b/src/Tizen.NUI/src/public/Layer.cs index 757590322..06a743842 100755 --- a/src/Tizen.NUI/src/public/Layer.cs +++ b/src/Tizen.NUI/src/public/Layer.cs @@ -29,6 +29,7 @@ namespace Tizen.NUI public class Layer : Container { private global::System.Runtime.InteropServices.HandleRef swigCPtr; + private Window window; /// /// Creates a Layer object. @@ -136,7 +137,7 @@ namespace Tizen.NUI else { // Clipping not enabled so return the window size - Size2D windowSize = Window.Instance.Size; + Size2D windowSize = window?.Size; Rectangle ret = new Rectangle(0, 0, windowSize.Width, windowSize.Height); return ret; } @@ -388,7 +389,7 @@ namespace Tizen.NUI /// 3 public void Raise() { - var parentChildren = Window.Instance.LayersChildren; + var parentChildren = window?.LayersChildren; if (parentChildren != null) { int currentIdx = parentChildren.IndexOf(this); @@ -407,7 +408,7 @@ namespace Tizen.NUI /// 3 public void Lower() { - var parentChildren = Window.Instance.LayersChildren; + var parentChildren = window?.LayersChildren; if (parentChildren != null) { int currentIdx = parentChildren.IndexOf(this); @@ -426,7 +427,7 @@ namespace Tizen.NUI /// 3 public void RaiseToTop() { - var parentChildren = Window.Instance.LayersChildren; + var parentChildren = window?.LayersChildren; if (parentChildren != null) { @@ -444,7 +445,7 @@ namespace Tizen.NUI /// 3 public void LowerToBottom() { - var parentChildren = Window.Instance.LayersChildren; + var parentChildren = window?.LayersChildren; if (parentChildren != null) { @@ -502,7 +503,7 @@ namespace Tizen.NUI internal uint GetDepth() { - var parentChildren = Window.Instance.LayersChildren; + var parentChildren = window?.LayersChildren; if (parentChildren != null) { int idx = parentChildren.IndexOf(this); @@ -515,7 +516,7 @@ namespace Tizen.NUI } internal void RaiseAbove(Layer target) { - var parentChildren = Window.Instance.LayersChildren; + var parentChildren = window?.LayersChildren; if (parentChildren != null) { int currentIndex = parentChildren.IndexOf(this); @@ -542,7 +543,7 @@ namespace Tizen.NUI internal void LowerBelow(Layer target) { - var parentChildren = Window.Instance.LayersChildren; + var parentChildren = window?.LayersChildren; if (parentChildren != null) { @@ -626,6 +627,11 @@ namespace Tizen.NUI throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + internal void SetWindow(Window win) + { + window = win; + } + /// /// Dispose. /// diff --git a/src/Tizen.NUI/src/public/NUIApplication.cs b/src/Tizen.NUI/src/public/NUIApplication.cs index 13892f48e..eabf35ed4 100755 --- a/src/Tizen.NUI/src/public/NUIApplication.cs +++ b/src/Tizen.NUI/src/public/NUIApplication.cs @@ -316,14 +316,6 @@ namespace Tizen.NUI /// 3 protected virtual void OnPreCreate() { - if (_windowSize2D != null) - { - Window.Instance.WindowSize = _windowSize2D; - } - if (_windowPosition2D != null) - { - Window.Instance.WindowPosition = _windowPosition2D; - } } /// diff --git a/src/Tizen.NUI/src/public/Window.cs b/src/Tizen.NUI/src/public/Window.cs index 72e24f934..184b28ed4 100755 --- a/src/Tizen.NUI/src/public/Window.cs +++ b/src/Tizen.NUI/src/public/Window.cs @@ -66,22 +66,62 @@ namespace Tizen.NUI } } - internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true) + /// + /// Creates a new Window.
+ /// This creates an extra window in addition to the default main window
+ ///
+ /// The position and size of the Window. + /// The Window title. + /// Whether Window is transparent. + /// A new Window. + /// 6 + [EditorBrowsable(EditorBrowsableState.Never)] + public Window(Rectangle windowPosition, string name, bool isTransparent) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal Window(Rectangle windowPosition, string name) : this(Interop.Window.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true) + /// + /// Creates a new Window.
+ /// This creates an extra window in addition to the default main window
+ ///
+ /// The position and size of the Window. + /// The Window title. + /// A new Window. + /// 6 + [EditorBrowsable(EditorBrowsableState.Never)] + public Window(Rectangle windowPosition, string name) : this(Interop.Window.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(Interop.Window.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true) + /// + /// Creates a new Window.
+ /// This creates an extra window in addition to the default main window
+ ///
+ /// The position and size of the Window. + /// The Window title. + /// The Window class name. + /// Whether Window is transparent. + /// A new Window. + /// 6 + [EditorBrowsable(EditorBrowsableState.Never)] + public Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(Interop.Window.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal Window(Rectangle windowPosition, string name, string className) : this(Interop.Window.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true) + /// + /// Creates a new Window.
+ /// This creates an extra window in addition to the default main window
+ ///
+ /// The position and size of the Window. + /// The Window title. + /// The Window class name. + /// A new Window. + /// 6 + [EditorBrowsable(EditorBrowsableState.Never)] + public Window(Rectangle windowPosition, string name, string className) : this(Interop.Window.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -1109,10 +1149,11 @@ namespace Tizen.NUI /// 3 public void AddLayer(Layer layer) { - Interop.Stage.Stage_Add(stageCPtr, Layer.getCPtr(layer)); + Interop.Window.Add(swigCPtr, Layer.getCPtr(layer)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); LayersChildren?.Add(layer); + layer.SetWindow(this); } /// @@ -1122,10 +1163,11 @@ namespace Tizen.NUI /// 3 public void RemoveLayer(Layer layer) { - Interop.Stage.Stage_Remove(stageCPtr, Layer.getCPtr(layer)); + Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); LayersChildren?.Remove(layer); + layer.SetWindow(null); } /// @@ -1242,23 +1284,25 @@ namespace Tizen.NUI internal void Add(Layer layer) { - Interop.Stage.Stage_Add(stageCPtr, Layer.getCPtr(layer)); + Interop.Window.Add(swigCPtr, Layer.getCPtr(layer)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); LayersChildren?.Add(layer); + layer.SetWindow(this); } internal void Remove(Layer layer) { - Interop.Stage.Stage_Remove(stageCPtr, Layer.getCPtr(layer)); + Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); LayersChildren?.Remove(layer); + layer.SetWindow(null); } internal Vector2 GetSize() { - Vector2 ret = new Vector2(Interop.Stage.Stage_GetSize(stageCPtr), true); + Vector2 ret = new Vector2(Interop.Window.GetSize(swigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -1289,22 +1333,23 @@ namespace Tizen.NUI // Core has been initialized, not when Stage is ready. if (_rootLayer == null && Window.IsInstalled()) { - _rootLayer = new Layer(Interop.Stage.Stage_GetRootLayer(stageCPtr), true); + _rootLayer = new Layer(Interop.Window.GetRootLayer(swigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); LayersChildren?.Add(_rootLayer); + _rootLayer.SetWindow(this); } return _rootLayer; } internal void SetBackgroundColor(Vector4 color) { - Interop.Stage.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color)); + Interop.Window.SetBackgroundColor(swigCPtr, Vector4.getCPtr(color)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal Vector4 GetBackgroundColor() { - Vector4 ret = new Vector4(Interop.Stage.Stage_GetBackgroundColor(stageCPtr), true); + Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(swigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -1339,7 +1384,7 @@ namespace Tizen.NUI internal KeyEventSignal KeyEventSignal() { - KeyEventSignal ret = new KeyEventSignal(Interop.StageSignal.Stage_KeyEventSignal(stageCPtr), false); + KeyEventSignal ret = new KeyEventSignal(Interop.Window.KeyEventSignal(swigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -1353,7 +1398,7 @@ namespace Tizen.NUI internal TouchSignal TouchSignal() { - TouchSignal ret = new TouchSignal(Interop.StageSignal.Stage_TouchSignal(stageCPtr), false); + TouchSignal ret = new TouchSignal(Interop.Window.TouchSignal(swigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -1456,6 +1501,44 @@ namespace Tizen.NUI } + /// + /// Dispose for Window + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + this.DisconnectNativeSignals(); + + //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.Window.delete_Window(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + internal System.IntPtr GetNativeWindowHandler() { System.IntPtr ret = Interop.Window.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr)); -- 2.34.1