From: Artur Świgoń Date: Mon, 20 Mar 2023 12:31:52 +0000 (+0100) Subject: [NUI][AT-SPI] Add ViewAccessibilityMode X-Git-Tag: accepted/tizen/unified/20231205.024657~400 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0519eaaa18c4fdfd9c74414d1f7e98e4e24ce86a;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI][AT-SPI] Add ViewAccessibilityMode The accessibility mode helps select the right Accessible implementation for a given view. It does not affect controls derived from CustomView (or any of its subclasses), e.g. Tizen.NUI.Components, which already behave in the custom mode. The default mode is kept for Tizen.NUI.BaseComponents. However, this patch add a possibility of opting into the custom mode for controls derived directly from View (e.g. FluxView), and by doing so, to be able to implement accessibility support for them in the C# language. --- diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.View.cs b/src/Tizen.NUI/src/internal/Interop/Interop.View.cs index dfef057..3d58662 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.View.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.View.cs @@ -26,6 +26,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_New")] public static extern global::System.IntPtr New(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_NewCustom")] + public static extern global::System.IntPtr NewCustom(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_View__SWIG_0")] public static extern global::System.IntPtr NewView(); diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index 8cf1398..9cb082e 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -116,10 +116,54 @@ namespace Tizen.NUI.BaseComponents } /// + /// Accessibility mode for controlling View's Accessible implementation. + /// It is only relevant when deriving custom controls from View directly, + /// as classes derived from CustomView (or any of its subclasses) get the + /// Custom mode by default. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public enum ViewAccessibilityMode + { + /// + /// Default accessibility implementation. Overriding View.Accessibility...() + /// virtual methods will have no effect. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + Default, + /// + /// Custom accessibility implementation. Overriding View.Accessibility...() + /// will be necessary to provide accessibility support for the View. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + Custom, + } + + private static IntPtr NewWithAccessibilityMode(ViewAccessibilityMode accessibilityMode) + { + switch (accessibilityMode) + { + case ViewAccessibilityMode.Custom: + { + return Interop.View.NewCustom(); + } + case ViewAccessibilityMode.Default: + default: + { + return Interop.View.New(); + } + } + } + + /// /// Creates a new instance of a view. /// /// 3 - public View() : this(Interop.View.New(), true) + public View() : this(ViewAccessibilityMode.Default) + { + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public View(ViewAccessibilityMode accessibilityMode) : this(NewWithAccessibilityMode(accessibilityMode), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); }