From: Yeongjong Lee Date: Tue, 3 Nov 2020 08:57:57 +0000 (+0900) Subject: [NUI] change Column, Row default value from -1 to AutoColumn, AutoRow X-Git-Tag: submit/tizen_6.0/20201106.005219~1^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=03432705ed1d0b2119e981c73dcf954ab6fa55b0;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] change Column, Row default value from -1 to AutoColumn, AutoRow ArgumentException will be thrown when column,row is a negative value other than AutoColumn/AutoRow. --- diff --git a/src/Tizen.NUI/src/internal/Layouting/GridLocations.cs b/src/Tizen.NUI/src/internal/Layouting/GridLocations.cs index 7a72159..e9299de 100755 --- a/src/Tizen.NUI/src/internal/Layouting/GridLocations.cs +++ b/src/Tizen.NUI/src/internal/Layouting/GridLocations.cs @@ -196,14 +196,14 @@ namespace Tizen.NUI // assign column/row depending on GridOrientation. The main axis count(Columns on Horizontal, Rows otherwise) won't be exceeded // explicit column(row) count which is assigned by Columns(Rows). but, cross axis count(Rows(Columns)) can be increased by sub axis count. - if (column == CellUndefined || row == CellUndefined) + if (column == AutoColumn || row == AutoRow) { (int point, int span) mainAxis = isHorizontal ? (column, columnSpan) : (row, rowSpan); (int point, int span) subAxis = isHorizontal ? (row, rowSpan) : (column, columnSpan); - if (subAxis.point != CellUndefined) + if (subAxis.point != AutoColumn && subAxis.point != AutoRow) subPivot = subAxis.point; - if (mainAxis.point != CellUndefined) + if (mainAxis.point != AutoColumn && mainAxis.point != AutoRow) mainPivot = mainAxis.point; if (mainPivot + mainAxis.span > pivotStack.Length) @@ -221,7 +221,7 @@ namespace Tizen.NUI if (n > pivotStack.Length) { - if (mainAxis.point != CellUndefined) + if (mainAxis.point != AutoColumn && mainAxis.point != AutoRow) mainPivot = mainAxis.point; else mainPivot = 0; diff --git a/src/Tizen.NUI/src/public/Layouting/GridLayout.cs b/src/Tizen.NUI/src/public/Layouting/GridLayout.cs index 0bb0010..a634d21 100755 --- a/src/Tizen.NUI/src/public/Layouting/GridLayout.cs +++ b/src/Tizen.NUI/src/public/Layouting/GridLayout.cs @@ -30,7 +30,7 @@ namespace Tizen.NUI /// ColumnProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ColumnProperty = BindableProperty.CreateAttached("Column", typeof(int), typeof(GridLayout), CellUndefined, validateValue: (bindable, value) => (int)value >= 0, propertyChanged: OnChildPropertyChanged); + public static readonly BindableProperty ColumnProperty = BindableProperty.CreateAttached("Column", typeof(int), typeof(GridLayout), AutoColumn, validateValue: (bindable, value) => (int)value >= 0 || (int)value == AutoColumn, propertyChanged: OnChildPropertyChanged); /// /// ColumnSpanProperty @@ -42,7 +42,7 @@ namespace Tizen.NUI /// RowProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty RowProperty = BindableProperty.CreateAttached("Row", typeof(int), typeof(GridLayout), CellUndefined, validateValue: (bindable, value) => (int)value >= 0, propertyChanged: OnChildPropertyChanged); + public static readonly BindableProperty RowProperty = BindableProperty.CreateAttached("Row", typeof(int), typeof(GridLayout), AutoRow, validateValue: (bindable, value) => (int)value >= 0 || (int)value == AutoRow, propertyChanged: OnChildPropertyChanged); /// /// RowSpanProperty @@ -74,7 +74,12 @@ namespace Tizen.NUI [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty VerticalAlignmentProperty = BindableProperty.CreateAttached("VerticalAlignment", typeof(Alignment), typeof(GridLayout), Alignment.Start, validateValue: ValidateEnum((int)Alignment.Start, (int)Alignment.End), propertyChanged: OnChildPropertyChanged); - private const int CellUndefined = -1; + + [EditorBrowsable(EditorBrowsableState.Never)] + public const int AutoColumn = int.MinValue; + [EditorBrowsable(EditorBrowsableState.Never)] + public const int AutoRow = int.MinValue; + private Orientation gridOrientation = Orientation.Horizontal; private int columns = 1; private int rows = 1; @@ -170,12 +175,13 @@ namespace Tizen.NUI public static Alignment GetVerticalAlignment(View view) => GetAttachedValue(view, VerticalAlignmentProperty); /// - /// Sets the column index the child occupies. the default value is -1. + /// Sets the column index the child occupies. A default column is .
+ /// If column is a , child will be automatically laid out depending on . ///
/// The child view. /// The column index of . /// The cannot be null. - /// The cannot be less than 0. + /// The cannot be a negative value other than . /// 8 public static void SetColumn(View view, int value) => SetAttachedValue(view, ColumnProperty, value); @@ -190,12 +196,13 @@ namespace Tizen.NUI public static void SetColumnSpan(View view, int value) => SetAttachedValue(view, ColumnSpanProperty, value); /// - /// Sets the row index the child occupies. the default value is -1. + /// Sets the row index the child occupies. A default row index is .
+ /// If row is a , child will be automatically laid out depending on . ///
/// The child view. /// The row index of . /// The cannot be null. - /// The cannot be less than 0. + /// The cannot be a negative value other than . /// 8 public static void SetRow(View view, int value) => SetAttachedValue(view, RowProperty, value);