diff options
author | iain holmes <iain@xamarin.com> | 2017-02-01 17:54:21 +0300 |
---|---|---|
committer | iain holmes <iain@xamarin.com> | 2017-02-01 17:54:21 +0300 |
commit | c6ea39b95758bc6965446dad957f0a05d036366b (patch) | |
tree | f2cc50e191cfabf086f300c5ffb3f5384e7611d5 | |
parent | 57c1a39f3a3e2173a0c2d785bc0fcab83e9010cb (diff) |
[A11y] Add AtkCocoaHelpers to set attributes on CellRenderers
AtkCocoa now attaches the NSAccessibility element to a cell renderer when its
cell data function is being called so that cell renderers with custom data functions
can set accessibility attributes appropriately
2 files changed, 29 insertions, 1 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AtkCocoaHelper/AtkCocoaHelperMac.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AtkCocoaHelper/AtkCocoaHelperMac.cs index a7b131ad46..106c8c6066 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AtkCocoaHelper/AtkCocoaHelperMac.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AtkCocoaHelper/AtkCocoaHelperMac.cs @@ -41,7 +41,7 @@ namespace MonoDevelop.Components.AtkCocoaHelper public static class AtkCocoaMacExtensions { const string XamarinPrivateAtkCocoaNSAccessibilityKey = "xamarin-private-atkcocoa-nsaccessibility"; - internal static INSAccessibility GetNSAccessibilityElement (Atk.Object o) + internal static INSAccessibility GetNSAccessibilityElement (GLib.Object o) { IntPtr handle = GtkWorkarounds.GetData (o, XamarinPrivateAtkCocoaNSAccessibilityKey); @@ -90,6 +90,26 @@ namespace MonoDevelop.Components.AtkCocoaHelper nsa.AccessibilityLabel = label; } + public static void SetAccessibilityLabel (this Gtk.CellRenderer r, string label) + { + var nsa = GetNSAccessibilityElement (r); + if (nsa == null) { + return; + } + + nsa.AccessibilityLabel = label; + } + + public static void SetAccessibilityDescription (this Gtk.CellRenderer r, string description) + { + var nsa = GetNSAccessibilityElement (r); + if (nsa == null) { + return; + } + + nsa.AccessibilityHelp = description; + } + public static void SetAccessibilityShouldIgnore (this Atk.Object o, bool ignore) { var nsa = GetNSAccessibilityElement (o); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AtkCocoaHelper/AtkCocoaHelperNoOp.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AtkCocoaHelper/AtkCocoaHelperNoOp.cs index ba152e1c62..aa4a7a9ae0 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AtkCocoaHelper/AtkCocoaHelperNoOp.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AtkCocoaHelper/AtkCocoaHelperNoOp.cs @@ -38,6 +38,14 @@ namespace MonoDevelop.Components.AtkCocoaHelper { } + public static void SetAccessibilityLabel (this Gtk.CellRenderer r, string label) + { + } + + public static void SetAccessibilityDescription (this Gtk.CellRenderer r, string description) + { + } + public static void SetAccessibilityShouldIgnore (this Atk.Object o, bool ignore) { } |