[NUI] Modify IsEnabled pre-built classes and style
authoreverLEEst(SangHyeon Lee) <dltkdgus1764@gmail.com>
Fri, 18 Mar 2022 08:05:41 +0000 (01:05 -0700)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 22 Mar 2022 08:34:14 +0000 (17:34 +0900)
src/Tizen.NUI.Components/Controls/Button.Internal.cs
src/Tizen.NUI.Components/Controls/Button.cs
src/Tizen.NUI.Components/Controls/Progress.cs
src/Tizen.NUI.Components/Controls/RecyclerView/Item/RecyclerViewItem.Internal.cs
src/Tizen.NUI.Components/Controls/RecyclerView/Item/RecyclerViewItem.cs
src/Tizen.NUI.Components/Controls/Slider.Internal.cs
src/Tizen.NUI.Components/Controls/Slider.cs
src/Tizen.NUI.Components/Style/ButtonStyle.cs
src/Tizen.NUI.Components/Style/RecyclerViewItemStyle.cs
src/Tizen.NUI/src/public/BaseComponents/Style/ViewStyle.cs
src/Tizen.NUI/src/public/BaseComponents/Style/ViewStyleBindableProperty.cs

index e61b52d..73dd5aa 100644 (file)
@@ -186,13 +186,11 @@ namespace Tizen.NUI.Components
             return base.HandleControlStateOnTouch(touch);
         }
 
-
         /// <inheritdoc/>
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected override void OnEnabled(bool enabled)
         {
             base.OnEnabled(enabled);
-            //Sensitive = false;
             UpdateState();
         }
 
index ce2f576..8a9573e 100755 (executable)
@@ -66,10 +66,6 @@ namespace Tizen.NUI.Components
 
         /// 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 = View.IsEnabledProperty;
-
-        /// 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), false, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var instance = (Button)bindable;
index ed2e763..0dcd1d2 100755 (executable)
@@ -131,26 +131,6 @@ namespace Tizen.NUI.Components
             return instance.state;
         });
 
-        /// <summary>
-        /// IsEnabledProperty
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create(nameof(IsEnabled), typeof(bool), typeof(Progress), true, propertyChanged: (bindable, oldValue, newValue) =>
-        {
-            var instance = (Progress)bindable;
-            if (newValue != null)
-            {
-                bool newEnabled = (bool)newValue;
-                if (instance.isEnabled != newEnabled)
-                {
-                    instance.isEnabled = newEnabled;
-                    instance.Sensitive = newEnabled;
-                    instance.UpdateStates();
-                }
-            }
-        },
-        defaultValueCreator: (bindable) => ((Progress)bindable).isEnabled);
-
         /// This needs to be considered more if public-open is necessary.
         private ProgressStatusType state = ProgressStatusType.Determinate;
 
@@ -165,7 +145,6 @@ namespace Tizen.NUI.Components
         private float currentValue = 0;
         private float bufferValue = 0;
         private Animation indeterminateAnimation = null;
-        bool isEnabled = true;
 
         static Progress() { }
         /// <summary>
@@ -490,22 +469,6 @@ namespace Tizen.NUI.Components
             }
         }
 
-        /// <summary>
-        /// Flag to decide enable or disable in Progress.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public bool IsEnabled
-        {
-            get
-            {
-                return (bool)GetValue(IsEnabledProperty);
-            }
-            set
-            {
-                SetValue(IsEnabledProperty, value);
-            }
-        }
-
         /// <inheritdoc/>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public override void OnInitialize()
@@ -781,6 +744,14 @@ namespace Tizen.NUI.Components
             }
         }
 
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void OnEnabled(bool enabled)
+        {
+            base.OnEnabled(enabled);
+            UpdateStates();
+        }
+
         private void Initialize()
         {
             AccessibilityHighlightable = true;
index abbff85..4c29a5b 100755 (executable)
@@ -203,11 +203,18 @@ namespace Tizen.NUI.Components
         {
             MeasureChild();
             LayoutChild();
+        }
 
-            Sensitive = IsEnabled;
+                /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void OnEnabled(bool enabled)
+        {
+            base.OnEnabled(enabled);
+            UpdateState();
         }
 
 
+
         /// FIXME!! This has to be done in Element or View class.
         /// <inheritdoc/>
         [EditorBrowsable(EditorBrowsableState.Never)]
index 9a32bab..775d8f1 100755 (executable)
@@ -30,20 +30,7 @@ namespace Tizen.NUI.Components
         /// Property of boolean Enable flag.
         /// </summary>
         /// <since_tizen> 9 </since_tizen>
-        public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create(nameof(IsEnabled), typeof(bool), typeof(RecyclerViewItem), true, propertyChanged: (bindable, oldValue, newValue) =>
-        {
-            var instance = (RecyclerViewItem)bindable;
-            if (newValue != null)
-            {
-                bool newEnabled = (bool)newValue;
-                if (instance.isEnabled != newEnabled)
-                {
-                    instance.isEnabled = newEnabled;
-                    instance.UpdateState();
-                }
-            }
-        },
-        defaultValueCreator: (bindable) => ((RecyclerViewItem)bindable).isEnabled);
+        public static readonly BindableProperty IsEnabledProperty = View.IsEnabledProperty;
 
         /// <summary>
         /// Property of boolean Selected flag.
@@ -93,7 +80,6 @@ namespace Tizen.NUI.Components
 
         private bool isSelected = false;
         private bool isSelectable = true;
-        private bool isEnabled = true;
         private RecyclerViewItemStyle ItemStyle => ViewStyle as RecyclerViewItemStyle;
 
         static RecyclerViewItem() { }
@@ -157,8 +143,11 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 9 </since_tizen>
         public bool IsEnabled
         {
-            get => (bool)GetValue(IsEnabledProperty);
-            set => SetValue(IsEnabledProperty, value);
+            get => base.IsEnabled;
+            set
+            {
+                base.IsEnabled = value;
+            }
         }
 
         /// <summary>
@@ -262,7 +251,7 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
-        /// Called when the control loses key input focus. 
+        /// 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>
@@ -286,7 +275,7 @@ namespace Tizen.NUI.Components
             if (viewStyle != null)
             {
                 //Extension = RecyclerViewItemStyle.CreateExtension();
-                //FIXME : currently padding and margin are not applied by ApplyStyle automatically as missing binding features.               
+                //FIXME : currently padding and margin are not applied by ApplyStyle automatically as missing binding features.
                 Padding = new Extents(viewStyle.Padding);
                 Margin = new Extents(viewStyle.Margin);
             }
index c391769..50530c2 100755 (executable)
@@ -95,7 +95,6 @@ namespace Tizen.NUI.Components
 
         bool isFocused = false;
         bool isPressed = false;
-        bool isEnabled = true;
 
         private void Initialize()
         {
index 522a536..c030ac0 100755 (executable)
@@ -190,26 +190,6 @@ namespace Tizen.NUI.Components
             }
         );
 
-        /// <summary>
-        /// IsEnabledProperty
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create(nameof(IsEnabled), typeof(bool), typeof(Slider), true, propertyChanged: (bindable, oldValue, newValue) =>
-        {
-            var instance = (Slider)bindable;
-            if (newValue != null)
-            {
-                bool newEnabled = (bool)newValue;
-                if (instance.isEnabled != newEnabled)
-                {
-                    instance.isEnabled = newEnabled;
-                    instance.Sensitive = newEnabled;
-                    instance.UpdateValue();
-                }
-            }
-        },
-        defaultValueCreator: (bindable) => ((Slider)bindable).isEnabled);
-
         static Slider() { }
 
         /// <summary>
@@ -1277,22 +1257,6 @@ namespace Tizen.NUI.Components
             }
         }
 
-        /// <summary>
-        /// Flag to decide enable or disable in Slider.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public bool IsEnabled
-        {
-            get
-            {
-                return (bool)GetValue(IsEnabledProperty);
-            }
-            set
-            {
-                SetValue(IsEnabledProperty, value);
-            }
-        }
-
         private Extents spaceBetweenTrackAndIndicator
         {
             get
@@ -1700,6 +1664,14 @@ namespace Tizen.NUI.Components
             UpdateValue();
         }
 
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void OnEnabled(bool enabled)
+        {
+            base.OnEnabled(enabled);
+            UpdateValue();
+        }
+
         private void CalculateCurrentValueByGesture(float offset)
         {
             currentSlidedOffset += offset;
index 1b97275..31b3662 100755 (executable)
@@ -53,18 +53,6 @@ namespace Tizen.NUI.Components
         });
         /// 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(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
-        {
-            var buttonStyle = (ButtonStyle)bindable;
-            buttonStyle.isEnabled = (bool?)newValue;
-        },
-        defaultValueCreator: (bindable) =>
-        {
-            var buttonStyle = (ButtonStyle)bindable;
-            return buttonStyle.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 IconRelativeOrientationProperty = BindableProperty.Create(nameof(IconRelativeOrientation), typeof(Button.IconOrientation?), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var buttonStyle = (ButtonStyle)bindable;
@@ -116,7 +104,6 @@ namespace Tizen.NUI.Components
 
         private bool? isSelectable;
         private bool? isSelected;
-        private bool? isEnabled;
         private Button.IconOrientation? iconRelativeOrientation;
         private Extents iconPadding;
         private Extents textPadding;
@@ -186,8 +173,11 @@ namespace Tizen.NUI.Components
         /// <since_tizen> 8 </since_tizen>
         public bool? IsEnabled
         {
-            get => (bool?)GetValue(IsEnabledProperty);
-            set => SetValue(IsEnabledProperty, value);
+            get => (bool?)base.IsEnabled;
+            set
+            {
+                base.IsEnabled = value;
+            }
         }
 
         /// <summary>
index 5d0b3bc..b1ee754 100755 (executable)
@@ -52,22 +52,9 @@ namespace Tizen.NUI.Components
             var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable;
             return RecyclerViewItemStyle.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)]
-        public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create(nameof(IsEnabled), typeof(bool?), typeof(RecyclerViewItemStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
-        {
-            var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable;
-            RecyclerViewItemStyle.isEnabled = (bool?)newValue;
-        },
-        defaultValueCreator: (bindable) =>
-        {
-            var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable;
-            return RecyclerViewItemStyle.isEnabled;
-        });
 
         private bool? isSelectable;
         private bool? isSelected;
-        private bool? isEnabled;
 
         static RecyclerViewItemStyle() { }
 
@@ -108,16 +95,6 @@ namespace Tizen.NUI.Components
             set => SetValue(IsSelectedProperty, value);
         }
 
-        /// <summary>
-        /// Flag to decide RecyclerViewItem can be selected or not.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public bool? IsEnabled
-        {
-            get => (bool?)GetValue(IsEnabledProperty);
-            set => SetValue(IsEnabledProperty, value);
-        }
-
         /// <inheritdoc/>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public override void CopyFrom(BindableObject bindableObject)
index 6ea7ad4..829b770 100755 (executable)
@@ -53,6 +53,7 @@ namespace Tizen.NUI.BaseComponents
         private float? borderlineWidth;
         private Color borderlineColor;
         private float? borderlineOffset;
+        private bool? isEnabled;
 
         private Selector<ImageShadow> imageShadow;
         private Selector<Shadow> boxShadow;
@@ -498,6 +499,16 @@ namespace Tizen.NUI.BaseComponents
             set => SetValue(ThemeChangeSensitiveProperty, value);
         }
 
+        /// <summary>
+        /// Flag to decide View can be enabled user interaction or not.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool? IsEnabled
+        {
+            get => (bool?)GetValue(IsEnabledProperty);
+            set => SetValue(IsEnabledProperty, value);
+        }
+
 
         /// <summary>
         /// Allow null properties when merging it into other Theme.
index 46ed3a6..bf754cd 100755 (executable)
@@ -427,5 +427,18 @@ namespace Tizen.NUI.BaseComponents
             propertyChanged: (bindable, oldValue, newValue) => ((ViewStyle)bindable).themeChangeSensitive = (bool?)newValue,
             defaultValueCreator: (bindable) => ((ViewStyle)bindable).themeChangeSensitive
         );
+
+        /// 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(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var buttonStyle = (ViewStyle)bindable;
+            buttonStyle.isEnabled = (bool?)newValue;
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var buttonStyle = (ViewStyle)bindable;
+            return buttonStyle.isEnabled;
+        });
     }
 }