[NUI] Change button APIs and modify related Samples (#1712)
authorzhouleonlei <56956725+zhouleonlei@users.noreply.github.com>
Tue, 16 Jun 2020 05:38:08 +0000 (13:38 +0800)
committerGitHub <noreply@github.com>
Tue, 16 Jun 2020 05:38:08 +0000 (13:38 +0800)
src/Tizen.NUI.Components/Controls/Button.cs
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/ButtonSample.cs
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/CheckBoxSample.cs
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/DropDownSample.cs
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/PopupSample.cs
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/RadioButtonSample.cs
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/TabSample.cs

index 1d478d7..0cc313e 100755 (executable)
@@ -266,7 +266,7 @@ namespace Tizen.NUI.Components
         /// Button's icon part.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public ImageView ButtonIcon
+        public ImageView Icon
         {
             get
             {
@@ -292,7 +292,7 @@ namespace Tizen.NUI.Components
         /// Button's overlay image part.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public ImageView ButtonOverlay
+        public ImageView OverlayImage
         {
             get
             {
@@ -319,7 +319,7 @@ namespace Tizen.NUI.Components
         /// Button's text part.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public TextLabel ButtonText
+        public TextLabel TextLabel
         {
             get
             {
@@ -761,17 +761,17 @@ namespace Tizen.NUI.Components
             {
                 Extension?.OnDispose(this);
 
-                if (ButtonIcon != null)
+                if (Icon != null)
                 {
-                    Utility.Dispose(ButtonIcon);
+                    Utility.Dispose(Icon);
                 }
-                if (ButtonText != null)
+                if (TextLabel != null)
                 {
-                    Utility.Dispose(ButtonText);
+                    Utility.Dispose(TextLabel);
                 }
-                if (ButtonOverlay != null)
+                if (OverlayImage != null)
                 {
-                    Utility.Dispose(ButtonOverlay);
+                    Utility.Dispose(OverlayImage);
                 }
             }
 
@@ -916,17 +916,17 @@ namespace Tizen.NUI.Components
                 Extension = buttonStyle.CreateExtension();
                 if (buttonStyle.Overlay != null)
                 {
-                    ButtonOverlay?.ApplyStyle(buttonStyle.Overlay);
+                    OverlayImage?.ApplyStyle(buttonStyle.Overlay);
                 }
 
                 if (buttonStyle.Text != null)
                 {
-                    ButtonText?.ApplyStyle(buttonStyle.Text);
+                    TextLabel?.ApplyStyle(buttonStyle.Text);
                 }
 
                 if (buttonStyle.Icon != null)
                 {
-                    ButtonIcon?.ApplyStyle(buttonStyle.Icon);
+                    Icon?.ApplyStyle(buttonStyle.Icon);
                 }
             }
         }
@@ -1028,12 +1028,12 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected virtual void MeasureText()
         {
-            if (Style.IconRelativeOrientation == null || ButtonIcon == null || ButtonText == null)
+            if (Style.IconRelativeOrientation == null || Icon == null || TextLabel == null)
             {
                 return;
             }
-            ButtonText.WidthResizePolicy = ResizePolicyType.Fixed;
-            ButtonText.HeightResizePolicy = ResizePolicyType.Fixed;
+            TextLabel.WidthResizePolicy = ResizePolicyType.Fixed;
+            TextLabel.HeightResizePolicy = ResizePolicyType.Fixed;
             int textPaddingStart = Style.TextPadding.Start;
             int textPaddingEnd = Style.TextPadding.End;
             int textPaddingTop = Style.TextPadding.Top;
@@ -1046,13 +1046,13 @@ namespace Tizen.NUI.Components
 
             if (IconRelativeOrientation == IconOrientation.Top || IconRelativeOrientation == IconOrientation.Bottom)
             {
-                ButtonText.SizeWidth = SizeWidth - textPaddingStart - textPaddingEnd;
-                ButtonText.SizeHeight = SizeHeight - textPaddingTop - textPaddingBottom - iconPaddingTop - iconPaddingBottom - ButtonIcon.SizeHeight;
+                TextLabel.SizeWidth = SizeWidth - textPaddingStart - textPaddingEnd;
+                TextLabel.SizeHeight = SizeHeight - textPaddingTop - textPaddingBottom - iconPaddingTop - iconPaddingBottom - Icon.SizeHeight;
             }
             else
             {
-                ButtonText.SizeWidth = SizeWidth - textPaddingStart - textPaddingEnd - iconPaddingStart - iconPaddingEnd - ButtonIcon.SizeWidth;
-                ButtonText.SizeHeight = SizeHeight - textPaddingTop - textPaddingBottom;
+                TextLabel.SizeWidth = SizeWidth - textPaddingStart - textPaddingEnd - iconPaddingStart - iconPaddingEnd - Icon.SizeWidth;
+                TextLabel.SizeHeight = SizeHeight - textPaddingTop - textPaddingBottom;
             }
         }
         /// <summary>
@@ -1063,13 +1063,13 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected virtual void LayoutChild()
         {
-            if (Style.IconRelativeOrientation == null || ButtonIcon == null || ButtonText == null)
+            if (Style.IconRelativeOrientation == null || Icon == null || TextLabel == null)
             {
                 return;
             }
 
-            var buttonIcon = ButtonIcon;
-            var buttonText = ButtonText;
+            var buttonIcon = Icon;
+            var buttonText = TextLabel;
 
             int textPaddingStart = Style.TextPadding.Start;
             int textPaddingEnd = Style.TextPadding.End;
@@ -1243,7 +1243,7 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public TextLabel GetCurrentText(ButtonExtension extension)
         {
-            return (extension == Extension) ? ButtonText : null;
+            return (extension == Extension) ? TextLabel : null;
         }
 
         /// <summary>
@@ -1257,7 +1257,7 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public ImageView GetCurrentIcon(ButtonExtension extension)
         {
-            return (extension == Extension) ? ButtonIcon : null;
+            return (extension == Extension) ? Icon : null;
         }
 
         /// <summary>
@@ -1271,7 +1271,7 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public ImageView GetCurrentOverlayImage(ButtonExtension extension)
         {
-            return (extension == Extension) ? ButtonOverlay : null;
+            return (extension == Extension) ? OverlayImage : null;
         }
     }
 }
index f306f57..30fd978 100755 (executable)
@@ -69,7 +69,7 @@ namespace Tizen.NUI.Samples
             textButton.BackgroundImage = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
             textButton.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
             textButton.Size = new Size(300, 80);
-            textButton.ButtonText.Text = "Button";
+            textButton.TextLabel.Text = "Button";
             parent1.Add(textButton);
 
             //Only show an icon button.
@@ -79,10 +79,10 @@ namespace Tizen.NUI.Samples
             iconButton.BackgroundImage = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
             iconButton.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
             iconButton.Size = new Size(80, 80);
-            iconButton.ButtonIcon.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_radiobutton/c_radiobutton_white_check.png";
+            iconButton.Icon.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_radiobutton/c_radiobutton_white_check.png";
             parent2.Add(iconButton);
             iconButton.ClickEvent += (ojb, e) => {
-                var btn = iconButton.ButtonIcon.GetParent() as Button;
+                var btn = iconButton.Icon.GetParent() as Button;
                 string name = btn.Name;
             };
 
@@ -103,7 +103,7 @@ namespace Tizen.NUI.Samples
             iconTextButton.BackgroundImage = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
             iconTextButton.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
             iconTextButton.IconRelativeOrientation = Button.IconOrientation.Left;
-            iconTextButton.ButtonIcon.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_radiobutton/c_radiobutton_white_check.png";
+            iconTextButton.Icon.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_radiobutton/c_radiobutton_white_check.png";
             iconTextButton.IconPadding = new Extents(20, 20, 20, 20);
             iconTextButton.TextPadding = new Extents(20, 50, 20, 20);
             iconTextButton.Size = new Size(500, 300);
@@ -227,7 +227,7 @@ namespace Tizen.NUI.Samples
                 Url = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png",
                 Border = new Rectangle(5, 5, 5, 5)
             };
-            utilityToggleButton.ButtonOverlay.Border = new Rectangle(5, 5, 5, 5);
+            utilityToggleButton.OverlayImage.Border = new Rectangle(5, 5, 5, 5);
 
             utilityToggleButton.Size = new Size(300, 80);
             parent1.Add(utilityToggleButton);
@@ -263,10 +263,10 @@ namespace Tizen.NUI.Samples
                 Url = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_shadow.png",
                 Border = new Rectangle(5, 5, 5, 5)
             };
-            utilityOvalButton.ButtonOverlay.Border = new Rectangle(5, 5, 5, 5);
+            utilityOvalButton.OverlayImage.Border = new Rectangle(5, 5, 5, 5);
 
             utilityOvalButton.Size = new Size(104, 104);
-            utilityOvalButton.ButtonText.PointSize = 20;
+            utilityOvalButton.TextLabel.PointSize = 20;
             parent1.Add(utilityOvalButton);
 
             ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
@@ -449,10 +449,10 @@ namespace Tizen.NUI.Samples
                         iconTextButton.IconRelativeOrientation = Button.IconOrientation.Left;
                         break;
                     case "5":
-                        iconTextButton.ButtonIcon.Padding.Start = 50;
+                        iconTextButton.Icon.Padding.Start = 50;
                         break;
                     case "6":
-                        iconTextButton.ButtonIcon.Padding.End = 50;
+                        iconTextButton.Icon.Padding.End = 50;
                         break;
                     case "7":
                         iconTextButton.LayoutDirection = ViewLayoutDirectionType.RTL;
index 3d05d3c..b15ceaa 100755 (executable)
@@ -120,7 +120,7 @@ namespace Tizen.NUI.Samples
 
                 utilityCheckBox[i].Size = new Size(48, 48);
                 utilityCheckBox[i].Margin = new Extents(76, 76, 25, 25);
-                utilityCheckBox[i].ButtonIcon.Size = new Size(48, 48);
+                utilityCheckBox[i].Icon.Size = new Size(48, 48);
 
                 group[0].Add(utilityCheckBox[i]);
                 //Create family radio button.
@@ -145,7 +145,7 @@ namespace Tizen.NUI.Samples
 
                 familyCheckBox[i].Size = new Size(48, 48);
                 familyCheckBox[i].Margin = new Extents(76, 76, 25, 25);
-                familyCheckBox[i].ButtonIcon.Size = new Size(48, 48);
+                familyCheckBox[i].Icon.Size = new Size(48, 48);
                 group[1].Add(familyCheckBox[i]);
                 //Create food radio button.
                 foodCheckBox[i] = new CheckBox();
@@ -168,7 +168,7 @@ namespace Tizen.NUI.Samples
                 foodCheckBox[i].ApplyStyle(foodStyle);
                 foodCheckBox[i].Size = new Size(48, 48);
                 familyCheckBox[i].Margin = new Extents(76, 76, 25, 25);
-                foodCheckBox[i].ButtonIcon.Size = new Size(48, 48);
+                foodCheckBox[i].Icon.Size = new Size(48, 48);
 
                 group[2].Add(foodCheckBox[i]);
                 //Create kitchen radio button.
@@ -193,7 +193,7 @@ namespace Tizen.NUI.Samples
                 kitchenCheckBox[i].WidthSpecification = 48;
                 kitchenCheckBox[i].HeightSpecification = 48;
                 kitchenCheckBox[i].Margin = new Extents(76, 76, 25, 25);
-                kitchenCheckBox[i].ButtonIcon.Size = new Size(48, 48);
+                kitchenCheckBox[i].Icon.Size = new Size(48, 48);
 
                 group[3].Add(kitchenCheckBox[i]);
 
index c4b97cb..4e78a00 100755 (executable)
@@ -85,8 +85,8 @@ namespace Tizen.NUI.Samples
             dropDown.HeaderText.PointSize = 28;
             dropDown.HeaderText.FontFamily = "SamsungOneUI 500C";
             dropDown.HeaderText.PositionX = 50;
-            dropDown.Button.ButtonText.Text = "DropDown Text";
-            dropDown.Button.ButtonIcon.Size = new Size(48, 48);
+            dropDown.Button.TextLabel.Text = "DropDown Text";
+            dropDown.Button.Icon.Size = new Size(48, 48);
             dropDown.Button.IconRelativeOrientation = Button.IconOrientation.Right;
             dropDown.Button.ParentOrigin = ParentOrigin.CenterLeft;
             dropDown.Button.PivotPoint = PivotPoint.CenterLeft;
index f919549..177be52 100755 (executable)
@@ -224,7 +224,7 @@ namespace Tizen.NUI.Samples
             button.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
             button.WidthSpecification = 580;
             button.HeightSpecification = 80;
-            button.ButtonText.Text = "LayoutDirection is left to right";
+            button.TextLabel.Text = "LayoutDirection is left to right";
             button.ClickEvent += ButtonClickEvent;
 
             parent1.Add(parent2);
@@ -284,13 +284,13 @@ namespace Tizen.NUI.Samples
             {
                 popup.LayoutDirection = ViewLayoutDirectionType.RTL;
                 popup2.LayoutDirection = ViewLayoutDirectionType.RTL;
-                button.ButtonText.Text = "LayoutDirection is right to left";
+                button.TextLabel.Text = "LayoutDirection is right to left";
             }
             else
             {
                 popup.LayoutDirection = ViewLayoutDirectionType.LTR;
                 popup2.LayoutDirection = ViewLayoutDirectionType.LTR;
-                button.ButtonText.Text = "LayoutDirection is left to right";
+                button.TextLabel.Text = "LayoutDirection is left to right";
             }           
         }
 
index cad3352..ec4170a 100755 (executable)
@@ -107,7 +107,7 @@ namespace Tizen.NUI.Samples
                 };
                 utilityRadioButton[i].ApplyStyle(utilityStyle);
                 utilityRadioButton[i].Size = new Size(48, 48);
-                utilityRadioButton[i].ButtonIcon.Size = new Size(48, 48);
+                utilityRadioButton[i].Icon.Size = new Size(48, 48);
                 group[0].Add(utilityRadioButton[i]);
 
                 // create family radio button.
@@ -130,7 +130,7 @@ namespace Tizen.NUI.Samples
                 };
                 familyRadioButton[i].ApplyStyle(familyStyle);
                 familyRadioButton[i].Size = new Size(48, 48);
-                familyRadioButton[i].ButtonIcon.Size = new Size(48, 48);
+                familyRadioButton[i].Icon.Size = new Size(48, 48);
 
                 group[1].Add(familyRadioButton[i]);
 
@@ -154,7 +154,7 @@ namespace Tizen.NUI.Samples
                 };
                 foodRadioButton[i].ApplyStyle(foodStyle);
                 foodRadioButton[i].Size = new Size(150, 48);
-                foodRadioButton[i].ButtonIcon.Size = new Size(48, 48);
+                foodRadioButton[i].Icon.Size = new Size(48, 48);
 
                 group[2].Add(foodRadioButton[i]);
 
@@ -178,7 +178,7 @@ namespace Tizen.NUI.Samples
                 };
                 kitchenRadioButton[i].ApplyStyle(kitchenStyle);
                 kitchenRadioButton[i].Size = new Size(48, 48);
-                kitchenRadioButton[i].ButtonIcon.Size = new Size(48, 48);
+                kitchenRadioButton[i].Icon.Size = new Size(48, 48);
 
                 group[3].Add(kitchenRadioButton[i]);
 
index 1bd506f..5ab9bd2 100755 (executable)
@@ -187,14 +187,14 @@ namespace Tizen.NUI.Samples
             // Button of switching mode
             button = new Button(buttonStyle);
             button.Size = new Size(500, 80);
-            button.ButtonText.Text = mode[index];
+            button.TextLabel.Text = mode[index];
             button.ClickEvent += ButtonClickEvent;
             parentView[2].Add(button);
 
             // Button of LayoutDirection
             button2 = new Button(buttonStyle);
             button2.Size = new Size(500, 80);
-            button2.ButtonText.Text = "LayoutDirection is left to right";
+            button2.TextLabel.Text = "LayoutDirection is left to right";
             button2.ClickEvent += ButtonClickEvent2;
             parentView[2].Add(button2);
         }
@@ -267,7 +267,7 @@ namespace Tizen.NUI.Samples
         private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
         {
             index = (index + 1) % 4;
-            button.ButtonText.Text = mode[index];
+            button.TextLabel.Text = mode[index];
             tab.Underline.BackgroundColor = color[index];
             tab.TextColorSelector = new ColorSelector
             {
@@ -288,13 +288,13 @@ namespace Tizen.NUI.Samples
             {
                 tab.LayoutDirection = ViewLayoutDirectionType.RTL;
                 tab2.LayoutDirection = ViewLayoutDirectionType.RTL;
-                button2.ButtonText.Text = "LayoutDirection is right to left";
+                button2.TextLabel.Text = "LayoutDirection is right to left";
             }
             else
             {
                 tab.LayoutDirection = ViewLayoutDirectionType.LTR;
                 tab2.LayoutDirection = ViewLayoutDirectionType.LTR;
-                button2.ButtonText.Text = "LayoutDirection is left to right";
+                button2.TextLabel.Text = "LayoutDirection is left to right";
             }
         }
     }