Revert "[NUI] Support Layout property by ViewStyle"
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Fri, 3 Jun 2022 09:11:23 +0000 (18:11 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 3 Jun 2022 09:22:25 +0000 (18:22 +0900)
This reverts commit 401fdd783df1f139eb2283d453678d69e02fb770.

src/Tizen.NUI.Components/Controls/Button.Internal.cs
src/Tizen.NUI.Components/Theme/DefaultThemeCommon.cs
src/Tizen.NUI/src/public/BaseComponents/Style/ViewStyle.cs
src/Tizen.NUI/src/public/BaseComponents/Style/ViewStyleBindableProperty.cs
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/Layouting/AbsoluteLayout.cs
src/Tizen.NUI/src/public/Layouting/FlexLayout.cs
src/Tizen.NUI/src/public/Layouting/GridLayout.cs
src/Tizen.NUI/src/public/Layouting/LayoutItem.cs
src/Tizen.NUI/src/public/Layouting/LinearLayout.cs
src/Tizen.NUI/src/public/Layouting/RelativeLayout.cs

index 4a93a56..41a6243 100644 (file)
@@ -338,52 +338,54 @@ namespace Tizen.NUI.Components
             Size2D cellPadding = String.IsNullOrEmpty(buttonText.Text) ? new Size2D(0, 0) : itemSpacing;
 #pragma warning restore CA2000
 
-            // If LayoutItems() is called by OnInitialize(), then layout would be null.
-            // Because layout is set by ApplyStyle() which is called after OnInitialize().
-            var layout = Layout as LinearLayout;
-            if (layout != null)
-            {
-                layout.HorizontalAlignment = itemHorizontalAlignment;
-                layout.VerticalAlignment = itemVerticalAlignment;
-                layout.CellPadding = cellPadding;
-            }
-
             if (IconRelativeOrientation == IconOrientation.Left)
             {
-                if (layout != null)
+                Layout = new LinearLayout()
                 {
-                    layout.LinearOrientation = LinearLayout.Orientation.Horizontal;
-                }
+                    LinearOrientation = LinearLayout.Orientation.Horizontal,
+                    HorizontalAlignment = itemHorizontalAlignment,
+                    VerticalAlignment = itemVerticalAlignment,
+                    CellPadding = cellPadding
+                };
 
                 Add(buttonIcon);
                 Add(buttonText);
             }
             else if (IconRelativeOrientation == IconOrientation.Right)
             {
-                if (layout != null)
+                Layout = new LinearLayout()
                 {
-                    layout.LinearOrientation = LinearLayout.Orientation.Horizontal;
-                }
+                    LinearOrientation = LinearLayout.Orientation.Horizontal,
+                    HorizontalAlignment = itemHorizontalAlignment,
+                    VerticalAlignment = itemVerticalAlignment,
+                    CellPadding = cellPadding
+                };
 
                 Add(buttonText);
                 Add(buttonIcon);
             }
             else if (IconRelativeOrientation == IconOrientation.Top)
             {
-                if (layout != null)
+                Layout = new LinearLayout()
                 {
-                    layout.LinearOrientation = LinearLayout.Orientation.Vertical;
-                }
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                    HorizontalAlignment = itemHorizontalAlignment,
+                    VerticalAlignment = itemVerticalAlignment,
+                    CellPadding = cellPadding
+                };
 
                 Add(buttonIcon);
                 Add(buttonText);
             }
             else if (IconRelativeOrientation == IconOrientation.Bottom)
             {
-                if (layout != null)
+                Layout = new LinearLayout()
                 {
-                    layout.LinearOrientation = LinearLayout.Orientation.Vertical;
-                }
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                    HorizontalAlignment = itemHorizontalAlignment,
+                    VerticalAlignment = itemVerticalAlignment,
+                    CellPadding = cellPadding
+                };
 
                 Add(buttonText);
                 Add(buttonIcon);
index 8700d3f..c693271 100755 (executable)
@@ -56,14 +56,7 @@ namespace Tizen.NUI.Components
                 {
                     TextColor = new Color("#FDFDFD"),
                     PixelSize = 24,
-                },
-                Layout = new LinearLayout()
-                {
-                    LinearOrientation = LinearLayout.Orientation.Horizontal,
-                    HorizontalAlignment = HorizontalAlignment.Center,
-                    VerticalAlignment = VerticalAlignment.Center,
-                    CellPadding = new Size2D(8, 8),
-                },
+                }
             });
 
             // CheckBox base style
index d5af465..73d0beb 100755 (executable)
@@ -63,7 +63,6 @@ namespace Tizen.NUI.BaseComponents
         private Selector<Rectangle> backgroundImageBorderSelector;
         private Selector<Color> colorSelector;
         private VisualTransformPolicyType? cornerRadiusPolicy;
-        private LayoutItem layout;
 
         static ViewStyle() { }
 
@@ -522,16 +521,6 @@ namespace Tizen.NUI.BaseComponents
         public bool SolidNull { get; set; } = false;
 
         /// <summary>
-        /// Layout to position the View's children.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public LayoutItem Layout
-        {
-            get => (LayoutItem)GetValue(LayoutProperty);
-            set => SetValue(LayoutProperty, value);
-        }
-
-        /// <summary>
         /// HashSet of dirty properties. Internal use only.
         /// </summary>
         internal HashSet<BindableProperty> DirtyProperties { get; private set; }
@@ -587,14 +576,7 @@ namespace Tizen.NUI.BaseComponents
 
                 if (destinationProperty != null)
                 {
-                    if (sourceProperty.PropertyName.Equals("Layout") && (sourceValue is LayoutItem layout))
-                    {
-                        InternalSetValue(destinationProperty, layout.Clone());
-                    }
-                    else
-                    {
-                        InternalSetValue(destinationProperty, sourceValue);
-                    }
+                    InternalSetValue(destinationProperty, sourceValue);
                 }
             }
 
index 5ba4ab6..91cef66 100755 (executable)
@@ -440,13 +440,5 @@ namespace Tizen.NUI.BaseComponents
             var buttonStyle = (ViewStyle)bindable;
             return buttonStyle.isEnabled;
         });
-
-        /// <summary> Bindable property of Layout.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty LayoutProperty = BindableProperty.Create(nameof(Layout), typeof(LayoutItem), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
-        {
-            ((ViewStyle)bindable).layout = (LayoutItem)newValue;
-        }, defaultValueCreator: (bindable) => ((ViewStyle)bindable).layout);
     }
 }
index ad361d5..35e2f54 100755 (executable)
@@ -3118,14 +3118,7 @@ namespace Tizen.NUI.BaseComponents
 
                 if (destinationProperty != null)
                 {
-                    if (sourceProperty.PropertyName.Equals("Layout") && (sourceValue is LayoutItem layout))
-                    {
-                        InternalSetValue(destinationProperty, layout.Clone());
-                    }
-                    else
-                    {
-                        InternalSetValue(destinationProperty, sourceValue);
-                    }
+                    InternalSetValue(destinationProperty, sourceValue);
                 }
             }
         }
index afae715..d6675df 100755 (executable)
@@ -14,8 +14,6 @@
  *
  */
 
-using System.ComponentModel;
-
 namespace Tizen.NUI
 {
     /// <summary>
@@ -32,23 +30,6 @@ namespace Tizen.NUI
         {
         }
 
-        /// <inheritdoc/>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public override LayoutItem Clone()
-        {
-            var layout = new AbsoluteLayout();
-
-            foreach (var prop in layout.GetType().GetProperties())
-            {
-                if (prop.GetSetMethod() != null)
-                {
-                    prop.SetValue(layout, this.GetType().GetProperty(prop.Name).GetValue(this));
-                }
-            }
-
-            return layout;
-        }
-
         /// <summary>
         /// Measure the layout and its content to determine the measured width and the measured height.<br />
         /// </summary>
index 479db9f..e5c19cb 100755 (executable)
@@ -629,23 +629,6 @@ namespace Tizen.NUI
             Absolute
         }
 
-        /// <inheritdoc/>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public override LayoutItem Clone()
-        {
-            var layout = new FlexLayout();
-
-            foreach (var prop in layout.GetType().GetProperties())
-            {
-                if (prop.GetSetMethod() != null)
-                {
-                    prop.SetValue(layout, this.GetType().GetProperty(prop.Name).GetValue(this));
-                }
-            }
-
-            return layout;
-        }
-
         private void measureChild(global::System.IntPtr childPtr, float width, int measureModeWidth, float height, int measureModeHeight, out MeasuredSize measureSize)
         {
             // We need to measure child layout
index 6c328d6..87a2290 100755 (executable)
@@ -544,23 +544,6 @@ namespace Tizen.NUI
             /// <since_tizen> 8 </since_tizen>
             End = 2,
         }
-
-        /// <inheritdoc/>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public override LayoutItem Clone()
-        {
-            var layout = new GridLayout();
-
-            foreach (var prop in layout.GetType().GetProperties())
-            {
-                if (prop.GetSetMethod() != null)
-                {
-                    prop.SetValue(layout, this.GetType().GetProperty(prop.Name).GetValue(this));
-                }
-            }
-
-            return layout;
-        }
     }
 
     // Extension Method of GridLayout.Alignment.
index 0111bbb..7f9e69a 100755 (executable)
@@ -417,7 +417,7 @@ namespace Tizen.NUI
         {
             get
             {
-                return (Owner != null) ? Owner.SuggestedMinimumWidth : new LayoutLength(0);
+                return Owner.SuggestedMinimumWidth;
             }
         }
 
@@ -430,7 +430,7 @@ namespace Tizen.NUI
         {
             get
             {
-                return (Owner != null) ? Owner.SuggestedMinimumHeight : new LayoutLength(0);
+                return Owner.SuggestedMinimumHeight;
             }
         }
 
@@ -663,24 +663,5 @@ namespace Tizen.NUI
                 }
             }
         }
-
-        /// <summary>
-        /// Creates a cloned LayoutItem.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public virtual LayoutItem Clone()
-        {
-            var layout = new LayoutItem();
-
-            foreach (var prop in layout.GetType().GetProperties())
-            {
-                if (prop.GetSetMethod() != null)
-                {
-                    prop.SetValue(layout, this.GetType().GetProperty(prop.Name).GetValue(this));
-                }
-            }
-
-            return layout;
-        }
     }
 }
index f6a1d23..1f01206 100755 (executable)
@@ -209,23 +209,6 @@ namespace Tizen.NUI
         {
         }
 
-        /// <inheritdoc/>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public override LayoutItem Clone()
-        {
-            var layout = new LinearLayout();
-
-            foreach (var prop in layout.GetType().GetProperties())
-            {
-                if (prop.GetSetMethod() != null)
-                {
-                    prop.SetValue(layout, this.GetType().GetProperty(prop.Name).GetValue(this));
-                }
-            }
-
-            return layout;
-        }
-
         /// <summary>
         /// Measure the layout and its content to determine the measured width and the measured height.
         /// </summary>
index 28119d0..84fcb78 100755 (executable)
@@ -337,23 +337,6 @@ namespace Tizen.NUI
         public static void SetFillVertical(View view, bool value) => SetAttachedValue(view, FillVerticalProperty, value);
 
         /// <inheritdoc/>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public override LayoutItem Clone()
-        {
-            var layout = new RelativeLayout();
-
-            foreach (var prop in layout.GetType().GetProperties())
-            {
-                if (prop.GetSetMethod() != null)
-                {
-                    prop.SetValue(layout, this.GetType().GetProperty(prop.Name).GetValue(this));
-                }
-            }
-
-            return layout;
-        }
-
-        /// <inheritdoc/>
         /// <since_tizen> 9 </since_tizen>
         protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
         {