[NUI] integration from dalihub (#967)
authordongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 7 Aug 2019 11:37:39 +0000 (20:37 +0900)
committerGitHub <noreply@github.com>
Wed, 7 Aug 2019 11:37:39 +0000 (20:37 +0900)
* [NUI] View not to use Size2D internally

Change-Id: I14efea23af86c0695d729dc383992757ab699d9c

* [NUI] Fixed some bad comments

Change-Id: I1e84556f03fc0541baec2149a52f836e95e27096

* [NUI] Add API for NUI Multi Window

* [NUI] Adding Weight feature to LinearLayout

Uses the View Weight property to define how free space is
allocated between child Views.

Weight 0 is the default.

With Views A, B, C
Giving A.Weight = 1 would mean 1 takes up excess space
in the parent.
Also giving A.C = 1 would mean A and C divide the excess space
between them. B remains it's original measured size.

Change-Id: I6cd13085a5713794789ee61027e371974be3fa32

* [NUI] FlexLayout support added

Flex layout using the new layouting system.
Uses natural size of the items.
Supports: Wrap, Alignment, Direction and justrification.

Currently unsupported: Explict sized items, item padding.

Change-Id: Id966f11c8ececcb07e2ecc528f876787129d54b9

* [NUI] Fix Multi-window bug

Change-Id: Ie945d7997d58c72ad70e1cf09fdab56c9519c67a
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* [NUI] fix GetSize() for multi window

* [NUI] Layouting to iterate all Layers

Change-Id: I005b7da027b351624c27abc56336538180907168

* [NUI] Added Alignment.Center for LinearLayout

Change-Id: If6d0ac3d2602bb1e399cd579337c204fab268de1

* [NUI] Re-layout TextLabel when text changes size

When View's change size like TextLabel setting new text
it should be laid out again

Change-Id: I790b2fbaab8a8869c36d9d10c3760205815627f7

* [NUI] Remove unused and dangling interops

Change-Id: I005d40a5eec2d2a98adb4405b3a505ad955f3be6

* [NUI] Remove layouting fixed specification API

Change-Id: I37b6948337bf3bca4a9811259bf6e8ff1b1e008f

* [NUI] Remove unused SetUseHardwareVSync Adaptor API.

Change-Id: I373643c8cdfedd126c6652337c7d3bf467f69ead

* [NUI] Add GetDefaultWindow()

this api for get Default Window.

* [NUI] Add API for GetWindowList()

After apply MultiWindow, Developer need to know list of window.

* [NUI] change API for GetWindowList()

change API for using native API.

* [NUI] Apply GaussianBlurView Devel API changes

Change-Id: I98dae108ad5e50f2844f347a69d934b11fe36462

* [NUI] Rename PAGE_SIZE property to VIEW_PAGE_SIZE.

Change-Id: Ifd31b9ac50969a24543868127f2c09a10e65f329

* [NUI] Remove Builder GetFrameBufferImage unused method

Change-Id: I2dedaad5dc53c0a2ec61af005fc91d4275ccda06

* [NUI]Change GetWindowList() to static

* [NUI] Change API for Window Creation

* [NUI] Add method to destroy a window

Change-Id: I9b9b34a8a7aa1fb1da576cab98b1495f7c998a4c

* [NUI] Fix API Checker error

16 files changed:
src/Tizen.NUI/src/internal/Builder.cs
src/Tizen.NUI/src/internal/GaussianBlurView.cs
src/Tizen.NUI/src/internal/Interop/Interop.Adaptor.cs
src/Tizen.NUI/src/internal/Interop/Interop.Builder.cs
src/Tizen.NUI/src/internal/Interop/Interop.PageTurnView.cs
src/Tizen.NUI/src/internal/Interop/Interop.View.cs
src/Tizen.NUI/src/internal/Layouting/FlexLayout.cs [new file with mode: 0644]
src/Tizen.NUI/src/internal/Layouting/Interop/Interop.FlexLayout.cs
src/Tizen.NUI/src/internal/Layouting/LayoutController.cs
src/Tizen.NUI/src/internal/Layouting/LinearLayout.cs
src/Tizen.NUI/src/internal/PageTurnView.cs
src/Tizen.NUI/src/public/Adaptor.cs
src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/NUIApplication.cs
src/Tizen.NUI/src/public/Window.cs

index b8cf8f4..ef00e45 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -274,13 +274,6 @@ namespace Tizen.NUI
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal FrameBufferImage GetFrameBufferImage(string name)
-        {
-            FrameBufferImage ret = new FrameBufferImage(Interop.Builder.Builder_GetFrameBufferImage(swigCPtr, name), true);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
         public Path GetPath(string name)
         {
             Path ret = new Path(Interop.Builder.Builder_GetPath(swigCPtr, name), true);
index 0c21613..fc3c24f 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -206,9 +206,9 @@ namespace Tizen.NUI
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        public void SetUserImageAndOutputRenderTarget(Image inputImage, FrameBufferImage outputRenderTarget)
+        public void SetUserImageAndOutputRenderTarget(Texture inputTexture, FrameBuffer outputRenderTarget)
         {
-            Interop.GaussianBlurView.GaussianBlurView_SetUserImageAndOutputRenderTarget(swigCPtr, Image.getCPtr(inputImage), FrameBufferImage.getCPtr(outputRenderTarget));
+            Interop.GaussianBlurView.GaussianBlurView_SetUserImageAndOutputRenderTarget(swigCPtr, Texture.getCPtr(inputTexture), FrameBuffer.getCPtr(outputRenderTarget));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
index 50232ea..cd83c0a 100755 (executable)
@@ -74,10 +74,6 @@ namespace Tizen.NUI
             public static extern void Adaptor_SetRenderRefreshRate(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2);
 
 
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Adaptor_SetUseHardwareVSync")]
-            public static extern void Adaptor_SetUseHardwareVSync(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2);
-
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Adaptor_Get")]
             public static extern global::System.IntPtr Adaptor_Get();
 
index 346918a..1b138ca 100755 (executable)
@@ -93,10 +93,6 @@ namespace Tizen.NUI
             public static extern void Builder_CreateRenderTask(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
 
 
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Builder_GetFrameBufferImage")]
-            public static extern global::System.IntPtr Builder_GetFrameBufferImage(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
-
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Builder_GetPath")]
             public static extern global::System.IntPtr Builder_GetPath(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
 
index a8124dd..a8a2a8c 100755 (executable)
@@ -14,8 +14,8 @@ namespace Tizen.NUI
                        
 
 
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_PageTurnView_Property_PAGE_SIZE_get")]
-            public static extern int PageTurnView_Property_PAGE_SIZE_get();
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_PageTurnView_Property_VIEW_PAGE_SIZE_get")]
+            public static extern int PageTurnView_Property_VIEW_PAGE_SIZE_get();
 
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_PageTurnView_Property_CURRENT_PAGE_ID_get")]
index dd65138..2eeb90b 100755 (executable)
@@ -70,28 +70,9 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_SWIGUpcast")]
             public static extern global::System.IntPtr View_SWIGUpcast(global::System.IntPtr jarg1);
 
-
-
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_SetLayout")]
-            public static extern void View_SetLayout(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
-
-
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_GetLayout")]
-            public static extern global::System.IntPtr View_GetLayout(global::System.Runtime.InteropServices.HandleRef jarg1);
-
-
-
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_SetLayoutingRequired")]
-            public static extern void View_SetLayoutingRequired(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2);
-
-
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_IsLayoutingRequired")]
-            public static extern bool View_IsLayoutingRequired(global::System.Runtime.InteropServices.HandleRef jarg1);
-
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_IsResourceReady")]
             public static extern bool IsResourceReady(global::System.Runtime.InteropServices.HandleRef jarg1);
-            
+
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_ResourceReadySignal")]
             public static extern global::System.IntPtr ResourceReadySignal(global::System.Runtime.InteropServices.HandleRef jarg1);
diff --git a/src/Tizen.NUI/src/internal/Layouting/FlexLayout.cs b/src/Tizen.NUI/src/internal/Layouting/FlexLayout.cs
new file mode 100644 (file)
index 0000000..c2c3689
--- /dev/null
@@ -0,0 +1,460 @@
+/* Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+using System.Runtime.InteropServices;
+
+namespace Tizen.NUI
+{
+    /// <summary>
+    /// [Draft] This class implements a flex layout.
+    /// The flex layout implementation is based on open source Facebook Yoga layout engine.
+    /// For more information about the flex layout API and how to use it please refer to https://yogalayout.com/docs/
+    /// We implement the subset of the API in the class below.
+    /// </summary>
+    internal class FlexLayout : LayoutGroup,  global::System.IDisposable
+    {
+        float Flex{ get; set;}
+        int AlignSelf{get; set;}
+
+        private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+        private bool swigCMemOwn;
+        private bool disposed;
+        private bool isDisposeQueued = false;
+
+        private IntPtr _rootFlex;  // Pointer to the unmanged flex layout class.
+
+        public struct MeasuredSize
+        {
+          public MeasuredSize(float x, float y)
+          {
+            width = x;
+            height = y;
+          }
+          float width;
+          float height;
+        };
+
+        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        internal delegate MeasuredSize ChildMeasureCallback( global::System.IntPtr child, float width, int measureModeWidth, float height, int measureModeHeight );
+
+        event ChildMeasureCallback measureChildDelegate; // Stores a delegate to the child measure callback. Used for all children of this FlexLayout.
+
+        internal FlexLayout(global::System.IntPtr cPtr, bool cMemoryOwn)
+        {
+            swigCMemOwn = cMemoryOwn;
+            swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+            _rootFlex = Interop.FlexLayout.FlexLayout_New();
+            measureChildDelegate = new ChildMeasureCallback(measureChild);
+        }
+
+        internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FlexLayout obj)
+        {
+            return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+        }
+
+        public void Dispose()
+        {
+            // Throw exception if Dispose() is called in separate thread.
+            if (!Window.IsInstalled())
+            {
+                throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
+            }
+
+            if (isDisposeQueued)
+            {
+                Dispose(DisposeTypes.Implicit);
+            }
+            else
+            {
+                Dispose(DisposeTypes.Explicit);
+                System.GC.SuppressFinalize(this);
+            }
+        }
+
+        protected virtual 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.
+
+            }
+
+            // 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.FlexLayout.delete_FlexLayout(swigCPtr);
+                }
+                swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+            }
+            disposed = true;
+        }
+
+        /// <summary>
+        /// [Draft] Creates a FlexLayout object.
+        /// </summary>
+        public FlexLayout() : this(Interop.FlexLayout.FlexLayout_New(), true)
+        {
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        internal static FlexLayout DownCast(BaseHandle handle)
+        {
+            FlexLayout ret = new FlexLayout(Interop.FlexLayout.FlexLayout_DownCast(BaseHandle.getCPtr(handle)), true);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal FlexLayout(FlexLayout other) : this(Interop.FlexLayout.new_FlexLayout__SWIG_1(FlexLayout.getCPtr(other)), true)
+        {
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        internal FlexLayout Assign(FlexLayout other)
+        {
+            FlexLayout ret = new FlexLayout(Interop.FlexLayout.FlexLayout_Assign(swigCPtr, FlexLayout.getCPtr(other)), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal void SetFlexDirection(FlexLayout.FlexDirection flexDirection)
+        {
+            Interop.FlexLayout.FlexLayout_SetFlexDirection(swigCPtr, (int)flexDirection);
+            RequestLayout();
+        }
+
+        internal FlexLayout.FlexDirection GetFlexDirection()
+        {
+            FlexLayout.FlexDirection ret = (FlexLayout.FlexDirection)Interop.FlexLayout.FlexLayout_GetFlexDirection(swigCPtr);
+            return ret;
+
+        }
+
+        internal void SetFlexJustification(FlexLayout.FlexJustification flexJustification)
+        {
+            Interop.FlexLayout.FlexLayout_SetFlexJustification(swigCPtr, (int)flexJustification);
+            RequestLayout();
+        }
+
+        internal FlexLayout.FlexJustification GetFlexJustification()
+        {
+            FlexLayout.FlexJustification ret = (FlexLayout.FlexJustification)Interop.FlexLayout.FlexLayout_GetFlexJustification(swigCPtr);
+            return ret;
+        }
+
+        internal void SetFlexWrap(FlexLayout.FlexWrapType flexWrap)
+        {
+            Interop.FlexLayout.FlexLayout_SetFlexWrap(swigCPtr, (int)flexWrap);
+            RequestLayout();
+        }
+
+        internal FlexLayout.FlexWrapType GetFlexWrap()
+        {
+            FlexLayout.FlexWrapType ret = (FlexLayout.FlexWrapType)Interop.FlexLayout.FlexLayout_GetFlexWrap(swigCPtr);
+            return ret;
+        }
+
+        internal void SetFlexAlignment(FlexLayout.AlignmentType flexAlignment)
+        {
+            Interop.FlexLayout.FlexLayout_SetFlexAlignment(swigCPtr, (int)flexAlignment);
+            RequestLayout();
+        }
+
+        internal FlexLayout.AlignmentType GetFlexAlignment()
+        {
+            FlexLayout.AlignmentType ret = (FlexLayout.AlignmentType)Interop.FlexLayout.FlexLayout_GetFlexAlignment(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal void SetFlexItemsAlignment(FlexLayout.AlignmentType flexAlignment)
+        {
+            Interop.FlexLayout.FlexLayout_SetFlexItemsAlignment(swigCPtr, (int)flexAlignment);
+            RequestLayout();
+        }
+
+        internal FlexLayout.AlignmentType GetFlexItemsAlignment()
+        {
+            FlexLayout.AlignmentType ret = (FlexLayout.AlignmentType)Interop.FlexLayout.FlexLayout_GetFlexItemsAlignment(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
+        /// [Draft] Get/Set the flex direction in the layout.
+        /// The direction of the main-axis which determines the direction that flex items are laid out.
+        /// </summary>
+        public FlexDirection Direction
+        {
+            get
+            {
+                return GetFlexDirection();
+            }
+            set
+            {
+                SetFlexDirection(value);
+            }
+        }
+
+        /// <summary>
+        /// [Draft] Get/Set the justification in the layout.
+        /// </summary>
+        public FlexJustification Justification
+        {
+            get
+            {
+                return GetFlexJustification();
+            }
+            set
+            {
+                SetFlexJustification(value);
+            }
+        }
+
+        /// <summary>
+        /// [Draft] Get/Set the wrap in the layout.
+        /// </summary>
+        public FlexWrapType WrapType
+        {
+            get
+            {
+                return GetFlexWrap();
+            }
+            set
+            {
+                SetFlexWrap(value);
+            }
+        }
+
+        /// <summary>
+        /// [Draft] Get/Set the alignment of the layout content.
+        /// </summary>
+        public AlignmentType Alignment
+        {
+            get
+            {
+                return GetFlexAlignment();
+            }
+            set
+            {
+                SetFlexAlignment(value);
+            }
+        }
+
+        /// <summary>
+        /// [Draft] Get/Set the alignment of the layout items.
+        /// </summary>
+        public AlignmentType ItemsAlignment
+        {
+            get
+            {
+                return GetFlexItemsAlignment();
+            }
+            set
+            {
+                SetFlexItemsAlignment(value);
+            }
+        }
+
+        /// <summary>
+        /// [Draft] Enumeration for the direction of the main axis in the flex container.
+        /// This determines the direction that flex items are laid out in the flex container.
+        /// </summary>
+        public enum FlexDirection
+        {
+            /// <summary>
+            /// The flexible items are displayed vertically as a column
+            /// </summary>
+            Column,
+            /// <summary>
+            /// The flexible items are displayed vertically as a column, but in reverse order
+            /// </summary>
+            ColumnReverse,
+            /// <summary>
+            /// The flexible items are displayed horizontally as a row
+            /// </summary>
+            Row,
+            /// <summary>
+            /// The flexible items are displayed horizontally as a row, but in reverse order
+            /// </summary>
+            RowReverse
+        }
+
+        /// <summary>
+        /// [Draft] Enumeration for the alignment of the flex items when the items do not use all available space on the main-axis.
+        /// </summary>
+        public enum FlexJustification
+        {
+            /// <summary>
+            /// Items are positioned at the beginning of the container
+            /// </summary>
+            FlexStart,
+            /// <summary>
+            /// Items are positioned at the center of the container
+            /// </summary>
+            Center,
+            /// <summary>
+            /// Items are positioned at the end of the container
+            /// </summary>
+            FlexEnd,
+            /// <summary>
+            /// Items are positioned with equal space between the lines
+            /// </summary>
+            SpaceBetween,
+            /// <summary>
+            /// Items are positioned with equal space before, between, and after the lines
+            /// </summary>
+            SpaceAround
+        }
+
+        /// <summary>
+        /// [Draft] Enumeration for the wrap type of the flex container when there is no enough room for all the items on one flex line.
+        /// </summary>
+        public enum FlexWrapType
+        {
+            /// <summary>
+            /// Flex items laid out in single line (shrunk to fit the flex container along the main axis)
+            /// </summary>
+            NoWrap,
+            /// <summary>
+            /// Flex items laid out in multiple lines if needed
+            /// </summary>
+            Wrap
+        }
+
+        /// <summary>
+        /// [Draft] Enumeration for the alignment of the flex items or lines when the items or lines do not use all the available space on the cross-axis.
+        /// </summary>
+        public enum AlignmentType
+        {
+            /// <summary>
+            /// Inherits the same alignment from the parent
+            /// </summary>
+            Auto,
+            /// <summary>
+            /// At the beginning of the container
+            /// </summary>
+            FlexStart,
+            /// <summary>
+            /// At the center of the container
+            /// </summary>
+            Center,
+            /// <summary>
+            /// At the end of the container
+            /// </summary>
+            FlexEnd,
+            /// <summary>
+            /// Stretch to fit the container
+            /// </summary>
+            Stretch
+        }
+
+        private MeasuredSize measureChild(global::System.IntPtr child, float width, int measureModeWidth, float height, int measureModeHeight)
+        {
+            View view = Registry.GetManagedBaseHandleFromNativePtr(child) as View;
+            Size2D viewSize = new Size2D(8,8);
+            if(view)
+            {
+              viewSize = view.NaturalSize2D;
+            }
+            return new MeasuredSize(viewSize.Width,viewSize.Height);
+        }
+
+        void InsertChild( LayoutItem child )
+        {
+            // Store created node for child
+            Interop.FlexLayout.FlexLayout_AddChild(swigCPtr, View.getCPtr(child.Owner), measureChildDelegate, _children.Count-1);
+        }
+
+        protected override void OnChildAdd(LayoutItem child)
+        {
+            InsertChild(child);
+        }
+
+        protected override void OnChildRemove(LayoutItem child)
+        {
+            // When child View is removed from it's parent View (that is a Layout) then remove it from the layout too.
+            // FlexLayout refers to the child as a View not LayoutItem.
+            Interop.FlexLayout.FlexLayout_RemoveChild(swigCPtr, child);
+        }
+
+        protected override void OnMeasure( MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec )
+        {
+            bool isLayoutRtl = Owner.LayoutDirection == ViewLayoutDirectionType.RTL;
+            Extents padding = Owner.Padding;
+            Extents margin = Owner.Margin;
+
+            Interop.FlexLayout.FlexLayout_SetMargin(swigCPtr, Extents.getCPtr(margin));
+            Interop.FlexLayout.FlexLayout_SetPadding(swigCPtr, Extents.getCPtr(padding));
+
+            float width = 0.0f;
+            float height = 0.0f;
+
+            if( widthMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly ||  widthMeasureSpec.Mode == MeasureSpecification.ModeType.AtMost )
+            {
+                width = widthMeasureSpec.Size.AsDecimal();
+            }
+
+            if ( heightMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly || heightMeasureSpec.Mode == MeasureSpecification.ModeType.AtMost )
+            {
+                height = heightMeasureSpec.Size.AsDecimal();
+            }
+
+            Interop.FlexLayout.FlexLayout_CalculateLayout( swigCPtr, width, height, isLayoutRtl );
+
+            SetMeasuredDimensions( GetDefaultSize( new LayoutLength( (float)Interop.FlexLayout.FlexLayout_GetWidth(swigCPtr) ), widthMeasureSpec ),
+                                   GetDefaultSize( new LayoutLength( (float)Interop.FlexLayout.FlexLayout_GetHeight(swigCPtr) ), heightMeasureSpec ) );
+        }
+
+        protected override void OnLayout( bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom )
+        {
+
+            bool isLayoutRtl = Owner.LayoutDirection == ViewLayoutDirectionType.RTL;
+            LayoutLength width = right - left;
+            LayoutLength height = bottom - top;
+
+            // Call to FlexLayout implementation to calculate layout values for later retrieval.
+            Interop.FlexLayout.FlexLayout_CalculateLayout( swigCPtr, width.AsDecimal(), height.AsDecimal(), isLayoutRtl );
+
+            int count = _children.Count;
+            for( int childIndex = 0; childIndex < count; childIndex++)
+            {
+                LayoutItem childLayout = _children[childIndex];
+                if( childLayout != null )
+                {
+                    // Get the frame for the child, start, top, end, bottom.
+                    Vector4 frame = new Vector4(Interop.FlexLayout.FlexLayout_GetNodeFrame(swigCPtr, childIndex ), true);
+                    childLayout.Layout( new LayoutLength(frame.X), new LayoutLength(frame.Y), new LayoutLength(frame.Z), new LayoutLength(frame.W) );
+                }
+            }
+        }
+
+    } // FLexlayout
+} // namesspace Tizen.NUI
\ No newline at end of file
index 20389a4..9a11c5b 100755 (executable)
@@ -8,82 +8,95 @@ namespace Tizen.NUI
     {
         internal static partial class FlexLayout
         {
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_New")]
+            public static extern global::System.IntPtr FlexLayout_New();
 
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_SWIGUpcast")]
-            public static extern global::System.IntPtr FlexLayout_SWIGUpcast(global::System.IntPtr jarg1);
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_SetContext")]
+            public static extern global::System.IntPtr FlexLayout_SetContext( global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_SetMeasureFunction")]
+            public static extern global::System.IntPtr FlexLayout_SetMeasureFunction( global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_ChildProperty_FLEX_get")]
-            public static extern int FlexLayout_ChildProperty_FLEX_get();
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_AddChild")]
+            public static extern void FlexLayout_AddChild( global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, Tizen.NUI.FlexLayout.ChildMeasureCallback jarg3, int jarg4);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_RemoveChild")]
+            public static extern global::System.IntPtr FlexLayout_RemoveChild( global::System.Runtime.InteropServices.HandleRef jarg1, LayoutItem jarg2);
 
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_ChildProperty_ALIGN_SELF_get")]
-            public static extern int FlexLayout_ChildProperty_ALIGN_SELF_get();
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_CalculateLayout")]
+            public static extern global::System.IntPtr FlexLayout_CalculateLayout( global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, bool jarg4);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_GetWidth")]
+            public static extern global::System.IntPtr FlexLayout_GetWidth(global::System.Runtime.InteropServices.HandleRef jarg1);
 
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_FlexLayout__SWIG_0")]
-            public static extern global::System.IntPtr new_FlexLayout__SWIG_0();
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_GetHeight")]
+            public static extern global::System.IntPtr FlexLayout_GetHeight(global::System.Runtime.InteropServices.HandleRef jarg1);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_GetNodeFrame")]
+            public static extern global::System.IntPtr FlexLayout_GetNodeFrame(global::System.Runtime.InteropServices.HandleRef jarg1, int index);
 
-            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_New")]
-            public static extern global::System.IntPtr FlexLayout_New();
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_MarkDirty")]
+            public static extern global::System.IntPtr FlexLayout_MarkDirty (global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_SetMargin")]
+            public static extern global::System.IntPtr FlexLayout_SetMargin( global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_SetPadding")]
+            public static extern global::System.IntPtr FlexLayout_SetPadding( global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_DownCast")]
             public static extern global::System.IntPtr FlexLayout_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1);
 
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_FlexLayout__SWIG_1")]
             public static extern global::System.IntPtr new_FlexLayout__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1);
 
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_Assign")]
             public static extern global::System.IntPtr FlexLayout_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_FlexLayout")]
             public static extern void delete_FlexLayout(global::System.Runtime.InteropServices.HandleRef jarg1);
 
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_SetFlexDirection")]
             public static extern void FlexLayout_SetFlexDirection(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
 
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_GetFlexDirection")]
             public static extern int FlexLayout_GetFlexDirection(global::System.Runtime.InteropServices.HandleRef jarg1);
 
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_SetFlexJustification")]
             public static extern void FlexLayout_SetFlexJustification(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
 
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_GetFlexJustification")]
             public static extern int FlexLayout_GetFlexJustification(global::System.Runtime.InteropServices.HandleRef jarg1);
 
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_SetFlexWrap")]
             public static extern void FlexLayout_SetFlexWrap(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
 
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_GetFlexWrap")]
             public static extern int FlexLayout_GetFlexWrap(global::System.Runtime.InteropServices.HandleRef jarg1);
 
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_SetFlexAlignment")]
             public static extern void FlexLayout_SetFlexAlignment(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
 
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_GetFlexAlignment")]
             public static extern int FlexLayout_GetFlexAlignment(global::System.Runtime.InteropServices.HandleRef jarg1);
 
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_SetFlexItemsAlignment")]
             public static extern void FlexLayout_SetFlexItemsAlignment(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
 
-
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_GetFlexItemsAlignment")]
             public static extern int FlexLayout_GetFlexItemsAlignment(global::System.Runtime.InteropServices.HandleRef jarg1);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_SetMaximumWidth")]
+            public static extern void FlexLayout_SetFlexMaximumWidth(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_SetMaximumHeight")]
+            public static extern void FlexLayout_SetFlexMaximumHeight(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_SetMinimumWidth")]
+            public static extern void FlexLayout_SetFlexMinimumWidth(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FlexLayout_SetMinimumHeight")]
+            public static extern void FlexLayout_SetFlexMinimumHeight(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2);
         }
     }
 }
index 86459d4..84d8d85 100644 (file)
@@ -155,7 +155,6 @@ namespace Tizen.NUI
         {
             if (rootNode.Layout != null)
             {
-                Log.Info("NUI", "Found root:" + rootNode.Name + "\n");
                 // rootNode has a layout, ensure all children have default layouts or layout items.
                 AutomaticallyAssignLayouts(rootNode);
                 // rootNode has a layout, start measuring and layouting from here.
@@ -205,7 +204,7 @@ namespace Tizen.NUI
                 MeasureSpecification.ModeType widthMode = MeasureSpecification.ModeType.AtMost;
                 MeasureSpecification.ModeType heightMode = MeasureSpecification.ModeType.AtMost;
 
-                if (root.WidthSpecification >= 0 )
+                if ( root.WidthSpecification >= 0 )
                 {
                     // exact size provided so match width exactly
                     width = new LayoutLength(root.WidthSpecification);
@@ -213,6 +212,7 @@ namespace Tizen.NUI
                 }
                 else if (root.WidthSpecification == LayoutParamPolicies.MatchParent)
                 {
+
                     widthMode = MeasureSpecification.ModeType.Exactly;
                 }
 
@@ -249,11 +249,16 @@ namespace Tizen.NUI
         /// </summary>
         private void Process(int id)
         {
-            Layer defaultLayer = _window.GetDefaultLayer();
-            for (uint i = 0; i < defaultLayer.ChildCount; i++)
+            // First layer in the Window should be the default layer (index 0 )
+            uint numberOfLayers = _window.LayerCount;
+            for (uint layerIndex = 0; layerIndex < numberOfLayers; layerIndex++)
             {
-                View view = defaultLayer.GetChildAt(i);
-                FindRootLayouts(view);
+                Layer layer = _window.GetLayer(layerIndex);
+                for (uint i = 0; i < layer.ChildCount; i++)
+                {
+                    View view = layer.GetChildAt(i);
+                    FindRootLayouts(view);
+                }
             }
 
         }
index 368be21..6b2183c 100755 (executable)
@@ -68,7 +68,11 @@ namespace Tizen.NUI
             /// <summary>
             /// At the vertical center of the container
             /// </summary>
-            CenterVertical     = 0x20
+            CenterVertical     = 0x20,
+            /// <summary>
+            /// At the vertical and horizontal center of the container
+            /// </summary>
+            Center             = 0x40
         }
 
         struct HeightAndWidthState
@@ -119,7 +123,7 @@ namespace Tizen.NUI
         /// <summary>
         /// [Draft] Get/Set the alignment in the layout
         /// </summary>
-        public LinearLayout.Alignment LinearAlignment{ get; set; } = Alignment.CenterVertical;
+        public LinearLayout.Alignment LinearAlignment{ get; set; } = Alignment.Top;
 
         private float _totalLength = 0.0f;
         private Size2D _cellPadding  = new Size2D(0,0);
@@ -156,6 +160,83 @@ namespace Tizen.NUI
             }
         }
 
+
+        private void MeasureWeightedChild( LayoutItem childLayout, float remainingExcess, float remainingWeight, float childWeight,
+                                           MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec,
+                                           HeightAndWidthState childState, Orientation orientation )
+        {
+            bool horizontal = false;
+            if (orientation == Orientation.Horizontal)
+            {
+                horizontal = true;
+            }
+
+            float childsShare = ( childWeight * remainingExcess ) / remainingWeight;
+            remainingExcess -= childsShare;
+            remainingWeight -= childWeight;
+
+            float desiredWidth = childLayout.Owner.WidthSpecification;
+            float desiredHeight = childLayout.Owner.HeightSpecification;
+            float childLength = 0;
+
+            Extents layoutPadding = Padding;
+
+            // Always lay out weighted elements with intrinsic size regardless of the parent spec.
+            // for consistency between specs.
+            if( ( horizontal && ( desiredWidth == 0 )) || ( !horizontal && ( desiredHeight == 0 )) )
+            {
+                // This child needs to be laid out from scratch using
+                // only its share of excess space.
+                childLength = childsShare;
+            }
+            else
+            {
+                // This child had some intrinsic width to which we
+                // need to add its share of excess space.
+                if (horizontal)
+                {
+                    childLength = childLayout.MeasuredWidth.Size.AsDecimal() + childsShare;
+                }
+                else
+                {
+                    childLength = childLayout.MeasuredHeight.Size.AsDecimal() + childsShare;
+                }
+            }
+
+            MeasureSpecification childWidthMeasureSpec;
+            MeasureSpecification childHeightMeasureSpec;
+
+            if (horizontal)
+            {
+                childWidthMeasureSpec = new MeasureSpecification( new LayoutLength(childLength), MeasureSpecification.ModeType.Exactly );
+                childHeightMeasureSpec = GetChildMeasureSpecification( heightMeasureSpec,
+                                                                    new LayoutLength(layoutPadding.Top + layoutPadding.Bottom),
+                                                                    new LayoutLength(desiredHeight) );
+            }
+            else // vertical
+            {
+                childWidthMeasureSpec = GetChildMeasureSpecification( widthMeasureSpec,
+                                            new LayoutLength(Padding.Start + Padding.End),
+                                            new LayoutLength(desiredWidth) );
+
+                childHeightMeasureSpec = new MeasureSpecification( new LayoutLength(childLength), MeasureSpecification.ModeType.Exactly);
+            }
+
+            childLayout.Measure( childWidthMeasureSpec, childHeightMeasureSpec );
+
+            // Child may now not fit in horizontal dimension.
+            if( childLayout.MeasuredWidthAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall)
+            {
+                childState.widthState = MeasuredSize.StateType.MeasuredSizeTooSmall;
+            }
+
+            // Child may now not fit in vertical dimension.
+            if( childLayout.MeasuredHeightAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall)
+            {
+                childState.heightState = MeasuredSize.StateType.MeasuredSizeTooSmall;
+            }
+        }
+
         private void MeasureHorizontal(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
         {
             var widthMode = widthMeasureSpec.Mode;
@@ -168,57 +249,59 @@ namespace Tizen.NUI
             float weightedMaxHeight = 0.0f;
             float totalWeight = 0.0f;
 
-            // Reset total length
+            // Reset measure variables
             _totalLength = 0.0f;
-            LayoutLength usedExcessSpace = new LayoutLength(0);
-
+            float usedExcessSpace = 0.0f;
             HeightAndWidthState childState = new HeightAndWidthState(MeasuredSize.StateType.MeasuredSizeOK,
                                                                      MeasuredSize.StateType.MeasuredSizeOK);
 
-            // Measure children, and determine if further resolution is required
-
             // 1st phase:
             // We cycle through all children and measure children with weight 0 (non weighted children) according to their specs
             // to accumulate total used space in totalLength based on measured sizes and margins.
             // Weighted children are not measured at this phase.
             // Available space for weighted children will be calculated in the phase 2 based on totalLength value.
-
+            // Max height of children is stored.
             foreach( LayoutItem childLayout in _children )
             {
-                LayoutLength childDesiredWidth = new LayoutLength(childLayout.Owner.WidthSpecification);
-                LayoutLength childDesiredHeight = new LayoutLength(childLayout.Owner.HeightSpecification);
+                int childDesiredHeight = childLayout.Owner.HeightSpecification;
                 float childWeight = childLayout.Owner.Weight;
                 Extents childMargin = childLayout.Margin;
                 totalWeight += childWeight;
 
-                bool useExcessSpace = (childDesiredWidth.AsRoundedValue() == 0 ) && (childWeight > 0);
+                bool useExcessSpace = (childLayout.Owner.WidthSpecification == 0 ) && (childWeight > 0);
                 if( isExactly && useExcessSpace )
                 {
+                    // Children to be laid out with excess space can be measured later
                     _totalLength += childMargin.Start + childMargin.End;
                 }
                 else
                 {
-                    if( useExcessSpace )
+                    if (useExcessSpace)
                     {
-                        // The widthMode is either UNSPECIFIED or AT_MOST, and
+                        // The widthMode is either Unspecified or AtMost, and
                         // this child is only laid out using excess space. Measure
-                        // using WRAP_CONTENT so that we can find out the view's
+                        // using WrapContent so that we can find out the view's
                         // optimal width.
-                        MeasureSpecification childWidthMeasureSpec = GetChildMeasureSpecification(widthMeasureSpec, new LayoutLength(childLayout.Padding.Start + childLayout.Padding.End),
-                                                                    new LayoutLength(LayoutParamPolicies.WrapContent) );
-                        MeasureSpecification childHeightMeasureSpec = GetChildMeasureSpecification(heightMeasureSpec, new LayoutLength(childLayout.Padding.Top + childLayout.Padding.Bottom),
-                                                                    childDesiredHeight);
+                        MeasureSpecification childWidthMeasureSpec = GetChildMeasureSpecification(widthMeasureSpec,
+                                                new LayoutLength(childLayout.Padding.Start + childLayout.Padding.End),
+                                                new LayoutLength(LayoutParamPolicies.WrapContent));
+
+                        MeasureSpecification childHeightMeasureSpec = GetChildMeasureSpecification(heightMeasureSpec,
+                                                new LayoutLength(childLayout.Padding.Top + childLayout.Padding.Bottom),
+                                                new LayoutLength(childDesiredHeight));
+
                         childLayout.Measure( childWidthMeasureSpec, childHeightMeasureSpec);
-                        usedExcessSpace += childLayout.MeasuredWidth.Size;
+                        usedExcessSpace += childLayout.MeasuredWidth.Size.AsDecimal();
                     }
                     else
                     {
                         MeasureChild(childLayout, widthMeasureSpec, heightMeasureSpec);
                     }
-                    LayoutLength childWidth = childLayout.MeasuredWidth.Size;
 
+                    LayoutLength childWidth = childLayout.MeasuredWidth.Size;
                     LayoutLength length = childWidth + childMargin.Start + childMargin.End;
-                    if( isExactly )
+
+                    if (isExactly)
                     {
                         _totalLength += length.AsDecimal();
                     }
@@ -229,53 +312,111 @@ namespace Tizen.NUI
                 }
 
                 bool matchHeightLocally = false;
-                if(heightMode != MeasureSpecification.ModeType.Exactly && (int)childDesiredHeight.AsRoundedValue() == LayoutParamPolicies.MatchParent)
+                if (heightMode != MeasureSpecification.ModeType.Exactly && childDesiredHeight == LayoutParamPolicies.MatchParent)
                 {
+                    // A child has set to MatchParent on it's height.
                     // Will have to re-measure at least this child when we know exact height.
                     matchHeight = true;
                     matchHeightLocally = true;
                 }
 
-                LayoutLength marginHeight = new LayoutLength(childMargin.Top + childMargin.Bottom);
-                LayoutLength childHeight = childLayout.MeasuredHeight.Size + marginHeight;
+                float marginHeight = childMargin.Top + childMargin.Bottom;
+                float childHeight = childLayout.MeasuredHeight.Size.AsDecimal() + marginHeight;
 
-                if( childLayout.MeasuredWidthAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall )
+                if (childLayout.MeasuredWidthAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall)
                 {
                     childState.widthState = MeasuredSize.StateType.MeasuredSizeTooSmall;
                 }
-                ifchildLayout.MeasuredHeightAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall)
+                if (childLayout.MeasuredHeightAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall)
                 {
                     childState.heightState = MeasuredSize.StateType.MeasuredSizeTooSmall;
                 }
 
-                maxHeight = Math.Max( maxHeight, childHeight.AsDecimal());
-                allFillParent = ( allFillParent && childDesiredHeight.AsRoundedValue() == LayoutParamPolicies.MatchParent );
+                maxHeight = Math.Max( maxHeight, childHeight);
+                allFillParent = ( allFillParent && childDesiredHeight == LayoutParamPolicies.MatchParent);
 
-                if( childWeight > 0 )
+                if (childWeight > 0)
                 {
-                  /*
-                  * Heights of weighted Views are bogus if we end up
-                  * remeasuring, so keep them separate.
-                  */
-                  weightedMaxHeight = Math.Max( weightedMaxHeight, matchHeightLocally ? marginHeight.AsDecimal() : childHeight.AsDecimal());
+                  // Heights of weighted Views are invalid if we end up remeasuring, so store them separately.
+                  weightedMaxHeight = Math.Max( weightedMaxHeight, matchHeightLocally ? marginHeight : childHeight);
                 }
                 else
                 {
-                  alternativeMaxHeight = Math.Max( alternativeMaxHeight, matchHeightLocally ? marginHeight.AsDecimal() : childHeight.AsDecimal() );
+                  alternativeMaxHeight = Math.Max( alternativeMaxHeight, matchHeightLocally ? marginHeight : childHeight );
                 }
             } // foreach
 
             Extents padding = Padding;
             _totalLength += padding.Start + padding.End;
-            LayoutLength widthSize = new LayoutLength(_totalLength);
-            widthSize = new LayoutLength( Math.Max( widthSize.AsDecimal(), SuggestedMinimumWidth.AsDecimal()));
-            MeasuredSize widthSizeAndState = ResolveSizeAndState( widthSize, widthMeasureSpec, MeasuredSize.StateType.MeasuredSizeOK);
-            widthSize = widthSizeAndState.Size;
+
+            float widthSize = _totalLength;
+            widthSize = Math.Max( widthSize, SuggestedMinimumWidth.AsDecimal());
+            MeasuredSize widthSizeAndState = ResolveSizeAndState( new LayoutLength(widthSize), widthMeasureSpec, MeasuredSize.StateType.MeasuredSizeOK);
+            widthSize = widthSizeAndState.Size.AsDecimal();
+
+            // 2nd phase:
+            // Expand children with weight to take up available space
+            // We cycle through weighted children now (children with weight > 0).
+            // The children are measured with exact size equal to their share of the available space based on their weights.
+            // _totalLength is updated to include weighted children measured sizes.
+            float remainingExcess = widthSize - _totalLength + usedExcessSpace;
+            if( remainingExcess != 0 && totalWeight > 0 )
+            {
+                float remainingWeight = totalWeight;
+                maxHeight = 0;
+                _totalLength = 0;
+
+                int numberOfChildren = _children.Count;
+                for( int i = 0; i < numberOfChildren; ++i )
+                {
+                    LayoutItem childLayout = _children[i];
+
+                    float desiredChildHeight = childLayout.Owner.HeightSpecification;
+
+                    float childWeight = childLayout.Owner.Weight;
+                    Extents childMargin = childLayout.Margin;
+
+                    if( childWeight > 0 )
+                    {
+                        MeasureWeightedChild(childLayout, remainingExcess, remainingWeight, childWeight,
+                                             widthMeasureSpec, heightMeasureSpec, childState,
+                                             Orientation.Horizontal );
+                    }
+
+                    float length = childLayout.MeasuredWidth.Size.AsDecimal() + childMargin.Start + childMargin.End;
+                    float cellPadding = i < numberOfChildren - 1 ? CellPadding.Width : 0;
+                    if( isExactly )
+                    {
+                        _totalLength += length;
+                    }
+                    else
+                    {
+                        float totalLength = _totalLength;
+                        _totalLength = Math.Max( _totalLength, _totalLength + length + cellPadding );
+                    }
+
+                    bool matchHeightLocally = (heightMode != MeasureSpecification.ModeType.Exactly) && (desiredChildHeight == LayoutParamPolicies.MatchParent);
+                    float marginHeight = childMargin.Top + childMargin.Bottom;
+                    float childHeight = childLayout.MeasuredHeight.Size.AsDecimal() + marginHeight;
+
+                    maxHeight = Math.Max( maxHeight, childHeight );
+                    alternativeMaxHeight = Math.Max( alternativeMaxHeight, matchHeightLocally ? marginHeight : childHeight );
+                    allFillParent = (allFillParent && desiredChildHeight == LayoutParamPolicies.MatchParent);
+
+                    _totalLength += padding.Start + padding.End;
+                } // for loop
+            }
+            else
+            {
+                // No excess space or no weighted children
+                alternativeMaxHeight = Math.Max( alternativeMaxHeight, weightedMaxHeight );
+            }
 
             if (!allFillParent && heightMode != MeasureSpecification.ModeType.Exactly)
             {
                 maxHeight = alternativeMaxHeight;
             }
+
             maxHeight += padding.Top + padding.Bottom;
             maxHeight = Math.Max( maxHeight, SuggestedMinimumHeight.AsRoundedValue() );
 
@@ -286,11 +427,11 @@ namespace Tizen.NUI
 
             if (matchHeight)
             {
-                ForceUniformHeight( _children.Count, widthMeasureSpec );
+                ForceUniformHeight(widthMeasureSpec);
             }
-        } // MeasureHorizontally
+        } // MeasureHorizontal
 
-        void MeasureVertical( MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec )
+        private void MeasureVertical( MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec )
         {
             var widthMode = widthMeasureSpec.Mode;
             var heightMode = heightMeasureSpec.Mode;
@@ -304,7 +445,7 @@ namespace Tizen.NUI
 
             // Reset total length
             _totalLength = 0.0f;
-            LayoutLength usedExcessSpace = new LayoutLength(0);
+            float usedExcessSpace =0.0f;
 
             HeightAndWidthState childState = new HeightAndWidthState(MeasuredSize.StateType.MeasuredSizeOK,
                                                                      MeasuredSize.StateType.MeasuredSizeTooSmall);
@@ -314,52 +455,51 @@ namespace Tizen.NUI
 
             // 1st phase:
             // We cycle through all children and measure children with weight 0 (non weighted children) according to their specs
-            // to accumulate total used space in mTotalLength based on measured sizes and margins.
-            // Weighted children are not measured at this phase.
-            // Available space for weighted children will be calculated in the phase 2 based on mTotalLength value.
+            // to accumulate total used space in _totalLength.
+            // Weighted children are not measured in this phase.
+            // Available space for weighted children will be calculated in the phase 2 based on _totalLength value.
             uint index = 0;
             foreach( LayoutItem childLayout in _children )
             {
-                LayoutLength childDesiredWidth = new LayoutLength(childLayout.Owner.WidthSpecification);
-                LayoutLength childDesiredHeight = new LayoutLength(childLayout.Owner.HeightSpecification);
+                int childDesiredWidth = childLayout.Owner.WidthSpecification;
+                int childDesiredHeight = childLayout.Owner.HeightSpecification;
                 float childWeight = childLayout.Owner.Weight;
                 Extents childMargin = childLayout.Margin;
                 totalWeight += childWeight;
 
-                bool useExcessSpace = (childDesiredHeight.AsRoundedValue() == 0) && (childWeight > 0);
+                bool useExcessSpace = (childDesiredHeight == 0) && (childWeight > 0);
 
                 if( isExactly && useExcessSpace )
                 {
-                   LayoutLength totalLength = new LayoutLength(_totalLength);
-                   _totalLength = Math.Max( totalLength.AsDecimal(), (totalLength + childMargin.Top + childMargin.Bottom).AsDecimal() );
+                   _totalLength = Math.Max( _totalLength, (_totalLength + childMargin.Top + childMargin.Bottom) );
                 }
                 else
                 {
-                    LayoutLength childHeight = new LayoutLength(0);
+                    float childHeight = 0.0f;
                     if( useExcessSpace )
                     {
                         // The heightMode is either Unspecified or AtMost, and
                         // this child is only laid out using excess space. Measure
                         // using WrapContent so that we can find out the view's
-                        // optimal height. We'll restore the original height of 0
-                        // after measurement.
+                        // optimal height.
+                        // We'll restore the original height of 0 after measurement.
                         MeasureSpecification childWidthMeasureSpec = GetChildMeasureSpecification( widthMeasureSpec,
                                                                     new LayoutLength(childLayout.Padding.Start + childLayout.Padding.End),
-                                                                    childDesiredWidth);
+                                                                    new LayoutLength(childDesiredWidth) );
                         MeasureSpecification childHeightMeasureSpec = GetChildMeasureSpecification( heightMeasureSpec,
                                                                       new LayoutLength(childLayout.Padding.Top + childLayout.Padding.Bottom),
                                                                       new LayoutLength(LayoutParamPolicies.WrapContent) );
                         childLayout.Measure( childWidthMeasureSpec, childHeightMeasureSpec );
-                        childHeight = childLayout.MeasuredHeight.Size;
+                        childHeight = childLayout.MeasuredHeight.Size.AsDecimal();
                         usedExcessSpace += childHeight;
                     }
                     else
                     {
                         MeasureChild( childLayout, widthMeasureSpec, heightMeasureSpec );
-                        childHeight = childLayout.MeasuredHeight.Size;
+                        childHeight = childLayout.MeasuredHeight.Size.AsDecimal();
                     }
 
-                    float length = (childHeight + childMargin.Top + childMargin.Bottom).AsDecimal();
+                    float length = childHeight + childMargin.Top + childMargin.Bottom;
                     float cellPadding = CellPadding.Height;
                     // No need to add cell padding to the end of last item.
                     if (index>=_children.Count-1)
@@ -370,7 +510,7 @@ namespace Tizen.NUI
                 }
 
                 bool matchWidthLocally = false;
-                if( widthMode != MeasureSpecification.ModeType.Exactly && childDesiredWidth ==  new LayoutLength(LayoutParamPolicies.MatchParent) )
+                if( widthMode != MeasureSpecification.ModeType.Exactly && (childDesiredWidth ==  LayoutParamPolicies.MatchParent) )
                 {
                     // Will have to re-measure at least this child when we know exact height.
                     matchWidth = true;
@@ -378,9 +518,8 @@ namespace Tizen.NUI
                 }
 
                 float marginWidth = (childLayout.Margin.Start) + (childLayout.Margin.End);
-                LayoutLength childWidth = new LayoutLength(childLayout.MeasuredWidth.Size.AsDecimal() + marginWidth);
+                float childWidth = childLayout.MeasuredWidth.Size.AsDecimal() + marginWidth;
 
-                // was combineMeasuredStates()
                 if (childLayout.MeasuredWidthAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall)
                 {
                     childState.widthState = MeasuredSize.StateType.MeasuredSizeTooSmall;
@@ -390,10 +529,10 @@ namespace Tizen.NUI
                     childState.heightState = MeasuredSize.StateType.MeasuredSizeTooSmall;
                 }
 
-                maxWidth = (Math.Max( maxWidth, childWidth.AsDecimal()));
-                allFillParent = (allFillParent && (childDesiredWidth == new LayoutLength(LayoutParamPolicies.MatchParent)));
+                maxWidth = Math.Max( maxWidth, childWidth);
+                allFillParent = (allFillParent && (childDesiredWidth == LayoutParamPolicies.MatchParent));
 
-                float widthforWeight = childWidth.AsDecimal();
+                float widthforWeight = childWidth;
                 if (matchWidthLocally)
                 {
                     widthforWeight = marginWidth;
@@ -401,15 +540,14 @@ namespace Tizen.NUI
 
                 if (childWeight > 0)
                 {
-                    /*
-                    * Widths of weighted Views are bogus if we end up remeasuring, so keep them separate.
-                    */
+                    // Widths of weighted Views are bogus if we end up remeasuring, so keep them separate.
                     weightedMaxWidth = Math.Max( weightedMaxWidth, widthforWeight);
                 }
                 else
                 {
                     alternativeMaxWidth = Math.Max( alternativeMaxWidth, widthforWeight);
                 }
+                index++;
             } // foreach
 
 
@@ -420,68 +558,37 @@ namespace Tizen.NUI
             MeasuredSize heightSizeAndState = ResolveSizeAndState( heightSize, heightMeasureSpec, MeasuredSize.StateType.MeasuredSizeOK);
             heightSize = heightSizeAndState.Size;
 
-            // Either expand children with weight to take up available space or
-            // shrink them if they extend beyond our current bounds. If we skipped
-            // measurement on any children, we need to measure them now.
-
             // 2nd phase:
             // We cycle through weighted children now (children with weight > 0).
             // The children are measured with exact size equal to their share of the available space based on their weights.
-            // TotalLength is updated to include weighted children measured sizes.
-
-            float remainingExcess = heightSize.AsDecimal() - _totalLength + usedExcessSpace.AsDecimal();
+            // _totalLength is updated to include weighted children measured sizes.
+            float remainingExcess = heightSize.AsDecimal() - _totalLength + usedExcessSpace;
 
             if( remainingExcess != 0 && totalWeight > 0.0f )
             {
-                float remainingWeightSum = totalWeight;
+                float remainingWeight = totalWeight;
 
                 _totalLength = 0;
 
-                foreach( LayoutItem childLayout in _children )
+                int numberOfChildren = _children.Count;
+                for( int i = 0; i < numberOfChildren; ++i )
                 {
-                    int desiredWidth = childLayout.Owner.WidthSpecification;
-                    int desiredHeight = childLayout.Owner.HeightSpecification;
+                    LayoutItem childLayout = _children[i];
+
+                    float desiredChildWidth = childLayout.Owner.WidthSpecification;
+
                     float childWeight = childLayout.Owner.Weight;
                     Extents childMargin = childLayout.Margin;
 
-                    float childHeight = 0;
                     if( childWeight > 0 )
                     {
-                        float share = ( childWeight * remainingExcess ) / remainingWeightSum;
-                        remainingExcess -= share;
-                        remainingWeightSum -= childWeight;
-
-                        // Always lay out weighted elements with intrinsic size regardless of the parent spec
-                        // for consistency between specs.
-                        if( desiredHeight == 0 )
-                        {
-                          // This child needs to be laid out from scratch using
-                          // only its share of excess space.
-                          childHeight = share;
-                        }
-                        else
-                        {
-                          // This child had some intrinsic width to which we
-                          // need to add its share of excess space.
-                          childHeight = childLayout.MeasuredHeight.Size.AsDecimal() + share;
-                        }
-
-                        MeasureSpecification childWidthMeasureSpec = GetChildMeasureSpecification( widthMeasureSpec,
-                                            new LayoutLength(Padding.Start + Padding.End),
-                                            new LayoutLength(desiredWidth) );
-
-                        MeasureSpecification childHeightMeasureSpec = new MeasureSpecification( new LayoutLength(childHeight), MeasureSpecification.ModeType.Exactly);
-                        childLayout.Measure( childWidthMeasureSpec, childHeightMeasureSpec );
-
-                        // Child may now not fit in vertical dimension.
-                        if( childLayout.MeasuredHeightAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall)
-                        {
-                            childState.heightState = MeasuredSize.StateType.MeasuredSizeTooSmall;
-                        }
+                      MeasureWeightedChild(childLayout, remainingExcess, remainingWeight, childWeight,
+                                              widthMeasureSpec, heightMeasureSpec, childState,
+                                              Orientation.Vertical);
                     }
 
                     bool matchWidthLocally = false;
-                    if( widthMode != MeasureSpecification.ModeType.Exactly && desiredWidth == (int)ChildLayoutData.MatchParent )
+                    if( widthMode != MeasureSpecification.ModeType.Exactly && desiredChildWidth == LayoutParamPolicies.MatchParent)
                     {
                         // Will have to re-measure at least this child when we know exact height.
                         matchWidth = true;
@@ -491,24 +598,17 @@ namespace Tizen.NUI
                     float marginWidth = childMargin.Start + childMargin.End;
                     float childWidth = childLayout.MeasuredWidth.Size.AsDecimal() + marginWidth;
                     maxWidth = Math.Max( maxWidth, childWidth );
-                    allFillParent = allFillParent && desiredWidth == (int)ChildLayoutData.MatchParent;
-
+                    allFillParent = allFillParent && desiredChildWidth == LayoutParamPolicies.MatchParent;
 
+                    float childHeight = childLayout.MeasuredHeight.Size.AsDecimal();
+                    float childLength = childHeight + childMargin.Top + childMargin.Bottom;
+                    float cellPadding = i < numberOfChildren - 1 ? CellPadding.Height : 0.0f;
+                    _totalLength = _totalLength + childLength + cellPadding;
                     alternativeMaxWidth = Math.Max( alternativeMaxWidth, matchWidthLocally ? marginWidth : childWidth );
-
-                    childHeight = childLayout.MeasuredHeight.Size.AsDecimal();
-                    float length = childHeight + childMargin.Top + childMargin.Bottom;
-                    float cellPadding = CellPadding.Height;
-                    // No need to add cell padding to the end of last item.
-                    if (index>=_children.Count-1)
-                    {
-                        cellPadding = 0.0f;
-                    }
-                    _totalLength = Math.Max( _totalLength, _totalLength + length + cellPadding );
-                } // foreach
+                } // for loop
 
                 // Add in our padding
-                _totalLength += Padding.Top + Padding.Bottom;
+                _totalLength += padding.Top + padding.Bottom;
             }
             else
             {
@@ -527,13 +627,13 @@ namespace Tizen.NUI
             SetMeasuredDimensions( ResolveSizeAndState( new LayoutLength(maxWidth), widthMeasureSpec, childState.widthState ),
                                   heightSizeAndState );
 
-            if( matchWidth )
+            if (matchWidth)
             {
-                ForceUniformWidth( _children.Count, heightMeasureSpec );
+                ForceUniformWidth(heightMeasureSpec );
             }
-        } // MeasureVertically
+        } // MeasureVertical
 
-        void LayoutHorizontal(LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
+        private void LayoutHorizontal(LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
         {
             bool isLayoutRtl = Owner.LayoutDirection == ViewLayoutDirectionType.RTL;
 
@@ -550,35 +650,36 @@ namespace Tizen.NUI
 
             switch (LinearAlignment)
             {
-                case Alignment.Begin:
-                default:
+                case Alignment.End:
                     // totalLength contains the padding already
-                    // In case of RTL map BEGIN alignment to the right edge
+                    // In case of RTL map END alignment to the left edge
                     if (isLayoutRtl)
                     {
-                        childLeft = new LayoutLength(Padding.Start  + right.AsDecimal() - left.AsDecimal() - _totalLength);
+                        childLeft = new LayoutLength(Padding.Start);
                     }
                     else
                     {
-                        childLeft = new LayoutLength(Padding.Start);
+                        childLeft = new LayoutLength(Padding.Start + right.AsDecimal() - left.AsDecimal() - _totalLength);
                     }
                     break;
-                case Alignment.End:
+                case Alignment.CenterHorizontal: // FALL THROUGH
+                case Alignment.Center:
                     // totalLength contains the padding already
-                    // In case of RTL map END alignment to the left edge
+                    childLeft = new LayoutLength(Padding.Start + (right.AsDecimal() - left.AsDecimal() - _totalLength) / 2.0f);
+                    break;
+                case Alignment.Begin: // FALL THROUGH (default)
+                default:
+                    // totalLength contains the padding already
+                    // In case of RTL map BEGIN alignment to the right edge
                     if (isLayoutRtl)
                     {
-                        childLeft = new LayoutLength(Padding.Start);
+                        childLeft = new LayoutLength(Padding.Start  + right.AsDecimal() - left.AsDecimal() - _totalLength);
                     }
                     else
                     {
-                        childLeft = new LayoutLength(Padding.Start + right.AsDecimal() - left.AsDecimal() - _totalLength);
+                        childLeft = new LayoutLength(Padding.Start);
                     }
                     break;
-                case Alignment.CenterHorizontal:
-                    // totalLength contains the padding already
-                    childLeft = new LayoutLength(Padding.Start + (right.AsDecimal() - left.AsDecimal() - _totalLength) / 2.0f);
-                    break;
             }
 
             int start = 0;
@@ -604,16 +705,17 @@ namespace Tizen.NUI
 
                     switch ( LinearAlignment )
                     {
-                        case Alignment.Top:
-                            childTop = new LayoutLength(Padding.Top + childMargin.Top);
-                            break;
                         case Alignment.Bottom:
                             childTop = new LayoutLength(height - Padding.Bottom - childHeight - childMargin.Bottom);
                             break;
-                        case Alignment.CenterVertical: // FALLTHROUGH
-                        default:
+                        case Alignment.CenterVertical:
+                        case Alignment.Center: // FALLTHROUGH
                             childTop = new LayoutLength(Padding.Top + ( ( childSpace - childHeight ).AsDecimal() / 2.0f ) + childMargin.Top - childMargin.Bottom);
                             break;
+                        case Alignment.Top: // FALLTHROUGH default
+                        default:
+                            childTop = new LayoutLength(Padding.Top + childMargin.Top);
+                            break;
                     }
                     childLeft += childMargin.Start;
                     childLayout.Layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);
@@ -622,7 +724,7 @@ namespace Tizen.NUI
             }
         } // LayoutHorizontally
 
-        void LayoutVertical(LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
+        private void LayoutVertical(LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
         {
             LayoutLength childTop = new LayoutLength(Padding.Top);
             LayoutLength childLeft = new LayoutLength(Padding.Start);
@@ -637,19 +739,20 @@ namespace Tizen.NUI
 
             switch (LinearAlignment)
             {
-              case Alignment.Top:
-                // totalLength contains the padding already
-                childTop = new LayoutLength( Padding.Top );
-                break;
               case Alignment.Bottom:
                 // totalLength contains the padding already
                 childTop = new LayoutLength( Padding.Top + bottom.AsDecimal() - top.AsDecimal() - _totalLength);
                 break;
-              case Alignment.CenterVertical:
-              default:
+              case Alignment.CenterVertical: // FALL THROUGH
+              case Alignment.Center:
                 // totalLength contains the padding already
                 childTop = new LayoutLength(Padding.Top + ( bottom.AsDecimal() - top.AsDecimal() - _totalLength ) / 2.0f);
                 break;
+              case Alignment.Top:  // FALL THROUGH (default)
+              default:
+                // totalLength contains the padding already
+                childTop = new LayoutLength( Padding.Top );
+                break;
             }
 
             for( int i = 0; i < count; i++)
@@ -676,6 +779,7 @@ namespace Tizen.NUI
                         break;
                       }
                       case Alignment.CenterHorizontal:
+                      case Alignment.Center: // FALL THROUGH
                       {
                         childLeft = new LayoutLength(Padding.Start + (( childSpace - childWidth ).AsDecimal() / 2.0f) + childMargin.Start - childMargin.End);
                         break;
@@ -687,59 +791,51 @@ namespace Tizen.NUI
             }
         } // LayoutVertical
 
-        void ForceUniformHeight( int count, MeasureSpecification widthMeasureSpec )
+        private void ForceUniformHeight(MeasureSpecification widthMeasureSpec)
         {
           // Pretend that the linear layout has an exact size. This is the measured height of
           // ourselves. The measured height should be the max height of the children, changed
           // to accommodate the heightMeasureSpec from the parent
           MeasureSpecification uniformMeasureSpec = new MeasureSpecification( MeasuredHeight.Size, MeasureSpecification.ModeType.Exactly);
-          for (int i = 0; i < count; ++i)
+          foreach (LayoutItem childLayout in _children)
           {
-            LayoutItem childLayout = _children[i];
-            if (childLayout != null)
-            {
-                LayoutLength desiredWidth = new LayoutLength(childLayout.Owner.WidthSpecification);
-                LayoutLength desiredHeight = new LayoutLength(Owner.WidthSpecification );
+              int desiredChildHeight = childLayout.Owner.HeightSpecification;
+              int desiredChildWidth = childLayout.Owner.WidthSpecification;
 
-                if (desiredHeight.AsRoundedValue() == LayoutParamPolicies.MatchParent)
-                {
-                  // Temporarily force children to reuse their old measured width
-                  LayoutLength oldWidth = desiredWidth;
+              if (desiredChildHeight == LayoutParamPolicies.MatchParent)
+              {
+                  // Temporarily force children to reuse their original measured width
+                  int originalWidth = desiredChildWidth;
                   childLayout.Owner.WidthSpecification = (int)childLayout.MeasuredWidth.Size.AsRoundedValue();
                   // Remeasure with new dimensions
                   MeasureChildWithMargins( childLayout, widthMeasureSpec, new LayoutLength(0),
                                            uniformMeasureSpec, new LayoutLength(0) );
-
-                  childLayout.Owner.WidthSpecification =  (int)oldWidth.AsRoundedValue();
+                  // Restore width specification
+                  childLayout.Owner.WidthSpecification =  originalWidth;
               }
-            }
           }
         }
 
-        void ForceUniformWidth( int count, MeasureSpecification heightMeasureSpec )
+        private void ForceUniformWidth(MeasureSpecification heightMeasureSpec)
         {
             // Pretend that the linear layout has an exact size.
             MeasureSpecification uniformMeasureSpec = new MeasureSpecification( MeasuredWidth.Size, MeasureSpecification.ModeType.Exactly);
-            for (int i = 0; i < count; ++i)
+            foreach (LayoutItem childLayout in _children)
             {
-                LayoutItem childLayout = _children[i];
-                if (childLayout != null)
-                {
-                    LayoutLength desiredWidth = new LayoutLength(childLayout.Owner.WidthSpecification);
-                    LayoutLength desiredHeight = new LayoutLength(Owner.WidthSpecification );
+                int desiredChildWidth = childLayout.Owner.WidthSpecification;
+                int desiredChildHeight = childLayout.Owner.WidthSpecification;
 
-                    if( desiredWidth.AsRoundedValue()  == LayoutParamPolicies.MatchParent)
-                    {
-                        // Temporarily force children to reuse their old measured height
-                        LayoutLength oldHeight = desiredHeight;
-                        childLayout.Owner.HeightSpecification =  (int)childLayout.MeasuredHeight.Size.AsRoundedValue();
-
-                        // Remeasure with new dimensions
-                        MeasureChildWithMargins( childLayout, uniformMeasureSpec, new LayoutLength(0),
-                                                heightMeasureSpec, new LayoutLength(0));
-
-                        childLayout.Owner.HeightSpecification = (int)oldHeight.AsRoundedValue();
-                    }
+                if (desiredChildWidth  == LayoutParamPolicies.MatchParent)
+                {
+                    // Temporarily force children to reuse their original measured height
+                    int originalHeight = desiredChildHeight;
+                    childLayout.Owner.HeightSpecification =  (int)childLayout.MeasuredHeight.Size.AsRoundedValue();
+
+                    // Remeasure with new dimensions
+                    MeasureChildWithMargins( childLayout, uniformMeasureSpec, new LayoutLength(0),
+                                             heightMeasureSpec, new LayoutLength(0));
+                    // Restore height specification
+                    childLayout.Owner.HeightSpecification = originalHeight;
                 }
             }
         }
index 91703f0..d676620 100755 (executable)
@@ -519,7 +519,7 @@ namespace Tizen.NUI
             }
 
             /// <since_tizen> 3 </since_tizen>
-            public static readonly int PAGE_SIZE = Interop.PageTurnView.PageTurnView_Property_PAGE_SIZE_get();
+            public static readonly int VIEW_PAGE_SIZE = Interop.PageTurnView.PageTurnView_Property_VIEW_PAGE_SIZE_get();
             /// <since_tizen> 3 </since_tizen>
             public static readonly int CURRENT_PAGE_ID = Interop.PageTurnView.PageTurnView_Property_CURRENT_PAGE_ID_get();
             /// <since_tizen> 3 </since_tizen>
@@ -585,12 +585,12 @@ namespace Tizen.NUI
             get
             {
                 Vector2 temp = new Vector2(0.0f, 0.0f);
-                GetProperty(PageTurnView.Property.PAGE_SIZE).Get(temp);
+                GetProperty(PageTurnView.Property.VIEW_PAGE_SIZE).Get(temp);
                 return temp;
             }
             set
             {
-                SetProperty(PageTurnView.Property.PAGE_SIZE, new Tizen.NUI.PropertyValue(value));
+                SetProperty(PageTurnView.Property.VIEW_PAGE_SIZE, new Tizen.NUI.PropertyValue(value));
             }
         }
         public int CurrentPageId
index c775bb8..df6aaa5 100755 (executable)
@@ -349,16 +349,6 @@ namespace Tizen.NUI
         }
 
         /// <summary>
-        /// Sets whether the frame count per render is managed using the hardware vsync or manually timed.
-        /// </summary>
-        /// <param name="useHardware">True if the hardware vsync should be used.</param>
-        internal void SetUseHardwareVSync(bool useHardware)
-        {
-            Interop.Adaptor.Adaptor_SetUseHardwareVSync(swigCPtr, useHardware);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
-        /// <summary>
         /// Calls this method to notify DALi when a scene is created and initialized.
         /// Notify the adaptor that the scene has been created.
         /// </summary>
index 820f38a..b0c22ab 100755 (executable)
@@ -610,7 +610,7 @@ namespace Tizen.NUI.BaseComponents
             set
             {
                 SetValue(TextProperty, value);
-                NotifyPropertyChanged();
+                NotifyPropertyChangedAndRequestLayout();
             }
         }
 
@@ -628,7 +628,7 @@ namespace Tizen.NUI.BaseComponents
             set
             {
                 SetValue(FontFamilyProperty, value);
-                NotifyPropertyChanged();
+                NotifyPropertyChangedAndRequestLayout();
             }
         }
 
@@ -646,7 +646,7 @@ namespace Tizen.NUI.BaseComponents
             set
             {
                 SetValue(FontStyleProperty, value);
-                NotifyPropertyChanged();
+                NotifyPropertyChangedAndRequestLayout();
             }
         }
 
@@ -664,7 +664,7 @@ namespace Tizen.NUI.BaseComponents
             set
             {
                 SetValue(PointSizeProperty, value);
-                NotifyPropertyChanged();
+                NotifyPropertyChangedAndRequestLayout();
             }
         }
 
@@ -682,7 +682,7 @@ namespace Tizen.NUI.BaseComponents
             set
             {
                 SetValue(MultiLineProperty, value);
-                NotifyPropertyChanged();
+                NotifyPropertyChangedAndRequestLayout();
             }
         }
 
@@ -997,7 +997,7 @@ namespace Tizen.NUI.BaseComponents
             set
             {
                 SetValue(LineSpacingProperty, value);
-                NotifyPropertyChanged();
+                NotifyPropertyChangedAndRequestLayout();
             }
         }
 
@@ -1087,7 +1087,7 @@ namespace Tizen.NUI.BaseComponents
             set
             {
                 SetValue(PixelSizeProperty, value);
-                NotifyPropertyChanged();
+                NotifyPropertyChangedAndRequestLayout();
             }
         }
 
@@ -1327,6 +1327,12 @@ namespace Tizen.NUI.BaseComponents
             Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-")));
         }
 
+        private void  NotifyPropertyChangedAndRequestLayout()
+        {
+            NotifyPropertyChanged();
+            Layout?.RequestLayout();
+        }
+
         internal new class Property
         {
             internal static readonly int RENDERING_BACKEND = Interop.TextLabel.TextLabel_Property_RENDERING_BACKEND_get();
index 6a27657..50ee78a 100755 (executable)
@@ -3414,6 +3414,9 @@ namespace Tizen.NUI.BaseComponents
         /// The required policy for this dimension, ChildLayoutData enum or exact value.
         ///</summary>
         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+        /// <remarks>
+        /// Previously named LayoutWidthSpecification
+        /// </remarks>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public int WidthSpecification
         {
@@ -3427,7 +3430,7 @@ namespace Tizen.NUI.BaseComponents
                 if (_widthPolicy >= 0)
                 {
                     _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
-                    Size2D.Width = _widthPolicy;
+                    Tizen.NUI.Object.SetProperty(swigCPtr, View.Property.SIZE_WIDTH, new Tizen.NUI.PropertyValue(value));
                 }
                 _layout?.RequestLayout();
             }
@@ -3437,6 +3440,9 @@ namespace Tizen.NUI.BaseComponents
         /// The required policy for this dimension, ChildLayoutData enum or exact value.
         ///</summary>
         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+        /// <remarks>
+        /// Previously named LayoutHeightSpecification
+        /// </remarks>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public int HeightSpecification
         {
@@ -3450,7 +3456,7 @@ namespace Tizen.NUI.BaseComponents
                 if (_heightPolicy >= 0)
                 {
                     _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
-                    Size2D.Height = _heightPolicy;
+                    Tizen.NUI.Object.SetProperty(swigCPtr, View.Property.SIZE_HEIGHT, new Tizen.NUI.PropertyValue(value));
                 }
                _layout?.RequestLayout();
             }
@@ -3531,42 +3537,6 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Child property to specify desired width
-        /// </summary>
-        internal int LayoutWidthSpecificationFixed
-        {
-            get
-            {
-                return _widthPolicy;
-            }
-            set
-            {
-                _widthPolicy = value;
-                _measureSpecificationWidth = new MeasureSpecification(new LayoutLength(value), MeasureSpecification.ModeType.Exactly);
-                Size2D.Width = value;
-                _layout?.RequestLayout();
-            }
-        }
-
-        /// <summary>
-        /// Child property to specify desired height
-        /// </summary>
-        internal int LayoutHeightSpecificationFixed
-        {
-            get
-            {
-                return _heightPolicy;
-            }
-            set
-            {
-                _heightPolicy = value;
-                _measureSpecificationHeight = new MeasureSpecification(new LayoutLength(value), MeasureSpecification.ModeType.Exactly);
-                Size2D.Height = value;
-                _layout?.RequestLayout();
-            }
-        }
-
-        /// <summary>
         /// Child property to specify desired width, use MatchParent/WrapContent)
         /// </summary>
         internal ChildLayoutData LayoutWidthSpecification
@@ -3605,7 +3575,7 @@ namespace Tizen.NUI.BaseComponents
             set
             {
                 _weight = value;
-                _layout.RequestLayout();
+                _layout?.RequestLayout();
             }
         }
 
@@ -4053,7 +4023,7 @@ namespace Tizen.NUI.BaseComponents
         public override void Add(View child)
         {
             bool hasLayout = (_layout != null);
-            Log.Info("NUI", "Add:" + child.Name + " to View:" + Name + "which has layout[" + hasLayout + "] + \n");
+            Log.Info("NUI", "Add:" + child.Name + " to View:" + Name + " which has layout[" + hasLayout + "] + \n");
 
             if (null == child)
             {
index 9e2a92e..57061a8 100755 (executable)
@@ -205,7 +205,7 @@ namespace Tizen.NUI
         /// </summary>
         /// <returns>The default Window.</returns>
         /// <since_tizen> 6 </since_tizen>
-        /// This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static Window GetDefaultWindow()
         {
index fe5a2bb..8ea9159 100755 (executable)
@@ -1481,6 +1481,7 @@ namespace Tizen.NUI
                 //Called by User
                 //Release your own managed resources here.
                 //You should release all of your own disposable objects here.
+
                 _rootLayer.Dispose();
                 localController.Dispose();