Revert "[NUI] Button text ellipsis enabled and etc. (#2772)" (#2858)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Thu, 8 Apr 2021 01:10:34 +0000 (10:10 +0900)
committerGitHub <noreply@github.com>
Thu, 8 Apr 2021 01:10:34 +0000 (10:10 +0900)
This reverts commit 86409caf7bffd2b7b3e0aa7a827a51b449938b1e.

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
src/Tizen.NUI.Components/Controls/Button.Internal.cs
src/Tizen.NUI.Components/Controls/Button.cs
src/Tizen.NUI.Components/Controls/Switch.cs

index 6109be4..c6ef247 100755 (executable)
@@ -69,7 +69,7 @@ namespace Tizen.NUI.Components
             {
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
-                AccessibilityHighlightable = false,
+                AccessibilityHighlightable = false
             };
         }
 
@@ -274,8 +274,6 @@ namespace Tizen.NUI.Components
 
             buttonText = CreateText();
             buttonIcon = CreateIcon();
-            buttonText.Relayout += OnTextRelayout;
-            buttonIcon.Relayout += OnIconRelayout;
             LayoutItems();
 
 #if PROFILE_MOBILE
@@ -371,64 +369,6 @@ namespace Tizen.NUI.Components
             }
         }
 
-        private void OnTextOrIconUpdated()
-        {
-            if (buttonIcon == null || buttonText == null)
-            {
-                return;
-            }
-
-            float lengthWithoutText = 0;
-
-            if (iconPadding == null || buttonIcon.Size.Width == 0 || buttonIcon.Size.Height == 0)
-            {
-                buttonIcon.Margin = new Extents(0);
-                lengthWithoutText = buttonIcon.Size.Width;
-            }
-            else if (iconRelativeOrientation == IconOrientation.Left || iconRelativeOrientation == IconOrientation.Right)
-            {
-                buttonIcon.Margin = new Extents(iconPadding.Start, iconPadding.End, 0, 0);
-                lengthWithoutText = iconPadding.Start + iconPadding.End + buttonIcon.Size.Width;
-            }
-            else
-            {
-                buttonIcon.Margin = new Extents(0, 0, iconPadding.Top, iconPadding.Bottom);
-            }
-
-            if (textPadding == null || buttonText.Size.Width == 0 || buttonText.Size.Height == 0)
-            {
-                buttonText.Margin = new Extents(0);
-            }
-            else 
-            {
-                if (iconRelativeOrientation == IconOrientation.Left || iconRelativeOrientation == IconOrientation.Right)
-                {
-                    buttonText.Margin = new Extents(textPadding.Start, textPadding.End, 0, 0);
-                    lengthWithoutText += textPadding.Start + textPadding.End;
-                }
-                else
-                {
-                    buttonText.Margin = new Extents(0, 0, textPadding.Top, textPadding.Bottom);
-                }
-            }
-
-            // If the button has fixed width and the text is not empty, the text should not exceed button boundary.
-            if (WidthSpecification >= 0 && !String.IsNullOrEmpty(buttonText.Text))
-            {
-                buttonText.MaximumSize = new Size2D(Math.Max(WidthSpecification - (int)lengthWithoutText, Math.Max((int)buttonText.MinimumSize.Width, 1)), HeightSpecification);
-            }
-        }
-
-        private void OnIconRelayout(object sender, EventArgs args)
-        {
-            OnTextOrIconUpdated();
-        }
-
-        private void OnTextRelayout(object sender, EventArgs args)
-        {
-            OnTextOrIconUpdated();
-        }
-
         private void OnClickedInternal(ClickedEventArgs eventArgs)
         {
             Command?.Execute(CommandParameter);
index a10fd20..2e466df 100755 (executable)
@@ -128,7 +128,10 @@ namespace Tizen.NUI.Components
         {
             var instance = (Button)bindable;
             instance.iconPadding = (Extents)((Extents)newValue).Clone();
-            instance.OnTextOrIconUpdated();
+            if (instance.buttonIcon != null)
+            {
+                instance.buttonIcon.Margin = instance.iconPadding;
+            }
         },
         defaultValueCreator: (bindable) => ((Button)bindable).iconPadding);
 
@@ -138,7 +141,10 @@ namespace Tizen.NUI.Components
         {
             var instance = (Button)bindable;
             instance.textPadding = (Extents)((Extents)newValue).Clone();
-            instance.OnTextOrIconUpdated();
+            if (instance.buttonText != null)
+            {
+                instance.buttonText.Margin = instance.textPadding;
+            }
         },
         defaultValueCreator: (bindable) => ((Button)bindable).textPadding);
 
@@ -731,15 +737,9 @@ namespace Tizen.NUI.Components
                 if (Extension != null)
                 {
                     buttonIcon.Unparent();
-                    buttonIcon.Relayout -= OnIconRelayout;
-                    buttonIcon = Extension.OnCreateIcon(this, buttonIcon);
-                    buttonIcon.Relayout += OnIconRelayout;
-
                     buttonText.Unparent();
-                    buttonText.Relayout -= OnTextRelayout;
+                    buttonIcon = Extension.OnCreateIcon(this, buttonIcon);
                     buttonText = Extension.OnCreateText(this, buttonText);
-                    buttonText.Relayout += OnTextRelayout;
-
                     LayoutItems();
                 }
 
index 80d8ca7..b0efa7b 100755 (executable)
@@ -65,10 +65,7 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public override void OnInitialize()
         {
-            track = new ImageView()
-            {
-                EnableControlStatePropagation = true
-            };
+            track = new ImageView();
             thumb = new ImageView();
             track.Add(thumb);