From b7bb91cfa993065ac730539415eedc7ce065b0f4 Mon Sep 17 00:00:00 2001 From: agnelovaz Date: Mon, 30 Sep 2019 08:39:37 +0100 Subject: [PATCH] [NUI] Layouting API made public (#1026) * [NUI] Layouting API made public View.cs Layouting API public LayoutItem Measure API made public Moving Layouting files to public folder Change-Id: I78b0a54c07d69496a666740fd6e09ade1dd6bc9b * [NUI] Removing API not needed Change-Id: Id80cd22237a92c601839b8da388923d77e9b9617 --- .../Layouting/Interop/Interop.MeasureSpec.cs | 51 ---- .../Layouting/Interop/Interop.MeasuredSize.cs | 48 ---- .../src/internal/Layouting/LayoutData.cs | 49 ---- .../src/internal/Layouting/LayoutSize.cs | 97 -------- .../src/public/BaseComponents/View.cs | 227 +++++++++--------- .../Layouting/AbsoluteLayout.cs | 26 +- .../Layouting/FlexLayout.cs | 54 ++++- .../Layouting/GridLayout.cs | 35 ++- .../Layouting/ILayoutParent.cs | 4 +- .../Layouting/LayoutGroup.cs | 65 +++-- .../Layouting/LayoutItem.cs | 102 +++----- .../Layouting/LayoutLength.cs | 21 +- .../Layouting/LayoutTransition.cs | 115 +++++---- .../Layouting/LinearLayout.cs | 61 +++-- .../Layouting/MeasureSpecification.cs | 11 +- .../Layouting/MeasuredSize.cs | 8 +- src/Tizen.NUI/src/public/Window.cs | 3 + .../custom-layout-root-layer-test.cs | 2 +- .../layouting/custom-layout-test-2.cs | 4 +- .../examples/layouting/custom-layout-test.cs | 4 +- ...stom-layout-without-absoluteLayout-test.cs | 2 +- .../root-problem-fix-adding-several-layers.cs | 2 +- 22 files changed, 444 insertions(+), 547 deletions(-) delete mode 100755 src/Tizen.NUI/src/internal/Layouting/Interop/Interop.MeasureSpec.cs delete mode 100755 src/Tizen.NUI/src/internal/Layouting/Interop/Interop.MeasuredSize.cs delete mode 100755 src/Tizen.NUI/src/internal/Layouting/LayoutSize.cs rename src/Tizen.NUI/src/{internal => public}/Layouting/AbsoluteLayout.cs (80%) rename src/Tizen.NUI/src/{internal => public}/Layouting/FlexLayout.cs (87%) rename src/Tizen.NUI/src/{internal => public}/Layouting/GridLayout.cs (86%) rename src/Tizen.NUI/src/{internal => public}/Layouting/ILayoutParent.cs (91%) rename src/Tizen.NUI/src/{internal => public}/Layouting/LayoutGroup.cs (93%) rename src/Tizen.NUI/src/{internal => public}/Layouting/LayoutItem.cs (90%) rename src/Tizen.NUI/src/{internal => public}/Layouting/LayoutLength.cs (90%) rename src/Tizen.NUI/src/{internal => public}/Layouting/LayoutTransition.cs (71%) rename src/Tizen.NUI/src/{internal => public}/Layouting/LinearLayout.cs (93%) rename src/Tizen.NUI/src/{internal => public}/Layouting/MeasureSpecification.cs (86%) rename src/Tizen.NUI/src/{internal => public}/Layouting/MeasuredSize.cs (87%) diff --git a/src/Tizen.NUI/src/internal/Layouting/Interop/Interop.MeasureSpec.cs b/src/Tizen.NUI/src/internal/Layouting/Interop/Interop.MeasureSpec.cs deleted file mode 100755 index 7c3f6164b..000000000 --- a/src/Tizen.NUI/src/internal/Layouting/Interop/Interop.MeasureSpec.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Tizen.NUI -{ - internal static partial class Interop - { - internal static partial class MeasureSpec - { - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_MeasureSpec__SWIG_0")] - public static extern global::System.IntPtr new_MeasureSpec__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_MeasureSpec__SWIG_1")] - public static extern global::System.IntPtr new_MeasureSpec__SWIG_1(int jarg1); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_MeasureSpec")] - public static extern void delete_MeasureSpec(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasureSpec_Assign")] - public static extern global::System.IntPtr MeasureSpec_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasureSpec_EqualTo")] - public static extern bool MeasureSpec_EqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasureSpec_NotEqualTo")] - public static extern bool MeasureSpec_NotEqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasureSpec_GetMode")] - public static extern int MeasureSpec_GetMode(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasureSpec_GetSize")] - public static extern int MeasureSpec_GetSize(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasureSpec_Adjust")] - public static extern global::System.IntPtr MeasureSpec_Adjust(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasureSpec_mSize_set")] - public static extern void MeasureSpec_mSize_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasureSpec_mSize_get")] - public static extern int MeasureSpec_mSize_get(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasureSpec_mMode_set")] - public static extern void MeasureSpec_mMode_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasureSpec_mMode_get")] - public static extern int MeasureSpec_mMode_get(global::System.Runtime.InteropServices.HandleRef jarg1); - } - } -} \ No newline at end of file diff --git a/src/Tizen.NUI/src/internal/Layouting/Interop/Interop.MeasuredSize.cs b/src/Tizen.NUI/src/internal/Layouting/Interop/Interop.MeasuredSize.cs deleted file mode 100755 index 16ae7ef94..000000000 --- a/src/Tizen.NUI/src/internal/Layouting/Interop/Interop.MeasuredSize.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Tizen.NUI -{ - internal static partial class Interop - { - internal static partial class MeasuredSize - { - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_MeasuredSize__SWIG_0")] - public static extern global::System.IntPtr new_MeasuredSize__SWIG_0(); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_MeasuredSize__SWIG_1")] - public static extern global::System.IntPtr new_MeasuredSize__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_MeasuredSize__SWIG_2")] - public static extern global::System.IntPtr new_MeasuredSize__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_MeasuredSize")] - public static extern void delete_MeasuredSize(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasuredSize_Assign__SWIG_0")] - public static extern global::System.IntPtr MeasuredSize_Assign__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasuredSize_Assign__SWIG_1")] - public static extern global::System.IntPtr MeasuredSize_Assign__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasuredSize_EqualTo")] - public static extern bool MeasuredSize_EqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasuredSize_NotEqualTo")] - public static extern bool MeasuredSize_NotEqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasuredSize_SetState")] - public static extern void MeasuredSize_SetState(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasuredSize_GetState")] - public static extern int MeasuredSize_GetState(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasuredSize_SetSize")] - public static extern void MeasuredSize_SetSize(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); - - [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_MeasuredSize_GetSize")] - public static extern global::System.IntPtr MeasuredSize_GetSize(global::System.Runtime.InteropServices.HandleRef jarg1); - } - } -} \ No newline at end of file diff --git a/src/Tizen.NUI/src/internal/Layouting/LayoutData.cs b/src/Tizen.NUI/src/internal/Layouting/LayoutData.cs index 0ae504703..1f89f74f9 100755 --- a/src/Tizen.NUI/src/internal/Layouting/LayoutData.cs +++ b/src/Tizen.NUI/src/internal/Layouting/LayoutData.cs @@ -15,57 +15,8 @@ * */ -using System.Collections.Generic; -using System; -using System.ComponentModel; - namespace Tizen.NUI { - /// - /// The conditions for transitions. - /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] - [FlagsAttribute] public enum TransitionCondition - { - /// - /// Default when a condition has not been set. - /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] - Unspecified = 0, - /// - /// Animate changing layout to another layout. - /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] - LayoutChanged = 1, - /// - /// Animate adding item. - /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] - Add = 2, - /// - /// Animate removing item. - /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] - Remove = 4, - /// - /// Animation when an item changes due to a sibbling being added. - /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] - ChangeOnAdd = 8, - /// - /// Animation when an item changes due to a sibbling being removed. - /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] - ChangeOnRemove = 16 - } - /// /// [Draft] Class to hold layout animation and position data /// diff --git a/src/Tizen.NUI/src/internal/Layouting/LayoutSize.cs b/src/Tizen.NUI/src/internal/Layouting/LayoutSize.cs deleted file mode 100755 index 4e1f7b543..000000000 --- a/src/Tizen.NUI/src/internal/Layouting/LayoutSize.cs +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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.ComponentModel; -using Tizen.NUI.BaseComponents; - -namespace Tizen.NUI -{ - /// - /// [Draft] This class represents a layout size (width and height), non mutable. - /// - internal struct LayoutSize - { - /// - /// [Draft] Constructor from width and height - /// - /// Int to initialize with. - /// Int to initialize with. - public LayoutSize(int width, int height) - { - Width = width; - Height = height; - } - - /// - /// Computes a hash code for this LayoutSize for use in hash based collections. - /// - /// A non unique hash code . - public override int GetHashCode() - { - return Width ^ Height; - } - - /// - /// Whether the values of two LayoutSize objects are equals - /// - /// Object to be compared against. - /// true if obj is equal to this LayoutSize. - public override bool Equals(object obj) - { - if (obj is LayoutSize) - { - LayoutSize layoutSize = (LayoutSize)obj; - return ((layoutSize.Width == Width) && (layoutSize.Height == Height)); - } - return false; - } - - /// - /// Compares whether the two LayoutSize instances are equal. - /// - /// A LayoutSize instance. - /// A LayoutSize instance. - /// true if the two LayoutSize instances have equal values. - public static bool operator ==(LayoutSize lhs, LayoutSize rhs) - { - return ((lhs.Width == rhs.Width) && (lhs.Height == rhs.Height)); - } - - - /// - /// Compares whether the two LayoutSize instances are same or not. - /// - /// A LayoutSize instance. - /// A LayoutSize instance. - /// true if the two LayoutSize instances have do not have equal values. - public static bool operator !=(LayoutSize lhs, LayoutSize rhs) - { - return ((lhs.Width != rhs.Width) || (lhs.Height != rhs.Height)); - } - - /// - /// [Draft] Get the width value of this layout - /// - public int Width{ get; private set; } - - /// - /// [Draft] Get the height value of this layout - /// - public int Height{ get; private set; } - - } -} diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index 3d3f64e17..c8b64dc57 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -1260,6 +1260,7 @@ namespace Tizen.NUI.BaseComponents return temp; }); + /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty UpdateSizeHintProperty = BindableProperty.Create("UpdateSizeHint", typeof(Vector2), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) => @@ -1279,6 +1280,7 @@ namespace Tizen.NUI.BaseComponents return temp; }); + /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty XamlStyleProperty = BindableProperty.Create("XamlStyle", typeof(Style), typeof(View), default(Style), propertyChanged: (bindable, oldvalue, newvalue) => ((View)bindable)._mergedStyle.Style = (Style)newvalue); @@ -2439,7 +2441,7 @@ namespace Tizen.NUI.BaseComponents "Like: " + "View view = new View(); " + "view.PivotPoint = PivotPoint.Center; " + - "view.PositionUsesPivotPoint = true;" + + "view.PositionUsesPivotPoint = true;" + " Deprecated in API5: Will be removed in API8")] [EditorBrowsable(EditorBrowsableState.Never)] public bool PositionUsesAnchorPoint @@ -3337,7 +3339,7 @@ namespace Tizen.NUI.BaseComponents } /// - /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! + /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! /// /// 3 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " + @@ -3455,11 +3457,7 @@ namespace Tizen.NUI.BaseComponents /// /// The required policy for this dimension, LayoutParamPolicies enum or exact value. /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - /// - /// Previously named LayoutWidthSpecification - /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 public int WidthSpecification { get @@ -3482,10 +3480,7 @@ namespace Tizen.NUI.BaseComponents /// /// The required policy for this dimension, LayoutParamPolicies enum or exact value. /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. - /// - /// Previously named LayoutHeightSpecification - /// + /// 6 [EditorBrowsable(EditorBrowsableState.Never)] public int HeightSpecification { @@ -3509,8 +3504,7 @@ namespace Tizen.NUI.BaseComponents /// /// Gets the List of transitions for this View. /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 public Dictionary LayoutTransitions { get @@ -3523,7 +3517,14 @@ namespace Tizen.NUI.BaseComponents } } - internal LayoutTransition LayoutTransition + /// + /// Set a layout transitions for this View. + /// + /// + /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View. + /// + /// 6 + public LayoutTransition LayoutTransition { set { @@ -3591,24 +3592,98 @@ namespace Tizen.NUI.BaseComponents } } + /// - /// The color mode of View. - /// This specifies whether the View uses its own color, or inherits its parent color. - /// The default is ColorMode.UseOwnMultiplyParentColor. + /// Set the layout on this View. Replaces any existing Layout. /// - internal ColorMode ColorMode + /// 6 + public LayoutItem Layout { - set + get { - SetColorMode(value); + return _layout; } - get + set { - return GetColorMode(); + // Do nothing if layout provided is already set on this View. + if (value == _layout) + { + return; + } + + Log.Info("NUI", "Setting Layout on:" + Name + "\n"); + layoutingDisabled = false; + layoutSet = true; + + // If new layout being set already has a owner then that owner receives a replacement default layout. + // First check if the layout to be set already has a owner. + if (value?.Owner != null) + { + // Previous owner of the layout gets a default layout as a replacement. + value.Owner.Layout = new LayoutGroup(); + + // Copy Margin and Padding to replacement LayoutGroup. + value.Owner.Layout.Margin = value.Margin; + value.Owner.Layout.Padding = value.Padding; + } + + // Copy Margin and Padding to new layout being set or restore padding and margin back to + // View if no replacement. Previously margin and padding values would have been moved from + // the View to the layout. + if (_layout != null ) // Existing layout + { + if (value != null) + { + // Existing layout being replaced so copy over margin and padding values. + value.Margin = _layout.Margin; + value.Padding = _layout.Padding; + } + else + { + // Layout not being replaced so restore margin and padding to View. + SetValue(MarginProperty, _layout.Margin); + SetValue(PaddingProperty, _layout.Padding); + NotifyPropertyChanged(); + } + } + else + { + // First Layout to be added to the View hence copy + + // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View) + if (value !=null) + { + if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0) + { + // If View already has a margin set then store it in Layout instead. + value.Margin = Margin; + SetValue(MarginProperty, new Extents(0,0,0,0)); + NotifyPropertyChanged(); + } + + if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0) + { + // If View already has a padding set then store it in Layout instead. + value.Padding = Padding; + SetValue(PaddingProperty, new Extents(0,0,0,0)); + NotifyPropertyChanged(); + } + } + } + + // Remove existing layout from it's parent layout group. + _layout?.Unparent(); + + // Set layout to this view + SetLayout(value); } } - internal float Weight + /// + /// The weight of the View, used to share available space in a layout with siblings. + /// + /// 6 + public float Weight { get { @@ -3621,6 +3696,24 @@ namespace Tizen.NUI.BaseComponents } } + + /// + /// The color mode of View. + /// This specifies whether the View uses its own color, or inherits its parent color. + /// The default is ColorMode.UseOwnMultiplyParentColor. + /// + internal ColorMode ColorMode + { + set + { + SetColorMode(value); + } + get + { + return GetColorMode(); + } + } + /// /// Whether to load the BackgroundImage synchronously. /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously. @@ -3697,92 +3790,6 @@ namespace Tizen.NUI.BaseComponents } } - /// - /// Set the layout on this View. Replaces any existing Layout. - /// - internal LayoutItem Layout - { - get - { - return _layout; - } - set - { - // Do nothing if layout provided is already set on this View. - if (value == _layout) - { - return; - } - - Log.Info("NUI", "Setting Layout on:" + Name + "\n"); - layoutingDisabled = false; - layoutSet = true; - - // If new layout being set already has a owner then that owner receives a replacement default layout. - // First check if the layout to be set already has a owner. - if (value?.Owner != null) - { - Log.Info("NUI", "Set layout already in use by another View: " + value.Owner.Name + "will get a LayoutGroup\n"); - // Previous owner of the layout gets a default layout as a replacement. - value.Owner.Layout = new LayoutGroup(); - - // Copy Margin and Padding to replacement LayoutGroup. - value.Owner.Layout.Margin = value.Margin; - value.Owner.Layout.Padding = value.Padding; - } - - // Copy Margin and Padding to new layout being set or restore padding and margin back to - // View if no replacement. Previously margin and padding values would have been moved from - // the View to the layout. - if (_layout != null ) // Existing layout - { - if (value != null) - { - // Existing layout being replaced so copy over margin and padding values. - value.Margin = _layout.Margin; - value.Padding = _layout.Padding; - } - else - { - // Layout not being replaced so restore margin and padding to View. - SetValue(MarginProperty, _layout.Margin); - SetValue(PaddingProperty, _layout.Padding); - NotifyPropertyChanged(); - } - } - else - { - // First Layout to be added to the View hence copy - - // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View) - if (value !=null) - { - if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0) - { - // If View already has a margin set then store it in Layout instead. - value.Margin = Margin; - SetValue(MarginProperty, new Extents(0,0,0,0)); - NotifyPropertyChanged(); - } - - if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0) - { - // If View already has a padding set then store it in Layout instead. - value.Padding = Padding; - SetValue(PaddingProperty, new Extents(0,0,0,0)); - NotifyPropertyChanged(); - } - } - } - - // Remove existing layout from it's parent layout group. - _layout?.Unparent(); - - // Set layout to this view - SetLayout(value); - } - } - internal void SetLayout(LayoutItem layout) { _layout = layout; @@ -5710,7 +5717,7 @@ namespace Tizen.NUI.BaseComponents View view = GetParent()?.FindCurrentChildById(id); //If we can't find the parent's children, find in the top layer. - if (!view) + if (!view) { Container parent = GetParent(); while ((parent is View) && (parent != null)) diff --git a/src/Tizen.NUI/src/internal/Layouting/AbsoluteLayout.cs b/src/Tizen.NUI/src/public/Layouting/AbsoluteLayout.cs similarity index 80% rename from src/Tizen.NUI/src/internal/Layouting/AbsoluteLayout.cs rename to src/Tizen.NUI/src/public/Layouting/AbsoluteLayout.cs index 3741b3d2e..05a5dfd61 100755 --- a/src/Tizen.NUI/src/internal/Layouting/AbsoluteLayout.cs +++ b/src/Tizen.NUI/src/public/Layouting/AbsoluteLayout.cs @@ -22,7 +22,7 @@ namespace Tizen.NUI /// [Draft] This class implements a absolute layout, allowing explicit positioning of children. /// Positions are from the top left of the layout and can be set using the Actor::Property::POSITION and alike. /// - internal class AbsoluteLayout : LayoutGroup + public class AbsoluteLayout : LayoutGroup { /// /// Struct to store Measured states of height and width. @@ -42,10 +42,17 @@ namespace Tizen.NUI /// /// [Draft] Constructor /// + /// 6 public AbsoluteLayout() { } + /// + /// Measure the layout and its content to determine the measured width and the measured height.
+ ///
+ /// horizontal space requirements as imposed by the parent. + /// vertical space requirements as imposed by the parent. + /// 6 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) { float totalHeight = 0.0f; @@ -60,7 +67,7 @@ namespace Tizen.NUI float maxPositionY = 0.0f; // measure children - foreach( LayoutItem childLayout in _children ) + foreach( LayoutItem childLayout in LayoutChildren ) { if (childLayout != null) { @@ -85,11 +92,11 @@ namespace Tizen.NUI totalWidth = maxPositionX - minPositionX; totalHeight = maxPositionY - minPositionY; - if (childLayout.MeasuredWidthAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall) + if (childLayout.MeasuredWidth.State == MeasuredSize.StateType.MeasuredSizeTooSmall) { childState.widthState = MeasuredSize.StateType.MeasuredSizeTooSmall; } - if (childLayout.MeasuredWidthAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall) + if (childLayout.MeasuredWidth.State == MeasuredSize.StateType.MeasuredSizeTooSmall) { childState.heightState = MeasuredSize.StateType.MeasuredSizeTooSmall; } @@ -113,11 +120,20 @@ namespace Tizen.NUI ResolveSizeAndState( new LayoutLength(totalHeight), heightMeasureSpec, childState.heightState ) ); } + /// + /// Assign a size and position to each of its children.
+ ///
+ /// This is a new size or position for this layout. + /// Left position, relative to parent. + /// Top position, relative to parent. + /// Right position, relative to parent. + /// Bottom position, relative to parent. + /// 6 protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) { // Absolute layout positions it's children at their Actor positions. // Children could overlap or spill outside the parent, as is the nature of absolute positions. - foreach( LayoutItem childLayout in _children ) + foreach( LayoutItem childLayout in LayoutChildren ) { if( childLayout != null ) { diff --git a/src/Tizen.NUI/src/internal/Layouting/FlexLayout.cs b/src/Tizen.NUI/src/public/Layouting/FlexLayout.cs similarity index 87% rename from src/Tizen.NUI/src/internal/Layouting/FlexLayout.cs rename to src/Tizen.NUI/src/public/Layouting/FlexLayout.cs index c2c36898e..3e5ed6753 100644 --- a/src/Tizen.NUI/src/internal/Layouting/FlexLayout.cs +++ b/src/Tizen.NUI/src/public/Layouting/FlexLayout.cs @@ -27,7 +27,7 @@ namespace Tizen.NUI /// 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. ///
- internal class FlexLayout : LayoutGroup, global::System.IDisposable + public class FlexLayout : LayoutGroup, global::System.IDisposable { float Flex{ get; set;} int AlignSelf{get; set;} @@ -39,7 +39,7 @@ namespace Tizen.NUI private IntPtr _rootFlex; // Pointer to the unmanged flex layout class. - public struct MeasuredSize + internal struct MeasuredSize { public MeasuredSize(float x, float y) { @@ -68,6 +68,10 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + /// + /// Dispose. + /// + /// 6 public void Dispose() { // Throw exception if Dispose() is called in separate thread. @@ -87,6 +91,10 @@ namespace Tizen.NUI } } + /// + /// Dispose. + /// + /// 6 protected virtual void Dispose(DisposeTypes type) { if (disposed) @@ -120,6 +128,7 @@ namespace Tizen.NUI /// /// [Draft] Creates a FlexLayout object. /// + /// 6 public FlexLayout() : this(Interop.FlexLayout.FlexLayout_New(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -211,6 +220,7 @@ namespace Tizen.NUI /// [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. /// + /// 6 public FlexDirection Direction { get @@ -226,6 +236,7 @@ namespace Tizen.NUI /// /// [Draft] Get/Set the justification in the layout. /// + /// 6 public FlexJustification Justification { get @@ -241,6 +252,7 @@ namespace Tizen.NUI /// /// [Draft] Get/Set the wrap in the layout. /// + /// 6 public FlexWrapType WrapType { get @@ -256,6 +268,7 @@ namespace Tizen.NUI /// /// [Draft] Get/Set the alignment of the layout content. /// + /// 6 public AlignmentType Alignment { get @@ -271,6 +284,7 @@ namespace Tizen.NUI /// /// [Draft] Get/Set the alignment of the layout items. /// + /// 6 public AlignmentType ItemsAlignment { get @@ -287,6 +301,7 @@ namespace Tizen.NUI /// [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. /// + /// 6 public enum FlexDirection { /// @@ -310,6 +325,7 @@ namespace Tizen.NUI /// /// [Draft] Enumeration for the alignment of the flex items when the items do not use all available space on the main-axis. /// + /// 6 public enum FlexJustification { /// @@ -337,6 +353,7 @@ namespace Tizen.NUI /// /// [Draft] Enumeration for the wrap type of the flex container when there is no enough room for all the items on one flex line. /// + /// 6 public enum FlexWrapType { /// @@ -352,6 +369,7 @@ namespace Tizen.NUI /// /// [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. /// + /// 6 public enum AlignmentType { /// @@ -390,14 +408,25 @@ namespace Tizen.NUI void InsertChild( LayoutItem child ) { // Store created node for child - Interop.FlexLayout.FlexLayout_AddChild(swigCPtr, View.getCPtr(child.Owner), measureChildDelegate, _children.Count-1); + Interop.FlexLayout.FlexLayout_AddChild(swigCPtr, View.getCPtr(child.Owner), measureChildDelegate, LayoutChildren.Count-1); } + /// + /// Callback when child is added to container.
+ /// Derived classes can use this to set their own child properties on the child layout's owner.
+ ///
+ /// The Layout child. + /// 6 protected override void OnChildAdd(LayoutItem child) { InsertChild(child); } + /// + /// Callback when child is removed from container.
+ ///
+ /// The Layout child. + /// 6 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. @@ -405,6 +434,12 @@ namespace Tizen.NUI Interop.FlexLayout.FlexLayout_RemoveChild(swigCPtr, child); } + /// + /// Measure the layout and its content to determine the measured width and the measured height.
+ ///
+ /// horizontal space requirements as imposed by the parent. + /// vertical space requirements as imposed by the parent. + /// 6 protected override void OnMeasure( MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec ) { bool isLayoutRtl = Owner.LayoutDirection == ViewLayoutDirectionType.RTL; @@ -433,6 +468,15 @@ namespace Tizen.NUI GetDefaultSize( new LayoutLength( (float)Interop.FlexLayout.FlexLayout_GetHeight(swigCPtr) ), heightMeasureSpec ) ); } + /// + /// Assign a size and position to each of its children.
+ ///
+ /// This is a new size or position for this layout. + /// Left position, relative to parent. + /// Top position, relative to parent. + /// Right position, relative to parent. + /// Bottom position, relative to parent. + /// 6 protected override void OnLayout( bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom ) { @@ -443,10 +487,10 @@ namespace Tizen.NUI // 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; + int count = LayoutChildren.Count; for( int childIndex = 0; childIndex < count; childIndex++) { - LayoutItem childLayout = _children[childIndex]; + LayoutItem childLayout = LayoutChildren[childIndex]; if( childLayout != null ) { // Get the frame for the child, start, top, end, bottom. diff --git a/src/Tizen.NUI/src/internal/Layouting/GridLayout.cs b/src/Tizen.NUI/src/public/Layouting/GridLayout.cs similarity index 86% rename from src/Tizen.NUI/src/internal/Layouting/GridLayout.cs rename to src/Tizen.NUI/src/public/Layouting/GridLayout.cs index 887cb1528..8d0cd5166 100755 --- a/src/Tizen.NUI/src/internal/Layouting/GridLayout.cs +++ b/src/Tizen.NUI/src/public/Layouting/GridLayout.cs @@ -24,7 +24,7 @@ namespace Tizen.NUI /// /// [Draft] This class implements a grid layout /// - internal class GridLayout : LayoutGroup + public class GridLayout : LayoutGroup { const int AUTO_FIT = -1; private int _columns = 1; @@ -39,14 +39,16 @@ namespace Tizen.NUI /// [draft] GridLayout Constructor/> ///
/// New Grid object. + /// 6 public GridLayout() { _locations = new GridLocations(); } - // - // [Draft] Get/Set the number of columns in the grid - // + /// + /// [Draft] Get/Set the number of columns in the grid + /// + /// 6 public int Columns { get @@ -96,6 +98,12 @@ namespace Tizen.NUI } } + /// + /// Measure the layout and its content to determine the measured width and the measured height.
+ ///
+ /// horizontal space requirements as imposed by the parent. + /// vertical space requirements as imposed by the parent. + /// 6 protected override void OnMeasure( MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec ) { var gridWidthMode = widthMeasureSpec.Mode; @@ -111,7 +119,7 @@ namespace Tizen.NUI Extents gridLayoutPadding = Padding; - var childCount = _children.Count; + var childCount = LayoutChildren.Count; // WIDTH SPECIFICATIONS @@ -119,7 +127,7 @@ namespace Tizen.NUI if (childCount > 0) { - LayoutItem childLayoutItem = _children[0]; + LayoutItem childLayoutItem = LayoutChildren[0]; View childOwner = childLayoutItem.Owner; MeasureChild( childLayoutItem, widthMeasureSpec, heightMeasureSpec ); @@ -199,6 +207,15 @@ namespace Tizen.NUI ResolveSizeAndState( new LayoutLength(heightSize), heightMeasureSpec, MeasuredSize.StateType.MeasuredSizeOK ) ); } + /// + /// Assign a size and position to each of its children.
+ ///
+ /// This is a new size or position for this layout. + /// Left position, relative to parent. + /// Top position, relative to parent. + /// Right position, relative to parent. + /// Bottom position, relative to parent. + /// 6 protected override void OnLayout( bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom ) { List locations = _locations.GetLocations(); @@ -207,13 +224,13 @@ namespace Tizen.NUI Extents childMargins = new Extents(); // Margin for all children dependant on if set on first child - if( _children.Count > 0 ) + if( LayoutChildren.Count > 0 ) { - childMargins = _children[0]?.Margin; + childMargins = LayoutChildren[0]?.Margin; } int index = 0; - foreach( LayoutItem childLayout in _children ) + foreach( LayoutItem childLayout in LayoutChildren ) { // for each child if( childLayout != null ) diff --git a/src/Tizen.NUI/src/internal/Layouting/ILayoutParent.cs b/src/Tizen.NUI/src/public/Layouting/ILayoutParent.cs similarity index 91% rename from src/Tizen.NUI/src/internal/Layouting/ILayoutParent.cs rename to src/Tizen.NUI/src/public/Layouting/ILayoutParent.cs index 82fc63078..34108235c 100755 --- a/src/Tizen.NUI/src/internal/Layouting/ILayoutParent.cs +++ b/src/Tizen.NUI/src/public/Layouting/ILayoutParent.cs @@ -21,18 +21,20 @@ namespace Tizen.NUI /// [Draft] /// Interface that defines a layout Parent. Enables a layout child to access methods on its parent, e.g. Remove (during unparenting) ///
- internal interface ILayoutParent + public interface ILayoutParent { /// /// Add this child to the parent. /// /// The layout child to add. + /// 6 void Add(LayoutItem layoutItem); /// /// Remove this child from the parent /// /// The layout child to add. + /// 6 void Remove(LayoutItem layoutItem); } } diff --git a/src/Tizen.NUI/src/internal/Layouting/LayoutGroup.cs b/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs similarity index 93% rename from src/Tizen.NUI/src/internal/Layouting/LayoutGroup.cs rename to src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs index 16f62101b..c66176851 100755 --- a/src/Tizen.NUI/src/internal/Layouting/LayoutGroup.cs +++ b/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs @@ -26,33 +26,31 @@ namespace Tizen.NUI /// /// [Draft] LayoutGroup class providing container functionality. /// - internal class LayoutGroup : LayoutItem, ILayoutParent + public class LayoutGroup : LayoutItem, ILayoutParent { - protected List _children{ get;} // Children of this LayoutGroup + /// + /// [Draft] List of child layouts in this container. + /// + /// 6 + protected List LayoutChildren{ get;} // Children of this LayoutGroup /// /// [Draft] Constructor /// + /// 6 public LayoutGroup() { - _children = new List(); + LayoutChildren = new List(); } /// - /// [Draft] Constructor setting the owner of this LayoutGroup. - /// - /// Owning View of this layout, currently a View but may be extending for Windows/Layers. - public LayoutGroup(View owner) : base(owner) - { - _children = new List(); - } - - /// /// From ILayoutParent.
///
+ /// 6 + /// LayoutItem to add to the layout group. public virtual void Add(LayoutItem childLayout) { - _children.Add(childLayout); + LayoutChildren.Add(childLayout); childLayout.SetParent(this); // Child added to use a Add transition. childLayout.ConditionForAnimation = ConditionForAnimation | TransitionCondition.Add; @@ -65,14 +63,15 @@ namespace Tizen.NUI /// /// Remove all layout children.
///
+ /// 6 public void RemoveAll() { - foreach( LayoutItem childLayout in _children ) + foreach( LayoutItem childLayout in LayoutChildren ) { childLayout.ConditionForAnimation = ConditionForAnimation | TransitionCondition.Remove; childLayout.Owner = null; } - _children.Clear(); + LayoutChildren.Clear(); // todo ensure child LayoutItems are still not parented to this group. RequestLayout(); } @@ -80,15 +79,17 @@ namespace Tizen.NUI /// /// From ILayoutParent /// + /// LayoutItem to remove from the layout group. + /// 6 public virtual void Remove(LayoutItem layoutItem) { bool childRemoved = false; - foreach( LayoutItem childLayout in _children.ToList() ) + foreach( LayoutItem childLayout in LayoutChildren.ToList() ) { if( childLayout == layoutItem ) { Window.Instance.LayoutController.AddToRemovalStack(childLayout); - _children.Remove(childLayout); + LayoutChildren.Remove(childLayout); childLayout.ConditionForAnimation = childLayout.ConditionForAnimation | TransitionCondition.Remove; // Add LayoutItem to the transition stack so can animate it out. Window.Instance.LayoutController.AddTransitionDataEntry(new LayoutData(layoutItem, ConditionForAnimation, 0,0,0,0)); @@ -161,7 +162,7 @@ namespace Tizen.NUI ///
private void SetConditionsForAnimationOnLayoutGroup( TransitionCondition conditionToSet) { - foreach( LayoutItem childLayout in _children ) + foreach( LayoutItem childLayout in LayoutChildren ) { switch( conditionToSet ) { @@ -324,13 +325,14 @@ namespace Tizen.NUI ///
/// horizontal space requirements as imposed by the parent. /// vertical space requirements as imposed by the parent. + /// 6 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) { LayoutLength measuredWidth = new LayoutLength(0.0f); LayoutLength measuredHeight = new LayoutLength(0.0f); // Layout takes size of largest child width and largest child height dimensions - foreach( LayoutItem childLayout in _children ) + foreach( LayoutItem childLayout in LayoutChildren ) { if( childLayout != null ) { @@ -344,7 +346,7 @@ namespace Tizen.NUI } } - if( 0 == _children.Count ) + if( 0 == LayoutChildren.Count ) { // Must be a leaf as has no children measuredWidth = GetDefaultSize( SuggestedMinimumWidth, widthMeasureSpec ); @@ -364,9 +366,10 @@ namespace Tizen.NUI /// Top position, relative to parent. /// Right position, relative to parent. /// Bottom position, relative to parent. + /// 6 protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) { - foreach( LayoutItem childLayout in _children ) + foreach( LayoutItem childLayout in LayoutChildren ) { if( childLayout !=null ) { @@ -390,19 +393,10 @@ namespace Tizen.NUI } } - /// - /// Overridden method called when the layout size changes.
- ///
- /// The new size of the layout. - /// The old size of the layout. - protected override void OnSizeChanged(LayoutSize newSize, LayoutSize oldSize) - { - // Do nothing - } - /// /// Overridden method called when the layout is attached to an owner.
///
+ /// 6 protected override void OnAttachedToOwner() { // Layout takes ownership of it's owner's children. @@ -424,6 +418,7 @@ namespace Tizen.NUI /// Derived classes can use this to set their own child properties on the child layout's owner.
/// /// The Layout child. + /// 6 protected virtual void OnChildAdd(LayoutItem child) { } @@ -432,6 +427,7 @@ namespace Tizen.NUI /// Callback when child is removed from container.
/// /// The Layout child. + /// 6 protected virtual void OnChildRemove(LayoutItem child) { } @@ -443,9 +439,10 @@ namespace Tizen.NUI /// /// The width requirements for this view. /// The height requirements for this view. + /// 6 protected virtual void MeasureChildren(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) { - foreach( LayoutItem childLayout in _children ) + foreach( LayoutItem childLayout in LayoutChildren ) { MeasureChild( childLayout, widthMeasureSpec, heightMeasureSpec ); } @@ -454,11 +451,12 @@ namespace Tizen.NUI /// /// Ask one of the children of this view to measure itself, taking into /// account both the MeasureSpec requirements for this view and its padding.
- /// The heavy lifting is done in GetChildMeasureSpec.
+ /// The heavy lifting is done in GetChildMeasureSpecification.
///
/// The child to measure. /// The width requirements for this view. /// The height requirements for this view. + /// 6 protected virtual void MeasureChild(LayoutItem child, MeasureSpecification parentWidthMeasureSpec, MeasureSpecification parentHeightMeasureSpec) { View childOwner = child.Owner; @@ -487,6 +485,7 @@ namespace Tizen.NUI /// Extra space that has been used up by the parent horizontally (possibly by other children of the parent). /// The height requirements for this view. /// Extra space that has been used up by the parent vertically (possibly by other children of the parent). + /// 6 protected virtual void MeasureChildWithMargins(LayoutItem child, MeasureSpecification parentWidthMeasureSpec, LayoutLength widthUsed, MeasureSpecification parentHeightMeasureSpec, LayoutLength heightUsed) { View childOwner = child.Owner; diff --git a/src/Tizen.NUI/src/internal/Layouting/LayoutItem.cs b/src/Tizen.NUI/src/public/Layouting/LayoutItem.cs similarity index 90% rename from src/Tizen.NUI/src/internal/Layouting/LayoutItem.cs rename to src/Tizen.NUI/src/public/Layouting/LayoutItem.cs index c45dc445d..a4518fb7a 100755 --- a/src/Tizen.NUI/src/internal/Layouting/LayoutItem.cs +++ b/src/Tizen.NUI/src/public/Layouting/LayoutItem.cs @@ -36,7 +36,7 @@ namespace Tizen.NUI /// [Draft] Base class for layouts. It is used to layout a View /// It can be laid out by a LayoutGroup. /// - internal class LayoutItem + public class LayoutItem { static bool LayoutDebugFrameData = false; // Debug flag private MeasureSpecification OldWidthMeasureSpec; // Store measure specification to compare against later @@ -51,21 +51,21 @@ namespace Tizen.NUI private Extents _padding; private Extents _margin; - public TransitionCondition ConditionForAnimation{get; set;} - /// - /// [Draft] The View that this Layout has been assigned to. + /// [Draft] Condition event that is causing this Layout to transition. /// - public View Owner{get; set;} // Should not keep a View alive. + internal TransitionCondition ConditionForAnimation{get; set;} /// - /// [Draft] Is this Layout set to animate its content. + /// [Draft] The View that this Layout has been assigned to. /// - public bool Animate{get; set;} + /// 6 + public View Owner{get; set;} // Should not keep a View alive. /// /// [Draft] Margin for this LayoutItem /// + /// 6 public Extents Margin { get @@ -82,6 +82,7 @@ namespace Tizen.NUI /// /// [Draft] Padding for this LayoutItem /// + /// 6 public Extents Padding { get @@ -98,26 +99,17 @@ namespace Tizen.NUI /// /// [Draft] Constructor /// + /// 6 public LayoutItem() { Initialize(); } - /// - /// [Draft] Constructor setting the owner of this LayoutItem. - /// - /// Owning View of this layout, currently a View but may be extending for Windows/Layers. - public LayoutItem(View owner) - { - Owner = owner; - Initialize(); - } - /// /// [Draft] Set parent to this layout. /// /// Parent to set on this Layout. - public void SetParent( ILayoutParent parent) + internal void SetParent( ILayoutParent parent) { Parent = parent as LayoutGroup; } @@ -125,7 +117,7 @@ namespace Tizen.NUI /// /// Unparent this layout from it's owner, and remove any layout children in derived types.
///
- public void Unparent() + internal void Unparent() { // Enable directly derived types to first remove children OnUnparent(); @@ -147,14 +139,6 @@ namespace Tizen.NUI _margin = new Extents(0,0,0,0); } - /// - /// Get the View owning this LayoutItem - /// - internal View GetOwner() - { - return Owner; - } - /// /// Initialize the layout and allow derived classes to also perform any operations /// @@ -183,7 +167,8 @@ namespace Tizen.NUI /// /// Horizontal space requirements as imposed by the parent. /// Vertical space requirements as imposed by the parent. - internal void Measure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) + /// 6 + public void Measure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) { // Check if relayouting is required. bool specChanged = (widthMeasureSpec.Size != OldWidthMeasureSpec.Size) || @@ -220,6 +205,7 @@ namespace Tizen.NUI /// Top position, relative to parent. /// Right position, relative to parent. /// Bottom position, relative to parent. + /// 6 public void Layout(LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) { bool changed = SetFrame(left.AsRoundedValue(), @@ -244,6 +230,7 @@ namespace Tizen.NUI /// Default size for this layout. /// Constraints imposed by the parent. /// The size this layout should be. + /// 6 public static LayoutLength GetDefaultSize(LayoutLength size, MeasureSpecification measureSpecification) { LayoutLength result = size; @@ -283,6 +270,11 @@ namespace Tizen.NUI return result; } + /// + /// Get the Layouts parent + /// + /// Layout parent with an LayoutParent interface + /// 6 public ILayoutParent GetParent() { return Parent; @@ -292,6 +284,7 @@ namespace Tizen.NUI /// Request that this layout is re-laid out.
/// This will make this layout and all it's parent layouts dirty.
/// + /// 6 public void RequestLayout() { Flags = Flags | LayoutFlags.ForceLayout; @@ -301,7 +294,8 @@ namespace Tizen.NUI /// /// Predicate to determine if this layout has been requested to re-layout.
///
- public bool LayoutRequested + + internal bool LayoutRequested { get { @@ -313,43 +307,21 @@ namespace Tizen.NUI /// Get the measured width (without any measurement flags).
/// This method should be used only during measurement and layout calculations.
/// + /// 6 public MeasuredSize MeasuredWidth{ get; set; } = new MeasuredSize( new LayoutLength(-3), MeasuredSize.StateType.MeasuredSizeOK); /// /// Get the measured height (without any measurement flags).
/// This method should be used only during measurement and layout calculations.
///
+ /// 6 public MeasuredSize MeasuredHeight{ get; set; } = new MeasuredSize( new LayoutLength(-3), MeasuredSize.StateType.MeasuredSizeOK); - /// - /// Get the measured width and state.
- /// This method should be used only during measurement and layout calculations.
- ///
- public MeasuredSize MeasuredWidthAndState - { - get - { - return MeasuredWidth; // Not bitmasking State unless proven to be required. - } - } - - - /// - /// Get the measured height and state.
- /// This method should be used only during measurement and layout calculations.
- ///
- public MeasuredSize MeasuredHeightAndState - { - get - { - return MeasuredHeight; // Not bitmasking State unless proven to be required. - } - } - /// /// Returns the suggested minimum width that the layout should use.
/// This returns the maximum of the layout's minimum width and the owner's natural width.
///
+ /// 6 public LayoutLength SuggestedMinimumWidth { get @@ -363,6 +335,7 @@ namespace Tizen.NUI /// Returns the suggested minimum height that the layout should use.
/// This returns the maximum of the layout's minimum height and the owner's natural height.
/// + /// 6 public LayoutLength SuggestedMinimumHeight { get @@ -380,7 +353,7 @@ namespace Tizen.NUI /// 2. If the owner's View.WidthSpecification is set to View.LayoutParamPolicies.WrapContent, then the view's width is set based on the suggested minimum width. (@see GetSuggestedMinimumWidth()).
/// 3. If the owner's View.WidthSpecification is set to View.LayoutParamPolicies.MatchParent, then the parent width takes precedence over the minimum width.
/// - public LayoutLength MinimumWidth {get; set;} + internal LayoutLength MinimumWidth {get; set;} /// /// Sets the minimum height of the layout.
@@ -390,7 +363,7 @@ namespace Tizen.NUI /// 2. If the owner's View.HeightSpecification is set to View.LayoutParamPolicies.WrapContent, then the view's height is set based on the suggested minimum height. (@see GetSuggestedMinimumHeight()).
/// 3. If the owner's View.HeightSpecification is set to View.LayoutParamPolicies.MatchParent, then the parent height takes precedence over the minimum height.
///
- public LayoutLength MinimumHeight {get; set;} + internal LayoutLength MinimumHeight {get; set;} /// /// Utility to reconcile a desired size and state, with constraints imposed by a MeasureSpecification. @@ -399,6 +372,7 @@ namespace Tizen.NUI /// Constraints imposed by the parent. /// Size information bit mask for the layout's children. /// A measured size, which may indicate that it is too small. + /// 6 protected MeasuredSize ResolveSizeAndState( LayoutLength size, MeasureSpecification measureSpecification, MeasuredSize.StateType childMeasuredState ) { var specMode = measureSpecification.Mode; @@ -436,6 +410,7 @@ namespace Tizen.NUI /// /// The measured width of this layout. /// The measured height of this layout. + /// 6 protected void SetMeasuredDimensions( MeasuredSize measuredWidth, MeasuredSize measuredHeight ) { MeasuredWidth = measuredWidth; @@ -454,6 +429,7 @@ namespace Tizen.NUI /// /// horizontal space requirements as imposed by the parent. /// vertical space requirements as imposed by the parent. + /// 6 protected virtual void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) { // GetDefaultSize will limit the MeasureSpec to the suggested minimumWidth and minimumHeight @@ -470,24 +446,17 @@ namespace Tizen.NUI /// Top position, relative to parent. /// Right position, relative to parent. /// Bottom position, relative to parent. + /// 6 protected virtual void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) { } - /// - /// Virtual method to inform derived classes when the layout size changed.
- ///
- /// The new size of the layout. - /// The old size of the layout. - protected virtual void OnSizeChanged(LayoutSize newSize, LayoutSize oldSize) - { - } - /// /// Virtual method to allow derived classes to remove any children before it is removed from /// its parent. /// - public virtual void OnUnparent() + /// 6 + protected virtual void OnUnparent() { } @@ -495,6 +464,7 @@ namespace Tizen.NUI /// Virtual method called when this Layout is attached to it's owner. /// Allows derived layouts to take ownership of child Views and connect to any Owner signals required. /// + /// 6 protected virtual void OnAttachedToOwner() { } diff --git a/src/Tizen.NUI/src/internal/Layouting/LayoutLength.cs b/src/Tizen.NUI/src/public/Layouting/LayoutLength.cs similarity index 90% rename from src/Tizen.NUI/src/internal/Layouting/LayoutLength.cs rename to src/Tizen.NUI/src/public/Layouting/LayoutLength.cs index 7ff7c3aa1..8b3b07e09 100755 --- a/src/Tizen.NUI/src/internal/Layouting/LayoutLength.cs +++ b/src/Tizen.NUI/src/public/Layouting/LayoutLength.cs @@ -24,7 +24,7 @@ namespace Tizen.NUI /// /// [Draft] A type that represents a layout length. Currently, this implies pixels, but could be extended to handle device dependant sizes, etc. /// - internal struct LayoutLength + public struct LayoutLength { private float _value; @@ -32,6 +32,7 @@ namespace Tizen.NUI /// [Draft] Constructor from an int /// /// Int to initialize with. + /// 6 public LayoutLength(int value) { _value = value; @@ -41,6 +42,7 @@ namespace Tizen.NUI /// [Draft] Constructor from a float /// /// Float to initialize with. + /// 6 public LayoutLength(float value) { _value = value; @@ -50,6 +52,7 @@ namespace Tizen.NUI /// [Draft] Constructor from a LayoutLength /// /// LayoutLength object to initialize with. + /// 6 public LayoutLength(LayoutLength layoutLength) { _value = layoutLength._value; @@ -59,6 +62,7 @@ namespace Tizen.NUI /// [Draft] Return value as rounded value (whole number), best used as final output /// /// The layout length value as a rounded whole number. + /// 6 public float AsRoundedValue() { return (float)Math.Round((decimal)_value, MidpointRounding.AwayFromZero); @@ -68,6 +72,7 @@ namespace Tizen.NUI /// [Draft] Return value as the raw decimal value, best used for calculations /// /// The layout length value as the raw decimal value. + /// 6 public float AsDecimal() { return _value; @@ -79,6 +84,7 @@ namespace Tizen.NUI /// The first value. /// The second value /// true if LayoutLengths are equal + /// 6 public static bool operator ==(LayoutLength arg1, LayoutLength arg2) { return arg1.Equals(arg2); @@ -90,6 +96,7 @@ namespace Tizen.NUI /// The first value. /// The second value /// true if LayoutLengths are not equal + /// 6 public static bool operator !=(LayoutLength arg1, LayoutLength arg2) { return !arg1.Equals(arg2); @@ -100,6 +107,7 @@ namespace Tizen.NUI /// /// The object to compare with the current object. /// true if equal LayoutLength, else false. + /// 6 public override bool Equals(object obj) { if (obj is LayoutLength) @@ -114,6 +122,7 @@ namespace Tizen.NUI /// /// The LayoutLength to compare with the current LayoutLength. /// true if equal LayoutLengths, else false. + /// 6 public bool Equals(LayoutLength layoutLength) { return (Math.Abs(_value - layoutLength._value ) <= float.Epsilon); @@ -122,6 +131,8 @@ namespace Tizen.NUI /// /// A hash code for the current object. /// + /// Calculated hash code. + /// 6 public override int GetHashCode() { return (int)Math.Ceiling(_value); @@ -133,6 +144,7 @@ namespace Tizen.NUI /// The first value. /// The second value. /// The LayoutLength containing the result of the addition. + /// 6 public static LayoutLength operator +(LayoutLength arg1, LayoutLength arg2) { return new LayoutLength( arg1._value + arg2._value ); @@ -144,6 +156,7 @@ namespace Tizen.NUI /// The first value. /// The second value. /// The LayoutLength containing the result of the addition. + /// 6 public static LayoutLength operator +(LayoutLength arg1, int arg2) { return new LayoutLength(arg1._value + (float)arg2); @@ -155,6 +168,7 @@ namespace Tizen.NUI /// The first value. /// The second value. /// The LayoutLength containing the result of the subtraction. + /// 6 public static LayoutLength operator -(LayoutLength arg1, LayoutLength arg2) { return new LayoutLength(arg1._value - arg2._value); @@ -166,6 +180,7 @@ namespace Tizen.NUI /// The first value. /// The second value. /// The LayoutLength containing the result of the subtraction. + /// 6 public static LayoutLength operator -(LayoutLength arg1, int arg2) { return new LayoutLength(arg1._value - (float)arg2); @@ -177,6 +192,7 @@ namespace Tizen.NUI /// The first value. /// The second value. /// The LayoutLength containing the result of the multiplication. + /// 6 public static LayoutLength operator *(LayoutLength arg1, LayoutLength arg2) { return new LayoutLength(arg1._value * arg2._value); @@ -188,6 +204,7 @@ namespace Tizen.NUI /// The first value. /// The int value to scale the LayoutLength. /// The LayoutLength containing the result of the scaling. + /// 6 public static LayoutLength operator *(LayoutLength arg1, int arg2) { return new LayoutLength(arg1._value * arg2); @@ -199,6 +216,7 @@ namespace Tizen.NUI /// The first value. /// The second value. /// The LayoutLength containing the result of the division. + /// 6 public static LayoutLength operator /(LayoutLength arg1, LayoutLength arg2) { return new LayoutLength(arg1._value / arg2._value); @@ -210,6 +228,7 @@ namespace Tizen.NUI /// The first value. /// The int value to scale the vector by. /// The LayoutLength containing the result of the scaling. + /// 6 public static LayoutLength operator /(LayoutLength arg1, int arg2) { return new LayoutLength(arg1._value / (float)arg2); diff --git a/src/Tizen.NUI/src/internal/Layouting/LayoutTransition.cs b/src/Tizen.NUI/src/public/Layouting/LayoutTransition.cs similarity index 71% rename from src/Tizen.NUI/src/internal/Layouting/LayoutTransition.cs rename to src/Tizen.NUI/src/public/Layouting/LayoutTransition.cs index 98cf30ff4..5f23f4f0d 100755 --- a/src/Tizen.NUI/src/internal/Layouting/LayoutTransition.cs +++ b/src/Tizen.NUI/src/public/Layouting/LayoutTransition.cs @@ -17,56 +17,94 @@ using System.Collections.Generic; using System; -using System.ComponentModel; namespace Tizen.NUI { /// /// Define a List of LayoutTransitions /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 public class TransitionList : List {} + /// + /// The conditions for transitions. + /// + /// 6 + [FlagsAttribute] public enum TransitionCondition + { + /// + /// Default when a condition has not been set. + /// + /// 6 + Unspecified = 0, + /// + /// Animate changing layout to another layout. + /// + /// 6 + + LayoutChanged = 1, + /// + /// Animate adding item. + /// + /// 6 + + Add = 2, + /// + /// Animate removing item. + /// + /// 6 + + Remove = 4, + /// + /// Animation when an item changes due to a being added. + /// + /// 6 + + ChangeOnAdd = 8, + /// + /// Animation when an item changes due to a being removed. + /// + /// 6 + + ChangeOnRemove = 16 + } + /// /// The properties that can be animated. /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 public enum AnimatableProperties { /// /// Position property. /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 + Position, /// /// Size property. /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 + Size, /// /// Opacity property. /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 + Opacity } /// /// Parts of the transition that can be configured to provide a custom effect. /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 public class TransitionComponents { /// /// TransitionComponents default constructor. /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 public TransitionComponents() { Delay = 0; @@ -78,10 +116,10 @@ namespace Tizen.NUI /// TransitionComponents constructor. Stores delay, duration and AlphaFunction. /// /// The delay before the animator starts. - /// the duration fo the animator. + /// the duration of the animator. /// alpha function to use . - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 + public TransitionComponents(int delay, int duration, AlphaFunction alphaFunction) { Delay = delay; @@ -90,37 +128,31 @@ namespace Tizen.NUI } /// - /// Time the transition should execute. Milliseconds. + /// Get, Set the time transition should execute for . Milliseconds. /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 public int Duration; /// - /// Delay before the transition executes. Milliseconds. + /// Get, Set the delay before the transition executes. Milliseconds. /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 public int Delay; /// - /// Function to alter the transition path over time. + /// Get, Set the function to alter the transition path over time. /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 public AlphaFunction AlphaFunction; } /// - /// LayoutTransition stores the aninmation setting for a transition conidition. + /// LayoutTransition stores the animation setting for a transition conidition. /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] public class LayoutTransition { /// /// LayoutTransition default constructor. /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 public LayoutTransition() { Condition = TransitionCondition.Unspecified; @@ -135,8 +167,7 @@ namespace Tizen.NUI /// the property to animate. /// target value of the property. /// Components to define the animator. - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 public LayoutTransition( TransitionCondition condition, AnimatableProperties animatableProperty, object targetValue, @@ -151,26 +182,26 @@ namespace Tizen.NUI /// /// Condition for this Transition /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 + public TransitionCondition Condition{get; set;} /// /// Property to animate. /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 + public AnimatableProperties AnimatableProperty{get; set;} /// /// Components of the Animator. /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 + public TransitionComponents Animator{get; set;} /// /// Target value to animate to. /// - /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 6 + public object TargetValue{get; set;} } diff --git a/src/Tizen.NUI/src/internal/Layouting/LinearLayout.cs b/src/Tizen.NUI/src/public/Layouting/LinearLayout.cs similarity index 93% rename from src/Tizen.NUI/src/internal/Layouting/LinearLayout.cs rename to src/Tizen.NUI/src/public/Layouting/LinearLayout.cs index c92769355..06ab7380b 100755 --- a/src/Tizen.NUI/src/internal/Layouting/LinearLayout.cs +++ b/src/Tizen.NUI/src/public/Layouting/LinearLayout.cs @@ -23,11 +23,12 @@ namespace Tizen.NUI /// /// [Draft] This class implements a linear box layout, automatically handling right to left or left to right direction change. /// - internal class LinearLayout : LayoutGroup + public class LinearLayout : LayoutGroup { /// /// [Draft] Enumeration for the direction in which the content is laid out /// + /// 6 public enum Orientation { /// @@ -43,6 +44,7 @@ namespace Tizen.NUI /// /// [Draft] Enumeration for the alignment of the linear layout items /// + /// 6 public enum Alignment { /// @@ -90,6 +92,7 @@ namespace Tizen.NUI /// /// [Draft] Get/Set the orientation in the layout /// + /// 6 public LinearLayout.Orientation LinearOrientation { get @@ -106,6 +109,7 @@ namespace Tizen.NUI /// /// [Draft] Get/Set the padding between cells in the layout /// + /// 6 public Size2D CellPadding { get @@ -123,6 +127,7 @@ namespace Tizen.NUI /// /// [Draft] Get/Set the alignment in the layout /// + /// 6 public LinearLayout.Alignment LinearAlignment{ get; set; } = Alignment.Top; private float _totalLength = 0.0f; @@ -132,10 +137,17 @@ namespace Tizen.NUI /// /// [Draft] Constructor /// + /// 6 public LinearLayout() { } + /// + /// Measure the layout and its content to determine the measured width and the measured height. + /// + /// horizontal space requirements as imposed by the parent. + /// vertical space requirements as imposed by the parent. + /// 6 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) { if (_linearOrientation == Orientation.Horizontal) @@ -148,6 +160,15 @@ namespace Tizen.NUI } } + /// + /// Layout should assign a size and position to each of its children.
+ ///
+ /// This is a new size or position for this layout. + /// Left position, relative to parent. + /// Top position, relative to parent. + /// Right position, relative to parent. + /// Bottom position, relative to parent. + /// 6 protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) { if (_linearOrientation == Orientation.Horizontal) @@ -225,13 +246,13 @@ namespace Tizen.NUI childLayout.Measure( childWidthMeasureSpec, childHeightMeasureSpec ); // Child may now not fit in horizontal dimension. - if( childLayout.MeasuredWidthAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall) + if( childLayout.MeasuredWidth.State == MeasuredSize.StateType.MeasuredSizeTooSmall) { childState.widthState = MeasuredSize.StateType.MeasuredSizeTooSmall; } // Child may now not fit in vertical dimension. - if( childLayout.MeasuredHeightAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall) + if( childLayout.MeasuredHeight.State == MeasuredSize.StateType.MeasuredSizeTooSmall) { childState.heightState = MeasuredSize.StateType.MeasuredSizeTooSmall; } @@ -261,7 +282,7 @@ namespace Tizen.NUI // 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 ) + foreach( LayoutItem childLayout in LayoutChildren ) { int childDesiredHeight = childLayout.Owner.HeightSpecification; float childWeight = childLayout.Owner.Weight; @@ -323,11 +344,11 @@ namespace Tizen.NUI float marginHeight = childMargin.Top + childMargin.Bottom; float childHeight = childLayout.MeasuredHeight.Size.AsDecimal() + marginHeight; - if (childLayout.MeasuredWidthAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall) + if (childLayout.MeasuredWidth.State == MeasuredSize.StateType.MeasuredSizeTooSmall) { childState.widthState = MeasuredSize.StateType.MeasuredSizeTooSmall; } - if (childLayout.MeasuredHeightAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall) + if (childLayout.MeasuredHeight.State == MeasuredSize.StateType.MeasuredSizeTooSmall) { childState.heightState = MeasuredSize.StateType.MeasuredSizeTooSmall; } @@ -366,10 +387,10 @@ namespace Tizen.NUI maxHeight = 0; _totalLength = 0; - int numberOfChildren = _children.Count; + int numberOfChildren = LayoutChildren.Count; for( int i = 0; i < numberOfChildren; ++i ) { - LayoutItem childLayout = _children[i]; + LayoutItem childLayout = LayoutChildren[i]; float desiredChildHeight = childLayout.Owner.HeightSpecification; @@ -459,7 +480,7 @@ namespace Tizen.NUI // 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 ) + foreach( LayoutItem childLayout in LayoutChildren ) { int childDesiredWidth = childLayout.Owner.WidthSpecification; int childDesiredHeight = childLayout.Owner.HeightSpecification; @@ -502,7 +523,7 @@ namespace Tizen.NUI 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) + if (index>=LayoutChildren.Count-1) { cellPadding = 0.0f; } @@ -520,11 +541,11 @@ namespace Tizen.NUI float marginWidth = (childLayout.Margin.Start) + (childLayout.Margin.End); float childWidth = childLayout.MeasuredWidth.Size.AsDecimal() + marginWidth; - if (childLayout.MeasuredWidthAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall) + if (childLayout.MeasuredWidth.State == MeasuredSize.StateType.MeasuredSizeTooSmall) { childState.widthState = MeasuredSize.StateType.MeasuredSizeTooSmall; } - if (childLayout.MeasuredHeightAndState.State == MeasuredSize.StateType.MeasuredSizeTooSmall) + if (childLayout.MeasuredHeight.State == MeasuredSize.StateType.MeasuredSizeTooSmall) { childState.heightState = MeasuredSize.StateType.MeasuredSizeTooSmall; } @@ -570,10 +591,10 @@ namespace Tizen.NUI _totalLength = 0; - int numberOfChildren = _children.Count; + int numberOfChildren = LayoutChildren.Count; for( int i = 0; i < numberOfChildren; ++i ) { - LayoutItem childLayout = _children[i]; + LayoutItem childLayout = LayoutChildren[i]; float desiredChildWidth = childLayout.Owner.WidthSpecification; @@ -646,7 +667,7 @@ namespace Tizen.NUI // Space available for child LayoutLength childSpace = new LayoutLength( height - Padding.Top - Padding.Bottom); - int count = _children.Count; + int count = LayoutChildren.Count; switch (LinearAlignment) { @@ -696,7 +717,7 @@ namespace Tizen.NUI { int childIndex = start + dir * i; // Get a reference to the childLayout at the given index - LayoutItem childLayout = _children[childIndex]; + LayoutItem childLayout = LayoutChildren[childIndex]; if( childLayout != null ) { LayoutLength childWidth = childLayout.MeasuredWidth.Size; @@ -735,7 +756,7 @@ namespace Tizen.NUI // Space available for child LayoutLength childSpace = new LayoutLength( width - Padding.Start - Padding.End); - int count = _children.Count; + int count = LayoutChildren.Count; switch (LinearAlignment) { @@ -757,7 +778,7 @@ namespace Tizen.NUI for( int i = 0; i < count; i++) { - LayoutItem childLayout = _children[i]; + LayoutItem childLayout = LayoutChildren[i]; if( childLayout != null ) { LayoutLength childWidth = childLayout.MeasuredWidth.Size; @@ -797,7 +818,7 @@ namespace Tizen.NUI // 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); - foreach (LayoutItem childLayout in _children) + foreach (LayoutItem childLayout in LayoutChildren) { int desiredChildHeight = childLayout.Owner.HeightSpecification; int desiredChildWidth = childLayout.Owner.WidthSpecification; @@ -820,7 +841,7 @@ namespace Tizen.NUI { // Pretend that the linear layout has an exact size. MeasureSpecification uniformMeasureSpec = new MeasureSpecification( MeasuredWidth.Size, MeasureSpecification.ModeType.Exactly); - foreach (LayoutItem childLayout in _children) + foreach (LayoutItem childLayout in LayoutChildren) { int desiredChildWidth = childLayout.Owner.WidthSpecification; int desiredChildHeight = childLayout.Owner.WidthSpecification; diff --git a/src/Tizen.NUI/src/internal/Layouting/MeasureSpecification.cs b/src/Tizen.NUI/src/public/Layouting/MeasureSpecification.cs similarity index 86% rename from src/Tizen.NUI/src/internal/Layouting/MeasureSpecification.cs rename to src/Tizen.NUI/src/public/Layouting/MeasureSpecification.cs index d12e3c85f..c67a17c3d 100755 --- a/src/Tizen.NUI/src/internal/Layouting/MeasureSpecification.cs +++ b/src/Tizen.NUI/src/public/Layouting/MeasureSpecification.cs @@ -24,29 +24,36 @@ namespace Tizen.NUI /// [Draft] A MeasureSpecification is used during the Measure pass by a LayoutGroup to inform it's children how to be measured. /// For instance, it may measure a child with an exact width and an unspecified height in order to determine height for width. ///
- internal struct MeasureSpecification + public struct MeasureSpecification { /// /// MeasureSpecification Size value. /// + /// 6 public LayoutLength Size; /// /// MeasureSpecification Mode. /// + /// 6 public MeasureSpecification.ModeType Mode; /// /// Constructor taking size and mode type. /// /// size value. - /// mode vaue. + /// mode value. + /// 6 public MeasureSpecification(LayoutLength size, MeasureSpecification.ModeType mode) { Size = size; Mode = mode; } + /// + /// Size mode for this MeasureSpecification + /// + /// 6 public enum ModeType { /// diff --git a/src/Tizen.NUI/src/internal/Layouting/MeasuredSize.cs b/src/Tizen.NUI/src/public/Layouting/MeasuredSize.cs similarity index 87% rename from src/Tizen.NUI/src/internal/Layouting/MeasuredSize.cs rename to src/Tizen.NUI/src/public/Layouting/MeasuredSize.cs index c978212e6..54ae209c8 100755 --- a/src/Tizen.NUI/src/internal/Layouting/MeasuredSize.cs +++ b/src/Tizen.NUI/src/public/Layouting/MeasuredSize.cs @@ -23,13 +23,14 @@ namespace Tizen.NUI /// /// [Draft] Class that encodes a measurement and a measure state, which is set if the measured size is too small. /// - internal struct MeasuredSize + public struct MeasuredSize { /// /// Constructor /// /// size parameter /// State + /// 6 public MeasuredSize(LayoutLength measuredSize, MeasuredSize.StateType state) { Size = measuredSize; @@ -40,6 +41,8 @@ namespace Tizen.NUI /// Creates a MeasuredSize from a LayoutLength /// /// LayoutLength to create + /// 6 + /// Returns a MeasuredSize object public static implicit operator MeasuredSize(LayoutLength measuredSize) { return new MeasuredSize(measuredSize, StateType.MeasuredSizeOK); @@ -48,16 +51,19 @@ namespace Tizen.NUI /// /// LayoutLength size property /// + /// 6 public LayoutLength Size{ get; set;} /// /// Measured state for this size. /// + /// 6 public StateType State{ get; set; } /// /// Measured states for a Size value. /// + /// 6 public enum StateType { /// diff --git a/src/Tizen.NUI/src/public/Window.cs b/src/Tizen.NUI/src/public/Window.cs index bf6af72d8..9a6edd947 100755 --- a/src/Tizen.NUI/src/public/Window.cs +++ b/src/Tizen.NUI/src/public/Window.cs @@ -631,6 +631,9 @@ namespace Tizen.NUI } } + /// + /// Get the LayoutController for this Window. + /// internal LayoutController LayoutController { get diff --git a/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-root-layer-test.cs b/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-root-layer-test.cs index 1347e996b..d06a00cf3 100755 --- a/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-root-layer-test.cs +++ b/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-root-layer-test.cs @@ -71,7 +71,7 @@ namespace CustomLayoutWithoutAbsoluteLayout var center = childIncrement / 2; // Check layout direction - var view = GetOwner(); + var view = Owner; ViewLayoutDirectionType layoutDirection = view.LayoutDirection; for (uint i = 0; i < count; i++) diff --git a/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-test-2.cs b/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-test-2.cs index 1a73b1023..23f42166a 100755 --- a/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-test-2.cs +++ b/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-test-2.cs @@ -87,7 +87,7 @@ namespace CustomLayoutTest2 var center = childIncrement / 2; // Check layout direction - var view = GetOwner(); + var view = Owner; ViewLayoutDirectionType layoutDirection = view.LayoutDirection; // this is needed, otherwise the child's LayoutItem is garbage collected! @@ -180,7 +180,7 @@ namespace CustomLayoutTest2 } var center = childIncrement / 2; - var view = GetOwner(); + var view = Owner; ViewLayoutDirectionType layoutDirection = view.LayoutDirection; for (uint i = 0; i < ChildCount; ++i) diff --git a/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-test.cs b/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-test.cs index 9244a5def..dc1047672 100755 --- a/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-test.cs +++ b/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-test.cs @@ -87,7 +87,7 @@ namespace CustomLayoutByAbsoluteLayout var center = childIncrement / 2; // Check layout direction - var view = GetOwner(); + var view = Owner; ViewLayoutDirectionType layoutDirection = view.LayoutDirection; // this is needed, otherwise the child's LayoutItem is garbage collected! @@ -180,7 +180,7 @@ namespace CustomLayoutByAbsoluteLayout } var center = childIncrement / 2; - var view = GetOwner(); + var view = Owner; ViewLayoutDirectionType layoutDirection = view.LayoutDirection; for (uint i = 0; i < ChildCount; ++i) diff --git a/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-without-absoluteLayout-test.cs b/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-without-absoluteLayout-test.cs index 44a2d5cda..69cc1769f 100755 --- a/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-without-absoluteLayout-test.cs +++ b/test/NUITestSample/NUITestSample/examples/layouting/custom-layout-without-absoluteLayout-test.cs @@ -71,7 +71,7 @@ namespace SimpleLayout var center = childIncrement / 2; // Check layout direction - var view = GetOwner(); + var view = Owner; ViewLayoutDirectionType layoutDirection = view.LayoutDirection; for (uint i = 0; i < count; i++) diff --git a/test/NUITestSample/NUITestSample/examples/layouting/root-problem-fix-adding-several-layers.cs b/test/NUITestSample/NUITestSample/examples/layouting/root-problem-fix-adding-several-layers.cs index bf7a0855d..858b21fb0 100755 --- a/test/NUITestSample/NUITestSample/examples/layouting/root-problem-fix-adding-several-layers.cs +++ b/test/NUITestSample/NUITestSample/examples/layouting/root-problem-fix-adding-several-layers.cs @@ -72,7 +72,7 @@ namespace RootProblemFixAddingSeveralLayers var center = childIncrement / 2; // Check layout direction - var view = GetOwner(); + var view = Owner; ViewLayoutDirectionType layoutDirection = view.LayoutDirection; for (uint i = 0; i < count; i++) -- 2.34.1