[NUI] Fix svace issue (DFDF221207-00724).
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Window / Window.cs
index 331a1e8..796b7b9 100755 (executable)
@@ -82,7 +82,7 @@ namespace Tizen.NUI
 
             //to fix memory leak issue, match the handle count with native side.
             Window ret = view.GetInstanceSafely<Window>(Interop.Window.Get(View.getCPtr(view)));
-            if (NDalicPINVOKE.SWIGPendingException.Pending)throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
 
@@ -552,7 +552,7 @@ namespace Tizen.NUI
             {
                 Position2D position = GetPosition();
                 Size2D size = GetSize();
-                Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
+                Rectangle ret = new Rectangle(position?.X ?? 0, position?.Y ?? 0, size?.Width ?? 0, size?.Height ?? 0);
                 position.Dispose();
                 return ret;
             }
@@ -1427,7 +1427,7 @@ namespace Tizen.NUI
         {
             if (isBorderWindow)
             {
-                if(borderLayer == null)
+                if (borderLayer == null)
                 {
                     borderLayer = GetBorderWindowRootLayer();
                     LayersChildren?.Add(borderLayer);
@@ -1525,8 +1525,8 @@ namespace Tizen.NUI
             {
                 throw new ArgumentNullException(nameof(position));
             }
-            var val = new Uint16Pair((uint)position.X, (uint)position.Y);
-            Interop.Window.SetPosition(SwigCPtr, Uint16Pair.getCPtr(val));
+            var val = new Int32Pair(position.X, position.Y);
+            Interop.Window.SetPosition(SwigCPtr, Int32Pair.getCPtr(val));
             val.Dispose();
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             // Setting Position of the window should request a relayout of the tree.
@@ -1534,8 +1534,8 @@ namespace Tizen.NUI
 
         internal Position2D GetPosition()
         {
-            var val = new Uint16Pair(Interop.Window.GetPosition(SwigCPtr), true);
-            Position2D ret = new Position2D(val.GetX(), val.GetY());
+            var val = new Int32Pair(Interop.Window.GetPosition(SwigCPtr), true);
+            Position2D ret = new Position2D((int)val.GetX(), (int)val.GetY());
             val.Dispose();
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -1663,6 +1663,30 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Sets window's maximum size.
+        ///
+        /// It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer().
+        /// Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize().
+        ///
+        /// After setting, if Maximize() is called, window is resized with the setting size and move the center.
+        ///
+        /// </summary>
+        /// <param name="size">the maximum size.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SetMaximumSize(Size2D size)
+        {
+            if (null == size)
+            {
+                throw new ArgumentNullException(nameof(size));
+            }
+            var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
+
+            Interop.Window.SetMaximumSize(SwigCPtr, Uint16Pair.getCPtr(val));
+            val.Dispose();
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
         /// Minimizes window's size.
         /// If this function is called with true, window will be iconified.
         /// Otherwise window will be activated.
@@ -1690,6 +1714,26 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Sets window's minimum size.
+        /// It is to set the minimum size when window's size is decreased by RequestResizeToServer().
+        /// Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize().
+        /// </summary>
+        /// <param name="size">the minimum size.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SetMimimumSize(Size2D size)
+        {
+            if (null == size)
+            {
+                throw new ArgumentNullException(nameof(size));
+            }
+            var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
+
+            Interop.Window.SetMimimumSize(SwigCPtr, Uint16Pair.getCPtr(val));
+            val.Dispose();
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
         /// Query whether window is rotating or not.
         /// </summary>
         /// <returns>True if window is rotating, false otherwise.</returns>
@@ -1753,6 +1797,8 @@ namespace Tizen.NUI
             {
                 return;
             }
+            
+            this.DisconnectNativeSignals();
 
             if (type == DisposeTypes.Explicit)
             {
@@ -1778,7 +1824,6 @@ namespace Tizen.NUI
                 localController?.Dispose();
             }
 
-            this.DisconnectNativeSignals();
 
             base.Dispose(type);
         }