[NUI][AT-SPI] Add IAtspiTable and IAtspiTableCell interfaces (#5305)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Style / SliderStyle.cs
index b3f02dd..023cbdc 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -24,12 +24,12 @@ namespace Tizen.NUI.Components
     /// <summary>
     /// SliderStyle is a class which saves Slider's ux data.
     /// </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 class SliderStyle : ControlStyle
     {
-        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        /// <summary>
+        /// IndicatorTypeProperty
+        /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty IndicatorTypeProperty = BindableProperty.Create(nameof(IndicatorType), typeof(IndicatorType?), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
@@ -44,7 +44,10 @@ namespace Tizen.NUI.Components
             var instance = (SliderStyle)bindable;
             return instance.privateIndicatorType;
         });
-        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+
+        /// <summary>
+        /// SpaceBetweenTrackAndIndicatorProperty
+        /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty SpaceBetweenTrackAndIndicatorProperty = BindableProperty.Create(nameof(SpaceBetweenTrackAndIndicator), typeof(uint?), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
@@ -59,7 +62,10 @@ namespace Tizen.NUI.Components
             var instance = (SliderStyle)bindable;
             return instance.privateSpaceBetweenTrackAndIndicator;
         });
-        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+
+        /// <summary>
+        /// TrackThicknessProperty
+        /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty TrackThicknessProperty = BindableProperty.Create(nameof(TrackThickness), typeof(uint?), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
@@ -74,276 +80,188 @@ namespace Tizen.NUI.Components
             var instance = (SliderStyle)bindable;
             return instance.privateTrackThickness;
         });
-        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+
+        /// <summary>
+        /// TrackPaddingProperty
+        /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty TrackPaddingProperty = BindableProperty.Create(nameof(TrackPadding), typeof(Extents), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
-            var instance = (SliderStyle)bindable;
-            if (newValue != null)
-            {
-                instance.trackPadding.CopyFrom((Extents)newValue);
-            }
+            ((SliderStyle)bindable).trackPadding = newValue == null ? null : new Extents((Extents)newValue);
         },
         defaultValueCreator: (bindable) =>
         {
             var instance = (SliderStyle)bindable;
             return instance.trackPadding;
         });
+
+        private IndicatorType? privateIndicatorType = Slider.IndicatorType.None;
+        private uint? privateTrackThickness;
+        private uint? privateSpaceBetweenTrackAndIndicator;
+        private Extents trackPadding;
+
+        static SliderStyle() { }
+
         /// <summary>
         /// Creates a new instance of a SliderStyle.
         /// </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 SliderStyle() : base()
         {
-            IndicatorType = Slider.IndicatorType.None;
-            InitSubStyle();
         }
 
         /// <summary>
         /// Creates a new instance of a SliderStyle with style.
         /// </summary>
         /// <param name="style">Create SliderStyle by style customized by user.</param>
-        /// <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 SliderStyle(SliderStyle style) : base(style)
         {
-            if(style == null)
-            {
-                return;
-            }
-
-            InitSubStyle();
-
-            this.CopyFrom(style);
-
-            IndicatorType = style.IndicatorType;
         }
 
         /// <summary>
         /// Get or set background track.
         /// </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)]
-        public ImageViewStyle Track { get; set; }
+        /// <since_tizen> 8 </since_tizen>
+        public ImageViewStyle Track { get; set; } = new ImageViewStyle();
 
         /// <summary>
         /// Get or set slided track.
         /// </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)]
-        public ImageViewStyle Progress { get; set; }
+        /// <since_tizen> 8 </since_tizen>
+        public ImageViewStyle Progress { get; set; } = new ImageViewStyle();
 
         /// <summary>
         /// Get or set thumb.
         /// </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.
+        /// <since_tizen> 8 </since_tizen>
+        public ImageViewStyle Thumb { get; set; } = new ImageViewStyle();
+
+        /// <summary>
+        /// Get or set background warning track.
+        /// </summary>
+        /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public ImageViewStyle Thumb { get; set; }
+        public ImageViewStyle WarningTrack { get; set; } = new ImageViewStyle();
 
         /// <summary>
-        /// Get or set low indicator image.
+        /// Get or set slided warning track.
         /// </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.
+        /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public ImageViewStyle LowIndicatorImage { get; set; }
+        public ImageViewStyle WarningProgress { get; set; } = new ImageViewStyle();
+
+        /// <summary>
+        /// Get or set low indicator image.
+        /// </summary>
+        /// <since_tizen> 8 </since_tizen>
+        public ImageViewStyle LowIndicatorImage { get; set; } = new ImageViewStyle();
 
         /// <summary>
         /// Get or set high indicator image.
         /// </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)]
-        public ImageViewStyle HighIndicatorImage { get; set; }
+        /// <since_tizen> 8 </since_tizen>
+        public ImageViewStyle HighIndicatorImage { get; set; } = new ImageViewStyle();
 
         /// <summary>
         /// Get or set low indicator 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)]
-        public TextLabelStyle LowIndicator { get; set; }
+        /// <since_tizen> 8 </since_tizen>
+        public TextLabelStyle LowIndicator { get; set; } = new TextLabelStyle();
 
         /// <summary>
         /// Get or set high indicator 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)]
-        public TextLabelStyle HighIndicator { get; set; }
+        /// <since_tizen> 8 </since_tizen>
+        public TextLabelStyle HighIndicator { get; set; } = new TextLabelStyle();
+
+        /// <summary>
+        /// Get or set the value indicator text.
+        /// </summary>
+        /// <since_tizen> 9 </since_tizen>
+        public TextLabelStyle ValueIndicatorText { get; set; } = new TextLabelStyle();
+
+        /// <summary>
+        /// Get or set the value indicator image.
+        /// </summary>
+        /// <since_tizen> 9 </since_tizen>
+        public ImageViewStyle ValueIndicatorImage { get; set; } = new ImageViewStyle();
 
         /// <summary>
         /// Get or set Indicator type
         /// </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 IndicatorType? IndicatorType
         {
             get => (IndicatorType?)GetValue(IndicatorTypeProperty);
             set => SetValue(IndicatorTypeProperty, value);
         }
 
-        private IndicatorType? privateIndicatorType { get; set; }
-
         /// <summary>
         /// Get or set track thickness
         /// </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 uint? TrackThickness
         {
             get => (uint?)GetValue(TrackThicknessProperty);
             set => SetValue(TrackThicknessProperty, value);
         }
-        private uint? privateTrackThickness { get; set; }
 
         /// <summary>
         /// Get or set space between track and indicator
         /// </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 uint? SpaceBetweenTrackAndIndicator
         {
             get => (uint?)GetValue(SpaceBetweenTrackAndIndicatorProperty);
             set => SetValue(SpaceBetweenTrackAndIndicatorProperty, value);
         }
-        private uint? privateSpaceBetweenTrackAndIndicator { get; set; }
 
         /// <summary>
         /// Get or set space between track and indicator
         /// </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 Extents TrackPadding
         {
-            get => (Extents)GetValue(TrackPaddingProperty);
+            get => ((Extents)GetValue(TrackPaddingProperty)) ?? (trackPadding = new Extents(0, 0, 0, 0));
             set => SetValue(TrackPaddingProperty, value);
         }
-        private Extents _trackPadding;
-        private Extents trackPadding
+
+        /// <inheritdoc/>
+        /// <since_tizen> 8 </since_tizen>
+        public override void CopyFrom(BindableObject bindableObject)
         {
-            get
+            base.CopyFrom(bindableObject);
+
+            if (bindableObject is SliderStyle sliderStyle)
             {
-                if (null == _trackPadding)
-                {
-                    _trackPadding = new Extents((ushort start, ushort end, ushort top, ushort bottom)=>
-                                        {
-                                            Extents extents = new Extents(start, end, top, bottom);
-                                            _trackPadding.CopyFrom(extents);
-                                        }, 0, 0, 0, 0);
-                }
-                return _trackPadding;
+                Track.CopyFrom(sliderStyle.Track);
+                Progress.CopyFrom(sliderStyle.Progress);
+                Thumb.CopyFrom(sliderStyle.Thumb);
+                WarningTrack.CopyFrom(sliderStyle.WarningTrack);
+                WarningProgress.CopyFrom(sliderStyle.WarningProgress);
+                LowIndicatorImage.CopyFrom(sliderStyle.LowIndicatorImage);
+                HighIndicatorImage.CopyFrom(sliderStyle.HighIndicatorImage);
+                LowIndicator.CopyFrom(sliderStyle.LowIndicator);
+                HighIndicator.CopyFrom(sliderStyle.HighIndicator);
+                ValueIndicatorText.CopyFrom(sliderStyle.ValueIndicatorText);
+                ValueIndicatorImage.CopyFrom(sliderStyle.ValueIndicatorImage);
             }
         }
 
         /// <summary>
-        /// Attributes's clone function.
+        /// Dispose SliderStyle and all children on it.
         /// </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.
+        /// <param name="disposing">true in order to free managed objects</param>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public override void CopyFrom(BindableObject bindableObject)
+        protected override void Dispose(bool disposing)
         {
-            base.CopyFrom(bindableObject);
-
-            SliderStyle sliderAttributes = bindableObject as SliderStyle;
-
-            if (null != sliderAttributes)
+            if (disposing)
             {
-                if (sliderAttributes.Track != null)
-                {
-                    if (null == Track)
-                    {
-                        Track = new ImageViewStyle();
-                    }
-                    Track.CopyFrom(sliderAttributes.Track);
-                }
-
-                if (sliderAttributes.Progress != null)
-                {
-                    if (null == Progress)
-                    {
-                        Progress = new ImageViewStyle();
-                    }
-                    Progress.CopyFrom(sliderAttributes.Progress);
-                }
-
-                if (sliderAttributes.Thumb != null)
-                {
-                    if (null == Thumb)
-                    {
-                        Thumb = new ImageViewStyle();
-                    }
-                    Thumb.CopyFrom(sliderAttributes.Thumb);
-                }
-
-                if (sliderAttributes.LowIndicatorImage != null)
-                {
-                    if (null == LowIndicatorImage)
-                    {
-                        LowIndicatorImage = new ImageViewStyle();
-                    }
-                    LowIndicatorImage.CopyFrom(sliderAttributes.LowIndicatorImage);
-                }
-
-                if (sliderAttributes.HighIndicatorImage != null)
-                {
-                    if (null == HighIndicatorImage)
-                    {
-                        HighIndicatorImage = new ImageViewStyle();
-                    }
-                    HighIndicatorImage.CopyFrom(sliderAttributes.HighIndicatorImage);
-                }
-
-                if (sliderAttributes.LowIndicator != null)
-                {
-                    if (null == LowIndicator)
-                    {
-                        LowIndicator = new TextLabelStyle();
-                    }
-                    LowIndicator.CopyFrom(sliderAttributes.LowIndicator);
-                }
-
-                if (sliderAttributes.HighIndicator != null)
-                {
-                    if (null == HighIndicator)
-                    {
-                        HighIndicator = new TextLabelStyle();
-                    }
-                    HighIndicator.CopyFrom(sliderAttributes.HighIndicator);
-                }
-
-                if (sliderAttributes.TrackThickness != null)
-                {
-                    TrackThickness = sliderAttributes.TrackThickness;
-                }
-
-                if (sliderAttributes.TrackPadding != null)
-                {
-                    TrackPadding = sliderAttributes.TrackPadding;
-                }
+                trackPadding?.Dispose();
             }
-        }
 
-        private void InitSubStyle()
-        {
-            Track = new ImageViewStyle();
-            Progress = new ImageViewStyle();
-            Thumb = new ImageViewStyle();
-            LowIndicatorImage = new ImageViewStyle();
-            HighIndicatorImage = new ImageViewStyle();
-            LowIndicator = new TextLabelStyle();
-            HighIndicator = new TextLabelStyle();
+            base.Dispose(disposing);
         }
     }
 }