[NUI] Fix to require Layout to fit to children or fill to parent
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Wed, 2 Jun 2021 12:29:39 +0000 (21:29 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 8 Jun 2021 05:35:32 +0000 (14:35 +0900)
This patch is necessary to the following patch.
"[NUI] Deprecate ResizePolicyType"

It is impossible that LayoutParamPolicies.WrapContent supports both
ResizePolicyType.UseNaturalSize and FitToChildren.

Therefore, LayoutParamPolicies.WrapContent does not support
ResizePolicyType.UseNaturalSize nor FitToChildren.
Instead, LayoutParamPolicies.WrapContent makes View fit to its children
only if the View sets its Layout.

In the same way, LayoutParamPolicies.MatchParent does not support
ResizePolicyType.FillToParent.
Instead, LayoutParamPolicies.MatchParent makes View fill to its parent
only if the View sets its Layout.

If View uses LayoutParamPolicies.WrapContent or MatchParent while it
does not set its Layout, then the View does not fit to its children nor
fill to its parent.
Instead, ResizePolicyType.UseNaturalSize is supported by default.

src/Tizen.NUI/src/public/BaseComponents/Style/ViewStyle.cs
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/Common/NUIConstants.cs

index 5a32e62..4a8986f 100755 (executable)
@@ -247,7 +247,7 @@ namespace Tizen.NUI.BaseComponents
         /// Gets or sets the width resize policy to be used.
         /// </summary>
         /// <since_tizen> 9 </since_tizen>
-        [Obsolete("Deprecated. Please use Tizen.NUI.View.WidthSpecification instead.")]
+        [Obsolete("Deprecated. Please set Tizen.NUI.View.Layout and use Tizen.NUI.View.WidthSpecification instead.")]
         public ResizePolicyType? WidthResizePolicy
         {
             get => (ResizePolicyType?)GetValue(WidthResizePolicyProperty);
@@ -258,7 +258,7 @@ namespace Tizen.NUI.BaseComponents
         /// Gets or sets the height resize policy to be used.
         /// </summary>
         /// <since_tizen> 9 </since_tizen>
-        [Obsolete("Deprecated. Please use Tizen.NUI.View.HeightSpecification instead.")]
+        [Obsolete("Deprecated. Please set Tizen.NUI.View.Layout and use Tizen.NUI.View.HeightSpecification instead.")]
         public ResizePolicyType? HeightResizePolicy
         {
             get => (ResizePolicyType?)GetValue(HeightResizePolicyProperty);
index bf767c9..2287381 100755 (executable)
@@ -1705,7 +1705,7 @@ namespace Tizen.NUI.BaseComponents
         /// Gets or sets the width resize policy to be used.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        [Obsolete("Deprecated. Please use WidthSpecification instead.")]
+        [Obsolete("Deprecated. Please set Layout and use WidthSpecification instead.")]
         public ResizePolicyType WidthResizePolicy
         {
             get
@@ -1723,7 +1723,7 @@ namespace Tizen.NUI.BaseComponents
         /// Gets or sets the height resize policy to be used.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        [Obsolete("Deprecated. Please use HeightSpecification instead.")]
+        [Obsolete("Deprecated. Please set Layout and use HeightSpecification instead.")]
         public ResizePolicyType HeightResizePolicy
         {
             get
@@ -2160,19 +2160,6 @@ namespace Tizen.NUI.BaseComponents
                         Size2D = new Size2D(widthPolicy, heightPolicy);
                     }
                 }
-                else
-                {
-                    if (value == LayoutParamPolicies.MatchParent)
-                    {
-                        SetValue(WidthResizePolicyProperty, ResizePolicyType.FillToParent);
-                        NotifyPropertyChanged();
-                    }
-                    else if (value == LayoutParamPolicies.WrapContent)
-                    {
-                        SetValue(WidthResizePolicyProperty, ResizePolicyType.FitToChildren);
-                        NotifyPropertyChanged();
-                    }
-                }
                 layout?.RequestLayout();
             }
         }
@@ -2216,19 +2203,6 @@ namespace Tizen.NUI.BaseComponents
                         Size2D = new Size2D(widthPolicy, heightPolicy);
                     }
                 }
-                else
-                {
-                    if (value == LayoutParamPolicies.MatchParent)
-                    {
-                        SetValue(HeightResizePolicyProperty, ResizePolicyType.FillToParent);
-                        NotifyPropertyChanged();
-                    }
-                    else if (value == LayoutParamPolicies.WrapContent)
-                    {
-                        SetValue(HeightResizePolicyProperty, ResizePolicyType.FitToChildren);
-                        NotifyPropertyChanged();
-                    }
-                }
                 layout?.RequestLayout();
             }
         }
index 3640e0d..86b588f 100755 (executable)
@@ -136,7 +136,7 @@ namespace Tizen.NUI
     /// Enumeration for size negotiation resize policies.
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
-    [Obsolete("Deprecated. Please use Tizen.NUI.BaseComponents.LayoutParamPolicies instead.")]
+    [Obsolete("Deprecated. Please set Tizen.NUI.View.Layout and use Tizen.NUI.BaseComponents.LayoutParamPolicies instead.")]
     public enum ResizePolicyType
     {
         /// <summary>
@@ -156,7 +156,7 @@ namespace Tizen.NUI
         /// Size is to fill up to the actor's parent's bounds. Aspect ratio is not maintained.
         /// </summary>
         [Description("FILL_TO_PARENT")]
-        [Obsolete("Deprecated. Instead, please set Tizen.NUI.BaseComponents.LayoutParamPolicies.MatchParent to Tizen.NUI.View.WidthSpecification or Tizen.NUI.View.HeightSpecification.")]
+        [Obsolete("Deprecated. Instead, please set Tizen.NUI.View.Layout and also set Tizen.NUI.BaseComponents.LayoutParamPolicies.MatchParent to Tizen.NUI.View.WidthSpecification or Tizen.NUI.View.HeightSpecification.")]
         FillToParent,
         /// <summary>
         /// The actors size will be ( ParentSize * SizeRelativeToParentFactor ).
@@ -174,7 +174,7 @@ namespace Tizen.NUI
         /// The size will adjust to wrap around all children.
         /// </summary>
         [Description("FIT_TO_CHILDREN")]
-        [Obsolete("Deprecated. Instead, please set Tizen.NUI.BaseComponents.LayoutParamPolicies.WrapContent to Tizen.NUI.View.WidthSpecification or Tizen.NUI.View.HeightSpecification.")]
+        [Obsolete("Deprecated. Instead, please set Tizen.NUI.View.Layout and also set Tizen.NUI.BaseComponents.LayoutParamPolicies.WrapContent to Tizen.NUI.View.WidthSpecification or Tizen.NUI.View.HeightSpecification.")]
         FitToChildren,
         /// <summary>
         /// One dimension is dependent on the other.