[NUI] Delete Tizen.NUI.Components build warnings (#2674)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / Button.cs
index b8e106a..c566f66 100755 (executable)
@@ -19,10 +19,30 @@ using System.ComponentModel;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Binding;
 using Tizen.NUI.Components.Extension;
+using Tizen.NUI.Accessibility;
 
 namespace Tizen.NUI.Components
 {
     /// <summary>
+    /// ClickedEventArgs is a class to record button click event arguments which will sent to user.
+    /// </summary>
+    /// <since_tizen> 8 </since_tizen>
+    public class ClickedEventArgs : EventArgs
+    {
+    }
+
+    /// <summary>
+    /// SelectedChangedEventArgs is a class to record item selected arguments which will sent to user.
+    /// </summary>
+    /// <since_tizen> 8 </since_tizen>
+    public class SelectedChangedEventArgs : EventArgs
+    {
+        /// <summary> Selected state </summary>
+        /// <since_tizen> 8 </since_tizen>
+        public bool IsSelected { get; set; }
+    }
+
+    /// <summary>
     /// Button is one kind of common component, a button clearly describes what action will occur when the user selects it.
     /// Button may contain text or an icon.
     /// </summary>
@@ -34,20 +54,16 @@ namespace Tizen.NUI.Components
         public static readonly BindableProperty IconRelativeOrientationProperty = BindableProperty.Create(nameof(IconRelativeOrientation), typeof(IconOrientation?), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = (Button)bindable;
-            if (newValue != null)
+            var newIconOrientation = (IconOrientation?)newValue;
+            if (instance.iconRelativeOrientation != newIconOrientation)
             {
-                if (instance.Style != null && instance.Style.IconRelativeOrientation != (IconOrientation?)newValue)
-                {
-                    instance.Style.IconRelativeOrientation = (IconOrientation?)newValue;
-                    instance.UpdateUIContent();
-                }
+                instance.iconRelativeOrientation = newIconOrientation;
+                instance.UpdateUIContent();
             }
         },
-        defaultValueCreator: (bindable) =>
-        {
-            var instance = (Button)bindable;
-            return instance.Style?.IconRelativeOrientation;
-        });
+        defaultValueCreator: (bindable) => ((Button)bindable).iconRelativeOrientation
+        );
+
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create(nameof(IsEnabled), typeof(bool), typeof(Button), true, propertyChanged: (bindable, oldValue, newValue) =>
@@ -55,15 +71,21 @@ namespace Tizen.NUI.Components
             var instance = (Button)bindable;
             if (newValue != null)
             {
-                instance.isEnabled = (bool)newValue;
-                instance.UpdateState();
+                bool newEnabled = (bool)newValue;
+                if (instance.isEnabled != newEnabled)
+                {
+                    instance.isEnabled = newEnabled;
+
+                    if (instance.buttonStyle != null)
+                    {
+                        instance.buttonStyle.IsEnabled = newEnabled;
+                    }
+
+                    instance.UpdateState();
+                }
             }
         },
-        defaultValueCreator: (bindable) =>
-        {
-            var instance = (Button)bindable;
-            return instance.isEnabled;
-        });
+        defaultValueCreator: (bindable) => ((Button)bindable).isEnabled);
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty IsSelectedProperty = BindableProperty.Create(nameof(IsSelected), typeof(bool), typeof(Button), true, propertyChanged: (bindable, oldValue, newValue) =>
@@ -71,14 +93,27 @@ namespace Tizen.NUI.Components
             var instance = (Button)bindable;
             if (newValue != null)
             {
-                instance.isSelected = (bool)newValue;
-                instance.UpdateState();
+                bool newSelected = (bool)newValue;
+                if (instance.isSelected != newSelected)
+                {
+                    instance.isSelected = newSelected;
+
+                    if (instance.buttonStyle != null)
+                    {
+                        instance.buttonStyle.IsSelected = newSelected;
+                    }
+
+                    if (instance.isSelectable)
+                    {
+                        instance.UpdateState();
+                    }
+                }
             }
         },
         defaultValueCreator: (bindable) =>
         {
             var instance = (Button)bindable;
-            return instance.isSelected;
+            return instance.isSelectable && instance.isSelected;
         });
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -87,46 +122,48 @@ namespace Tizen.NUI.Components
             var instance = (Button)bindable;
             if (newValue != null)
             {
-                instance.Style.IsSelectable = (bool)newValue;
+                bool newSelectable = (bool)newValue;
+                if (instance.isSelectable != newSelectable)
+                {
+                    instance.isSelectable = newSelectable;
+
+                    if (instance.buttonStyle != null)
+                    {
+                        instance.buttonStyle.IsSelectable = newSelectable;
+                    }
+
+                    instance.UpdateState();
+                }
             }
         },
-        defaultValueCreator: (bindable) =>
-        {
-            var instance = (Button)bindable;
-            return instance.Style?.IsSelectable ?? false;
-        });
+        defaultValueCreator: (bindable) => ((Button)bindable).isSelectable);
+
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty IconPaddingProperty = BindableProperty.Create(nameof(IconPadding), typeof(Extents), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = (Button)bindable;
-            if (null != newValue && null != instance.Style?.IconPadding)
-            {
-                instance.Style.IconPadding.CopyFrom((Extents)newValue);
-                instance.UpdateUIContent();
-            }
+            instance.iconPadding = (Extents)((Extents)newValue).Clone();
+            instance.UpdateUIContent();
         },
-        defaultValueCreator: (bindable) =>
-        {
-            var instance = (Button)bindable;
-            return instance.Style?.IconPadding;
-        });
+        defaultValueCreator: (bindable) => ((Button)bindable).iconPadding);
+
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty TextPaddingProperty = BindableProperty.Create(nameof(TextPadding), typeof(Extents), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = (Button)bindable;
-            if (null != newValue && null != instance.Style?.TextPadding)
-            {
-                instance.Style.TextPadding.CopyFrom((Extents)newValue);
-                instance.UpdateUIContent();
-            }
+            instance.textPadding = (Extents)((Extents)newValue).Clone();
+            instance.UpdateUIContent();
         },
-        defaultValueCreator: (bindable) =>
-        {
-            var instance = (Button)bindable;
-            return instance.Style?.TextPadding;
-        });
+        defaultValueCreator: (bindable) => ((Button)bindable).textPadding);
+
+        private IconOrientation? iconRelativeOrientation;
+        private bool isSelected = false;
+        private bool isSelectable = false;
+        private bool isEnabled = true;
+        private Extents iconPadding;
+        private Extents textPadding;
 
         static Button() { }
 
@@ -163,21 +200,29 @@ namespace Tizen.NUI.Components
         /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
+        [Obsolete("Deprecated in API8; Will be removed in API10. Please use Clicked event instead.")]
         public event EventHandler<ClickEventArgs> ClickEvent;
 
         /// <summary>
+        /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.
+        /// </summary>
+        /// <since_tizen> 8 </since_tizen>
+        public event EventHandler<ClickedEventArgs> Clicked;
+
+        /// <summary>
         /// An event for the button state changed signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
+        [Obsolete("Deprecated in API8; Will be removed in API10. Please use View.ControlStateChangedEvent")]
         public event EventHandler<StateChangedEventArgs> StateChangedEvent
         {
             add
             {
-                stateChangeHander += value;
+                stateChangeHandler += value;
             }
             remove
             {
-                stateChangeHander -= value;
+                stateChangeHandler -= value;
             }
         }
 
@@ -212,7 +257,7 @@ namespace Tizen.NUI.Components
         /// <summary>
         /// Button's icon part.
         /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 8 </since_tizen>
         public ImageView Icon
         {
             get
@@ -224,8 +269,11 @@ namespace Tizen.NUI.Components
                     {
                         buttonIcon = Extension.OnCreateIcon(this, buttonIcon);
                     }
-                    Add(buttonIcon);
-                    buttonIcon.Relayout += OnIconRelayout;
+                    if (null != buttonIcon)
+                    {
+                        Add(buttonIcon);
+                        buttonIcon.Relayout += OnIconRelayout;
+                    }
                 }
                 return buttonIcon;
             }
@@ -238,7 +286,7 @@ namespace Tizen.NUI.Components
         /// <summary>
         /// Button's overlay image part.
         /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 8 </since_tizen>
         public ImageView OverlayImage
         {
             get
@@ -250,9 +298,10 @@ namespace Tizen.NUI.Components
                     {
                         overlayImage = Extension.OnCreateOverlayImage(this, overlayImage);
                     }
-                    overlayImage.WidthResizePolicy = ResizePolicyType.FillToParent;
-                    overlayImage.HeightResizePolicy = ResizePolicyType.FillToParent;
-                    Add(overlayImage);
+                    if (null != overlayImage)
+                    {
+                        Add(overlayImage);
+                    }
                 }
                 return overlayImage;
             }
@@ -265,7 +314,7 @@ namespace Tizen.NUI.Components
         /// <summary>
         /// Button's text part.
         /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 8 </since_tizen>
         public TextLabel TextLabel
         {
             get
@@ -277,15 +326,17 @@ namespace Tizen.NUI.Components
                     {
                         buttonText = Extension.OnCreateText(this, buttonText);
                     }
-                    buttonText.HorizontalAlignment = HorizontalAlignment.Center;
-                    buttonText.VerticalAlignment = VerticalAlignment.Center;
-                    Add(buttonText);
+                    if (null != buttonText)
+                    {
+                        Add(buttonText);
+                    }
                 }
                 return buttonText;
             }
             internal set
             {
                 buttonText = value;
+                AccessibilityManager.Instance.SetAccessibilityAttribute(this, AccessibilityManager.AccessibilityAttribute.Label, buttonText.Text);
             }
         }
 
@@ -297,7 +348,18 @@ namespace Tizen.NUI.Components
         /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
         /// </remarks>
         /// <since_tizen> 8 </since_tizen>
-        public new ButtonStyle Style => ViewStyle as ButtonStyle;
+        public new ButtonStyle Style
+        {
+            get
+            {
+                var result = (ButtonStyle)ViewStyle.Clone();
+                result.CopyPropertiesFromView(this);
+                result.Text.CopyPropertiesFromView(TextLabel);
+                result.Icon.CopyPropertiesFromView(Icon);
+                result.Overlay.CopyPropertiesFromView(OverlayImage);
+                return result;
+            }
+        }
 
         /// <summary>
         /// The text of Button.
@@ -307,14 +369,11 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return Style?.Text?.Text?.GetValue(ControlState);
+                return TextLabel.Text;
             }
             set
             {
-                if (null != Style?.Text)
-                {
-                    Style.Text.Text = value;
-                }
+                TextLabel.Text = value;
             }
         }
 
@@ -342,14 +401,11 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return Style?.Text?.TranslatableText?.All;
+                return TextLabel.TranslatableText;
             }
             set
             {
-                if (null != Style?.Text)
-                {
-                    Style.Text.TranslatableText = value;
-                }
+                TextLabel.TranslatableText = value;
             }
         }
 
@@ -361,14 +417,11 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return Style?.Text?.PointSize?.All ?? 0;
+                return TextLabel.PointSize;
             }
             set
             {
-                if (null != Style?.Text)
-                {
-                    Style.Text.PointSize = value;
-                }
+                TextLabel.PointSize = value;
             }
         }
 
@@ -380,14 +433,11 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return Style?.Text?.FontFamily.All;
+                return TextLabel.FontFamily;
             }
             set
             {
-                if (null != Style?.Text)
-                {
-                    Style.Text.FontFamily = value;
-                }
+                TextLabel.FontFamily = value;
             }
         }
 
@@ -399,14 +449,11 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return Style?.Text?.TextColor?.All;
+                return TextLabel.TextColor;
             }
             set
             {
-                if (null != Style?.Text)
-                {
-                    Style.Text.TextColor = value;
-                }
+                TextLabel.TextColor = value;
             }
         }
 
@@ -418,14 +465,11 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return Style?.Text?.HorizontalAlignment ?? HorizontalAlignment.Center;
+                return TextLabel.HorizontalAlignment;
             }
             set
             {
-                if (null != Style?.Text)
-                {
-                    Style.Text.HorizontalAlignment = value;
-                }
+                TextLabel.HorizontalAlignment = value;
             }
         }
 
@@ -437,133 +481,120 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return Style?.Icon?.ResourceUrl?.All;
+                return Icon.ResourceUrl;
             }
             set
             {
-                if (null != Style?.Icon)
-                {
-                    Style.Icon.ResourceUrl = value;
-                }
+                Icon.ResourceUrl = value;
             }
         }
 
         /// <summary>
         /// Text string selector in Button.
+        /// Getter returns copied selector value if exist, null otherwise.
+        /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
         public StringSelector TextSelector
         {
-            get
-            {
-                return textSelector;
-            }
+            get => buttonText == null ? null : new StringSelector((Selector<string>)buttonText.GetValue(TextLabel.TextSelectorProperty));
             set
             {
-                if (value == null || textSelector == null)
+                if (value == null || buttonText == null)
                 {
-                    Tizen.Log.Fatal("NUI", "[Exception] Button.TextSelector is null");
                     throw new NullReferenceException("Button.TextSelector is null");
                 }
                 else
                 {
-                    textSelector.Clone(value);
+                    buttonText.SetValue(TextLabel.TextSelectorProperty, value);
                 }
             }
         }
 
         /// <summary>
         /// Translateable text string selector in Button.
+        /// Getter returns copied selector value if exist, null otherwise.
         /// </summary>
+        /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
         /// <since_tizen> 6 </since_tizen>
         public StringSelector TranslatableTextSelector
         {
-            get
-            {
-                return translatableTextSelector;
-            }
+            get => buttonText == null ? null : new StringSelector((Selector<string>)buttonText.GetValue(TextLabel.TranslatableTextSelectorProperty));
             set
             {
-                if (value == null || translatableTextSelector == null)
+                if (value == null || buttonText == null)
                 {
-                    Tizen.Log.Fatal("NUI", "[Exception] Button.TranslatableTextSelector is null");
                     throw new NullReferenceException("Button.TranslatableTextSelector is null");
                 }
                 else
                 {
-                    translatableTextSelector.Clone(value);
+                    buttonText.SetValue(TextLabel.TranslatableTextSelectorProperty, value);
                 }
             }
         }
 
         /// <summary>
         /// Text color selector in Button.
+        /// Getter returns copied selector value if exist, null otherwise.
         /// </summary>
+        /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
         /// <since_tizen> 6 </since_tizen>
         public ColorSelector TextColorSelector
         {
-            get
-            {
-                return textColorSelector;
-            }
+            get => buttonText == null ? null : new ColorSelector((Selector<Color>)buttonText.GetValue(TextLabel.TextColorSelectorProperty));
             set
             {
-                if (value == null || textColorSelector == null)
+                if (value == null || buttonText == null)
                 {
-                    Tizen.Log.Fatal("NUI", "[Exception] Button.textColorSelector is null");
-                    throw new NullReferenceException("Button.textColorSelector is null");
+                    throw new NullReferenceException("Button.TextColorSelectorProperty is null");
                 }
                 else
                 {
-                    textColorSelector.Clone(value);
+                    buttonText.SetValue(TextLabel.TextColorSelectorProperty, value);
                 }
             }
         }
 
         /// <summary>
         /// Text font size selector in Button.
+        /// Getter returns copied selector value if exist, null otherwise.
         /// </summary>
+        /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
         /// <since_tizen> 6 </since_tizen>
         public FloatSelector PointSizeSelector
         {
-            get
-            {
-                return pointSizeSelector;
-            }
+            get => buttonText == null ? null : new FloatSelector((Selector<float?>)buttonText.GetValue(TextLabel.PointSizeSelectorProperty));
             set
             {
-                if (value == null || pointSizeSelector == null)
+                if (value == null || buttonText == null)
                 {
-                    Tizen.Log.Fatal("NUI", "[Exception] Button.pointSizeSelector is null");
-                    throw new NullReferenceException("Button.pointSizeSelector is null");
+                    throw new NullReferenceException("Button.PointSizeSelector is null");
                 }
                 else
                 {
-                    pointSizeSelector.Clone(value);
+                    buttonText.SetValue(TextLabel.PointSizeSelectorProperty, value);
                 }
             }
         }
 
         /// <summary>
         /// Icon image's resource url selector in Button.
+        /// Getter returns copied selector value if exist, null otherwise.
         /// </summary>
+        /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
         /// <since_tizen> 6 </since_tizen>
         public StringSelector IconURLSelector
         {
-            get
-            {
-                return iconURLSelector;
-            }
+            get => buttonIcon == null ? null : new StringSelector((Selector<string>)buttonIcon.GetValue(ImageView.ResourceUrlSelectorProperty));
             set
             {
-                if (value == null || iconURLSelector == null)
+                if (value == null || buttonIcon == null)
                 {
-                    Tizen.Log.Fatal("NUI", "[Exception] Button.iconURLSelector is null");
-                    throw new NullReferenceException("Button.iconURLSelector is null");
+                    throw new NullReferenceException("Button.IconURLSelector is null");
                 }
                 else
                 {
-                    iconURLSelector.Clone(value);
+                    buttonIcon.SetValue(ImageView.ResourceUrlSelectorProperty, value);
                 }
             }
         }
@@ -603,14 +634,12 @@ namespace Tizen.NUI.Components
         /// <summary>
         /// Icon relative orientation in Button, work only when show icon and text.
         /// </summary>
-        /// <since_tizen> 6 </since_tizen>
-        /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 8 </since_tizen>
         public IconOrientation? IconRelativeOrientation
         {
             get
             {
-                return (IconOrientation?)GetValue(IconRelativeOrientationProperty);
+                return (IconOrientation?)GetValue(IconRelativeOrientationProperty) ?? IconOrientation.Left;
             }
             set
             {
@@ -624,7 +653,7 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 6 </since_tizen>
         public Extents IconPadding
         {
-            get => (Extents)GetValue(IconPaddingProperty);
+            get => (Extents)GetValue(IconPaddingProperty) ?? new Extents();
             set => SetValue(IconPaddingProperty, value);
         }
 
@@ -634,10 +663,12 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 6 </since_tizen>
         public Extents TextPadding
         {
-            get => (Extents)GetValue(TextPaddingProperty);
+            get => (Extents)GetValue(TextPaddingProperty) ?? new Extents();
             set => SetValue(TextPaddingProperty, value);
         }
 
+        private ButtonStyle buttonStyle => ViewStyle as ButtonStyle;
+
         /// <summary>
         /// Called after a key event is received by the view that has had its focus set.
         /// </summary>
@@ -646,7 +677,11 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 6 </since_tizen>
         public override bool OnKey(Key key)
         {
-            if (null == key) return false;
+            if (!IsEnabled || null == key)
+            {
+                return false;
+            }
+
             if (key.State == Key.StateType.Down)
             {
                 if (key.KeyPressedName == "Return")
@@ -659,11 +694,11 @@ namespace Tizen.NUI.Components
             {
                 if (key.KeyPressedName == "Return")
                 {
-                    bool clicked = isPressed && isEnabled;
+                    bool clicked = isPressed && IsEnabled;
 
                     isPressed = false;
 
-                    if (Style.IsSelectable != null && Style.IsSelectable == true)
+                    if (IsSelectable)
                     {
                         IsSelected = !IsSelected;
                     }
@@ -674,8 +709,8 @@ namespace Tizen.NUI.Components
 
                     if (clicked)
                     {
-                        ClickEventArgs eventArgs = new ClickEventArgs();
-                        OnClickInternal(eventArgs);
+                        ClickedEventArgs eventArgs = new ClickedEventArgs();
+                        OnClickedInternal(eventArgs);
                     }
                 }
             }
@@ -685,9 +720,7 @@ namespace Tizen.NUI.Components
         /// <summary>
         /// Called when the control gain key input focus. Should be overridden by derived classes if they need to customize what happens when the focus is gained.
         /// </summary>
-        /// <since_tizen> 6 </since_tizen>
-        /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 8 </since_tizen>
         public override void OnFocusGained()
         {
             base.OnFocusGained();
@@ -697,9 +730,7 @@ namespace Tizen.NUI.Components
         /// <summary>
         /// Called when the control loses key input focus. Should be overridden by derived classes if they need to customize what happens when the focus is lost.
         /// </summary>
-        /// <since_tizen> 6 </since_tizen>
-        /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 8 </since_tizen>
         public override void OnFocusLost()
         {
             base.OnFocusLost();
@@ -712,53 +743,12 @@ namespace Tizen.NUI.Components
         /// </summary>
         /// <param name="touch">The touch event.</param>
         /// <returns>True if the event should be consumed.</returns>
-        /// <since_tizen> 6 </since_tizen>
-        /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 8 </since_tizen>
+        [Obsolete("Deprecated in API8; Will be removed in API10. Please use OnClicked instead.")]
+#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member, It will be removed in API10
         public override bool OnTouch(Touch touch)
+#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member, It will be removed in API10
         {
-            if (null == touch) return false;
-            PointStateType state = touch.GetState(0);
-
-            switch (state)
-            {
-                case PointStateType.Down:
-                    isPressed = true;
-                    Extension?.SetTouchInfo(touch);
-                    UpdateState();
-                    return true;
-                case PointStateType.Interrupted:
-                    isPressed = false;
-                    UpdateState();
-                    return true;
-                case PointStateType.Up:
-                    {
-                        bool clicked = isPressed && isEnabled;
-
-                        isPressed = false;
-
-                        if (Style.IsSelectable != null && Style.IsSelectable == true)
-                        {
-                            Extension?.SetTouchInfo(touch);
-                            IsSelected = !IsSelected;
-                        }
-                        else
-                        {
-                            Extension?.SetTouchInfo(touch);
-                            UpdateState();
-                        }
-
-                        if (clicked)
-                        {
-                            ClickEventArgs eventArgs = new ClickEventArgs();
-                            OnClickInternal(eventArgs);
-                        }
-
-                        return true;
-                    }
-                default:
-                    break;
-            }
             return base.OnTouch(touch);
         }
 
@@ -769,9 +759,10 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public override void ApplyStyle(ViewStyle viewStyle)
         {
+            styleApplied = false;
+
             base.ApplyStyle(viewStyle);
 
-            ButtonStyle buttonStyle = viewStyle as ButtonStyle;
             if (null != buttonStyle)
             {
                 Extension = buttonStyle.CreateExtension();
@@ -790,12 +781,16 @@ namespace Tizen.NUI.Components
                     Icon?.ApplyStyle(buttonStyle.Icon);
                 }
             }
+
+            styleApplied = true;
         }
 
         /// <summary>
         /// ClickEventArgs is a class to record button click event arguments which will sent to user.
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
+        [Obsolete("Deprecated in API8; Will be removed in API10. Please use ClickedEventArgs instead.")]
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
         public class ClickEventArgs : EventArgs
         {
         }
@@ -804,56 +799,22 @@ namespace Tizen.NUI.Components
         /// StateChangeEventArgs is a class to record button state change event arguments which will sent to user.
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
+        [Obsolete("Deprecated in API8; Will be removed in API10. Please use View.ControlStateChangedEventArgs")]
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
         public class StateChangedEventArgs : EventArgs
         {
             /// <summary> previous state of Button </summary>
             /// <since_tizen> 6 </since_tizen>
+            /// It will be removed in API10
+            [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:Do not declare visible instance fields")]
+            [Obsolete("Deprecated in API8; Will be removed in API10")]
             public ControlStates PreviousState;
             /// <summary> current state of Button </summary>
             /// <since_tizen> 6 </since_tizen>
+            /// It will be removed in API10
+            [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:Do not declare visible instance fields")]
+            [Obsolete("Deprecated in API8; Will be removed in API10")]
             public ControlStates CurrentState;
         }
-
-        /// <summary>
-        /// Get current text part to the attached ButtonExtension.
-        /// </summary>
-        /// <remarks>
-        /// It returns null if the passed extension is invaild.
-        /// </remarks>
-        /// <param name="extension">The extension instance that is currently attached to this Button.</param>
-        /// <return>The button's text part.</return>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public TextLabel GetCurrentText(ButtonExtension extension)
-        {
-            return (extension == Extension) ? TextLabel : null;
-        }
-
-        /// <summary>
-        /// Get current icon part to the attached ButtonExtension.
-        /// </summary>
-        /// <remarks>
-        /// It returns null if the passed extension is invaild.
-        /// </remarks>
-        /// <param name="extension">The extension instance that is currently attached to this Button.</param>
-        /// <return>The button's icon part.</return>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public ImageView GetCurrentIcon(ButtonExtension extension)
-        {
-            return (extension == Extension) ? Icon : null;
-        }
-
-        /// <summary>
-        /// Get current overlay image part to the attached ButtonExtension.
-        /// </summary>
-        /// <remarks>
-        /// It returns null if the passed extension is invaild.
-        /// </remarks>
-        /// <param name="extension">The extension instance that is currently attached to this Button.</param>
-        /// <return>The button's overlay image part.</return>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public ImageView GetCurrentOverlayImage(ButtonExtension extension)
-        {
-            return (extension == Extension) ? OverlayImage : null;
-        }
     }
 }