diff options
author | Sergey Shakhnazarov <v-seshak@microsoft.com> | 2019-10-11 15:40:08 +0300 |
---|---|---|
committer | Sergey Shakhnazarov <v-seshak@microsoft.com> | 2019-10-11 15:40:08 +0300 |
commit | 0893ad38d87373d65320f47c458d8bd46858ae0c (patch) | |
tree | 2fc6ce34b2d908c4084f9da88804096b54e81555 /Xwt.Gtk.Mac | |
parent | df28393f5a9a4c70a95417748c913c05d902010e (diff) |
[WPF][XamMac][GtkMac] A11y helper
* Allows to check whether accessibility means are in use (Narrator/3rd party tools on Windows, VoiceOver on macOS)
* Adds Accessible.MakeAnnouncement (string message, bool polite = false) method for making a custom announcement for user per request (uses LiveRegion on Windows and NSAccessibility.PostNotification on macOS)
WPF version requires target framework version .NET 4.7.2
Diffstat (limited to 'Xwt.Gtk.Mac')
-rw-r--r-- | Xwt.Gtk.Mac/GtkMacAccessibleBackend.AccessibilityHelper.cs | 34 | ||||
-rw-r--r-- | Xwt.Gtk.Mac/GtkMacAccessibleBackend.cs | 2 | ||||
-rw-r--r-- | Xwt.Gtk.Mac/Xwt.Gtk.Mac.csproj | 4 |
3 files changed, 39 insertions, 1 deletions
diff --git a/Xwt.Gtk.Mac/GtkMacAccessibleBackend.AccessibilityHelper.cs b/Xwt.Gtk.Mac/GtkMacAccessibleBackend.AccessibilityHelper.cs new file mode 100644 index 00000000..d1bae8b3 --- /dev/null +++ b/Xwt.Gtk.Mac/GtkMacAccessibleBackend.AccessibilityHelper.cs @@ -0,0 +1,34 @@ +using System; +using Xwt.GtkBackend; +using Xwt.Mac; + +namespace Xwt.Gtk.Mac +{ + public partial class GtkMacAccessibleBackend : AccessibleBackend + { + static AccerssibilityHelper a11yHelper; + static GtkMacAccessibleBackend () + { + a11yHelper = new AccerssibilityHelper (); + } + + public override void MakeAnnouncement (string message, bool polite = false) + { + a11yHelper.MakeAnnouncement (message, polite); + } + + public override bool AccessibilityInUse => a11yHelper.AccessibilityInUse; + + public override event EventHandler AccessibilityInUseChanged + { + add + { + a11yHelper.AccessibilityInUseChanged += value; + } + remove + { + a11yHelper.AccessibilityInUseChanged -= value; + } + } + } +} diff --git a/Xwt.Gtk.Mac/GtkMacAccessibleBackend.cs b/Xwt.Gtk.Mac/GtkMacAccessibleBackend.cs index 444ed993..8c247453 100644 --- a/Xwt.Gtk.Mac/GtkMacAccessibleBackend.cs +++ b/Xwt.Gtk.Mac/GtkMacAccessibleBackend.cs @@ -34,7 +34,7 @@ using GtkWidget = Gtk.Widget; namespace Xwt.Gtk.Mac { - public class GtkMacAccessibleBackend : AccessibleBackend + public partial class GtkMacAccessibleBackend : AccessibleBackend { public GtkMacAccessibleBackend () { diff --git a/Xwt.Gtk.Mac/Xwt.Gtk.Mac.csproj b/Xwt.Gtk.Mac/Xwt.Gtk.Mac.csproj index 472c3bbf..203551d9 100644 --- a/Xwt.Gtk.Mac/Xwt.Gtk.Mac.csproj +++ b/Xwt.Gtk.Mac/Xwt.Gtk.Mac.csproj @@ -66,6 +66,10 @@ <Link>NSApplicationInitializer.cs</Link> </Compile> <Compile Include="GtkMacAccessibleBackend.cs" /> + <Compile Include="GtkMacAccessibleBackend.AccessibilityHelper.cs" /> + <Compile Include="..\Xwt.XamMac\Xwt.Mac\AccerssibilityHelper.cs"> + <Link>AccerssibilityHelper.cs</Link> + </Compile> </ItemGroup> <Import Project="..\BuildHelpers.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |