[NUI][AT-SPI] Promote DoAction implementation from CustomView to View
authorArtur Świgoń <a.swigon@samsung.com>
Tue, 4 Apr 2023 11:59:36 +0000 (13:59 +0200)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 6 Apr 2023 07:32:55 +0000 (16:32 +0900)
This is a follow-up to #5109 that enables controls derived from View,
but not CustomView, that use the ViewAccessibilityMode.Custom (e.g.
FluxView), to customize their behaviour related to the AT-SPI Action
interface.

The implementation of AccessibilityDoAction() and its helper methods
is moved up from CustomView to View. Note that the events that
AccessibilityDoAction invokes have already been declared at the View
level, in ViewAccessibilityEvent.cs (e.g. AccessibilityActivated), so
they do not have to be moved anywhere in this PR.

src/Tizen.NUI/src/public/BaseComponents/CustomView.cs
src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs

index 92edb87ee7dd07c3358eb3913d0ba12b1e59ef6d..1cb9e3f76ed6cf34e3f35718cf192234846c7abc 100755 (executable)
@@ -497,139 +497,13 @@ namespace Tizen.NUI.BaseComponents
         {
         }
 
+        /// <inheritdoc/>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        protected override bool AccessibilityDoAction(string name)
-        {
-            if (name == AccessibilityActivateAction)
-            {
-                if (ActivateSignal?.Empty() == false)
-                {
-                    ActivateSignal?.Emit();
-                    return true;
-                }
-                else
-                {
-                    return OnAccessibilityActivated();
-                }
-            }
-            else if (name == AccessibilityReadingSkippedAction)
-            {
-                if (ReadingSkippedSignal?.Empty() == false)
-                {
-                    ReadingSkippedSignal?.Emit();
-                    return true;
-                }
-                else
-                {
-                    return OnAccessibilityReadingSkipped();
-                }
-            }
-            else if (name == AccessibilityReadingCancelledAction)
-            {
-                if (ReadingCancelledSignal?.Empty() == false)
-                {
-                    ReadingCancelledSignal?.Emit();
-                    return true;
-                }
-                else
-                {
-                    return OnAccessibilityReadingCancelled();
-                }
-            }
-            else if (name == AccessibilityReadingStoppedAction)
-            {
-                if (ReadingStoppedSignal?.Empty() == false)
-                {
-                    ReadingStoppedSignal?.Emit();
-                    return true;
-                }
-                else
-                {
-                    return OnAccessibilityReadingStopped();
-                }
-            }
-            else if (name == AccessibilityReadingPausedAction)
-            {
-                if (ReadingPausedSignal?.Empty() == false)
-                {
-                    ReadingPausedSignal?.Emit();
-                    return true;
-                }
-                else
-                {
-                    return OnAccessibilityReadingPaused();
-                }
-            }
-            else if (name == AccessibilityReadingResumedAction)
-            {
-                if (ReadingResumedSignal?.Empty() == false)
-                {
-                    ReadingResumedSignal?.Emit();
-                    return true;
-                }
-                else
-                {
-                    return OnAccessibilityReadingResumed();
-                }
-            }
-            else
-            {
-                return false;
-            }
-        }
-
-        /// <summary>
-        /// This method is called when the control accessibility is activated.<br />
-        /// Derived classes should override this to perform custom accessibility activation.<br />
-        /// </summary>
-        /// <returns>True if this control can perform accessibility activation.</returns>
-        internal virtual bool OnAccessibilityActivated()
+        protected override bool OnAccessibilityActivated()
         {
             return OnKeyboardEnter();
         }
 
-        /// <summary>
-        /// This method is called when reading is skipped.
-        /// </summary>
-        /// <returns>True if information was served.</returns>
-        internal virtual bool OnAccessibilityReadingSkipped()
-        {
-            return false;
-        }
-
-        /// <summary>
-        /// This method is called when reading is cancelled.
-        /// </summary>
-        /// <returns>True if information was served.</returns>
-        internal virtual bool OnAccessibilityReadingCancelled()
-        {
-            return false;
-        }
-        /// <summary>
-        /// This method is called when reading is stopped.
-        /// </summary>
-        /// <returns>True if information was served.</returns>
-        internal virtual bool OnAccessibilityReadingStopped()
-        {
-            return false;
-        }
-        /// <summary>
-        /// This method is called when reading was paused.
-        /// </summary>
-        /// <returns>True if information was served.</returns>
-        internal virtual bool OnAccessibilityReadingPaused()
-        {
-            return false;
-        }
-        /// <summary>
-        /// This method is called when reading is resumed.
-        /// </summary>
-        /// <returns>True if information was served.</returns>
-        internal virtual bool OnAccessibilityReadingResumed()
-        {
-            return false;
-        }
-
         /// <summary>
         /// This method should be overridden by deriving classes when they wish to respond the accessibility.
         /// </summary>
index eae077ffcad113506c7120d893ceed6ea42a4147..dbc41bd588019942621aadcf9abfa44a1fa23de4 100755 (executable)
@@ -427,7 +427,82 @@ namespace Tizen.NUI.BaseComponents
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected virtual bool AccessibilityDoAction(string name)
         {
-            return false;
+            if (name == AccessibilityActivateAction)
+            {
+                if (ActivateSignal?.Empty() == false)
+                {
+                    ActivateSignal?.Emit();
+                    return true;
+                }
+                else
+                {
+                    return OnAccessibilityActivated();
+                }
+            }
+            else if (name == AccessibilityReadingSkippedAction)
+            {
+                if (ReadingSkippedSignal?.Empty() == false)
+                {
+                    ReadingSkippedSignal?.Emit();
+                    return true;
+                }
+                else
+                {
+                    return OnAccessibilityReadingSkipped();
+                }
+            }
+            else if (name == AccessibilityReadingCancelledAction)
+            {
+                if (ReadingCancelledSignal?.Empty() == false)
+                {
+                    ReadingCancelledSignal?.Emit();
+                    return true;
+                }
+                else
+                {
+                    return OnAccessibilityReadingCancelled();
+                }
+            }
+            else if (name == AccessibilityReadingStoppedAction)
+            {
+                if (ReadingStoppedSignal?.Empty() == false)
+                {
+                    ReadingStoppedSignal?.Emit();
+                    return true;
+                }
+                else
+                {
+                    return OnAccessibilityReadingStopped();
+                }
+            }
+            else if (name == AccessibilityReadingPausedAction)
+            {
+                if (ReadingPausedSignal?.Empty() == false)
+                {
+                    ReadingPausedSignal?.Emit();
+                    return true;
+                }
+                else
+                {
+                    return OnAccessibilityReadingPaused();
+                }
+            }
+            else if (name == AccessibilityReadingResumedAction)
+            {
+                if (ReadingResumedSignal?.Empty() == false)
+                {
+                    ReadingResumedSignal?.Emit();
+                    return true;
+                }
+                else
+                {
+                    return OnAccessibilityReadingResumed();
+                }
+            }
+            else
+            {
+                return false;
+            }
         }
 
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -472,5 +547,66 @@ namespace Tizen.NUI.BaseComponents
         {
             return false;
         }
+
+        /// <summary>
+        /// This method is called when the control accessibility is activated.<br />
+        /// Derived classes should override this to perform custom accessibility activation.<br />
+        /// </summary>
+        /// <returns>True if this control can perform accessibility activation.</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual bool OnAccessibilityActivated()
+        {
+            return false;
+        }
+
+        /// <summary>
+        /// This method is called when reading is skipped.
+        /// </summary>
+        /// <returns>True if information was served.</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual bool OnAccessibilityReadingSkipped()
+        {
+            return false;
+        }
+
+        /// <summary>
+        /// This method is called when reading is cancelled.
+        /// </summary>
+        /// <returns>True if information was served.</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual bool OnAccessibilityReadingCancelled()
+        {
+            return false;
+        }
+
+        /// <summary>
+        /// This method is called when reading is stopped.
+        /// </summary>
+        /// <returns>True if information was served.</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual bool OnAccessibilityReadingStopped()
+        {
+            return false;
+        }
+
+        /// <summary>
+        /// This method is called when reading was paused.
+        /// </summary>
+        /// <returns>True if information was served.</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual bool OnAccessibilityReadingPaused()
+        {
+            return false;
+        }
+
+        /// <summary>
+        /// This method is called when reading is resumed.
+        /// </summary>
+        /// <returns>True if information was served.</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual bool OnAccessibilityReadingResumed()
+        {
+            return false;
+        }
     }
 }