[NUI][AT-SPI] Add Value interface to Pagination
authorBartlomiej Grzelewski <b.grzelewski@samsung.com>
Tue, 27 Apr 2021 14:52:11 +0000 (16:52 +0200)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 21 May 2021 07:37:43 +0000 (16:37 +0900)
src/Tizen.NUI.Components/Controls/Pagination.cs

index 813b4205d83f0bfa28e2eb70f13f911bd466241f..f458c30248a7394977b5a011f1ccdbfcca8f8bd0 100755 (executable)
@@ -366,6 +366,10 @@ namespace Tizen.NUI.Components
                 selectedIndex = refinedValue;
 
                 SelectIn(indicatorList[selectedIndex]);
+
+                if (IsHighlighted) {
+                    EmitAccessibilityEvent(ObjectPropertyChangeEvent.Value);
+                }
             }
         }
 
@@ -384,11 +388,67 @@ namespace Tizen.NUI.Components
             return new Position(indicatorList[index].Position.X + container.PositionX, indicatorList[index].Position.Y + container.PositionY);
         }
 
+        /// <summary>
+        /// Minimum value.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override double AccessibilityGetMinimum()
+        {
+            return 0.0;
+        }
+
+        /// <summary>
+        /// Current value.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override double AccessibilityGetCurrent()
+        {
+            return (double)SelectedIndex;
+        }
+
+        /// <summary>
+        /// Maximum value.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override double AccessibilityGetMaximum()
+        {
+            return (double)IndicatorCount;
+        }
+
+        /// <summary>
+        /// Current value.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override bool AccessibilitySetCurrent(double value)
+        {
+            int f = (int)value;
+
+            if (f >= 0 && f <= IndicatorCount)
+            {
+                SelectedIndex = f;
+                return true;
+            }
+
+            return false;
+        }
+
+        /// <summary>
+        /// Minimum increment.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override double AccessibilityGetMinimumIncrement()
+        {
+            return 1.0;
+        }
+
         /// <inheritdoc/>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public override void OnInitialize()
         {
             base.OnInitialize();
+            SetAccessibilityConstructor(Role.ScrollBar, AccessibilityInterface.Value);
+            AccessibilityHighlightable = true;
+            AppendAccessibilityAttribute("style", "pagecontrolbyvalue");
 
             container = new VisualView()
             {