[NUI][AT-SPI] Highlight bindings (#2752)
authorBartłomiej Grzelewski <grzelewski@users.noreply.github.com>
Fri, 2 Apr 2021 01:42:00 +0000 (03:42 +0200)
committerhuiyueun <35286162+huiyueun@users.noreply.github.com>
Tue, 20 Apr 2021 06:13:00 +0000 (15:13 +0900)
Highlight bindings for accessibility.

Co-authored-by: Seoyeon2Kim <34738918+Seoyeon2Kim@users.noreply.github.com>
src/Tizen.NUI/src/internal/Interop/Interop.ControlDevel.cs
src/Tizen.NUI/src/public/Accessibility/Accessibility.cs
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs

index 3b1db59..62cf13e 100755 (executable)
@@ -203,6 +203,18 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_Bridge_Remove_Popup")]
             public static extern void DaliAccessibilityBridgeRemovePopup(global::System.Runtime.InteropServices.HandleRef arg1);
 
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_Accessible_GetCurrentlyHighlightedActor")]
+            public static extern global::System.IntPtr DaliAccessibilityAccessibleGetCurrentlyHighlightedActor();
+
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_Accessible_GetHighlightActor")]
+            public static extern global::System.IntPtr DaliAccessibilityAccessibleGetHighlightActor();
+
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_Accessible_SetHighlightActor")]
+            public static extern void DaliAccessibilityAccessibleSetHighlightActor(global::System.Runtime.InteropServices.HandleRef arg1);
+
             // SetAccessibilityConstructor
 
             // Keep this structure layout binary compatible with the respective C++ structure!
index 5c0392e..fa82f9d 100755 (executable)
@@ -108,6 +108,58 @@ namespace Tizen.NUI.Accessibility
             Interop.Accessibility.PauseResume(View.getCPtr(dummy), pause);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
+
+        /// <summary>
+        ///  Get View that is used to highlight widget.
+        /// </summary>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public View GetHighlightFrameView()
+        {
+            var ptr = Interop.ControlDevel.DaliAccessibilityAccessibleGetHighlightActor();
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            if (ptr == IntPtr.Zero)
+                return null;
+            return new View(ptr, true);
+        }
+
+        /// <summary>
+        ///  Set view that will be used to highlight widget.
+        /// </summary>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SetHighlightFrameView(View view)
+        {
+            Interop.ControlDevel.DaliAccessibilityAccessibleSetHighlightActor(View.getCPtr(view));
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        ///  Get highligted View.
+        /// </summary>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public View GetCurrentlyHighlightedView()
+        {
+            var ptr = Interop.ControlDevel.DaliAccessibilityAccessibleGetCurrentlyHighlightedActor();
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            if (ptr == IntPtr.Zero)
+                return null;
+            return new View(ptr, true);
+        }
+
+        /// <summary>
+        ///  Clear highlight.
+        /// </summary>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool ClearCurrentlyHighlightedView()
+        {
+            using (View view = GetCurrentlyHighlightedView())
+            {
+                return view.ClearAccessibilityHighlight();
+            }
+        }
         #endregion Method
 
 
index 5885b5d..d761c21 100755 (executable)
@@ -497,7 +497,10 @@ namespace Tizen.NUI.BaseComponents
         {
             get
             {
-                return Accessibility.AccessibilityManager.Instance.GetCurrentFocusView() == this;
+                using (View view = Accessibility.Accessibility.Instance.GetCurrentlyHighlightedView())
+                {
+                    return view == this;
+                }
             }
         }
 
index e9d2d59..e0c2440 100755 (executable)
@@ -241,9 +241,18 @@ namespace Tizen.NUI.BaseComponents
         // ****************** Accessibility Relations ******************* //
         ///////////////////////////////////////////////////////////////////
 
+        /// <summary>
+        /// Creates relation between objects.
+        /// </summary>
+        /// <param name="second">Object which will be in relation.</param>
+        /// <param name="relation">Relation type.</param>
+        /// <exception cref="ArgumentNullException">You must pass valid object. NULL could not be in relation.</exception>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public void AppendAccessibilityRelation(View second, RelationType relation)
         {
+            if (second is null)
+                throw new ArgumentNullException(nameof(second));
+
             Interop.ControlDevel.DaliToolkitDevelControlAppendAccessibilityRelation(SwigCPtr, second.SwigCPtr, (int)relation);
             if (NDalicPINVOKE.SWIGPendingException.Pending)
                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();