diff options
author | Jose Medrano <jose.medrano@microsoft.com> | 2019-01-10 23:14:23 +0300 |
---|---|---|
committer | Jose Medrano <jose.medrano@microsoft.com> | 2019-01-11 12:09:59 +0300 |
commit | 0fdd4c57f2b91211e88f6aeeb683d97023862f73 (patch) | |
tree | 476e7000a8fd0919ef8c0b606c012f368aa4802a /main/src/addins/MonoDevelop.HexEditor | |
parent | 11e7ed7be84ee38d3cc2aa17592e83cca0fe7721 (diff) |
Adds Accessibility announce in character selection
Diffstat (limited to 'main/src/addins/MonoDevelop.HexEditor')
-rw-r--r-- | main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditor.cs | 18 | ||||
-rw-r--r-- | main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditorDebugger.cs | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditor.cs b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditor.cs index 4689c2a2c9..96300aea81 100644 --- a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditor.cs +++ b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditor.cs @@ -37,6 +37,7 @@ using Xwt; using Mono.MHex.Data; using Mono.MHex.Rendering; using Xwt.Drawing; +using MonoDevelop.Components.AtkCocoaHelper; namespace Mono.MHex { @@ -101,8 +102,12 @@ namespace Mono.MHex public bool IsReadOnly { get; set; } + readonly Gtk.Widget hexWidget; + public HexEditor () { + hexWidget = (Gtk.Widget)Xwt.Toolkit.CurrentEngine.GetNativeWidget (this); + BackgroundColor = Color.FromBytes (0, 0, 0); CanGetFocus = true; HexEditorData = new HexEditorData (); @@ -114,6 +119,7 @@ namespace Mono.MHex if (HexEditorData.Caret.AutoScrollToCaret) ScrollToCaret (); RepaintLine (HexEditorData.Caret.Line); + AnnounceCurrentSelection (); }; HexEditorData.Caret.OffsetChanged += delegate(object sender, CaretLocationEventArgs e) { if (!HexEditorData.Caret.PreserveSelection) @@ -518,6 +524,18 @@ namespace Mono.MHex requestResetCaretBlink = true; } + void AnnounceCurrentSelection () + { + try { + var character = HexEditorData.Bytes [HexEditorData.Caret.Offset]; + var data = Convert.ToString (character, 16); + var message = string.Format ("Selected '{0}' char:'{1}'", data[HexEditorData.Caret.SubPosition], (char)character); + hexWidget.Accessible.MakeAccessibilityAnnouncement (message); + } catch (Exception ex) { + + } + } + public void DrawCaret (Context ctx, Rectangle area) { if (!caretBlink || HexEditorData.IsSomethingSelected) diff --git a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditorDebugger.cs b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditorDebugger.cs index 28bac51da9..68e508820b 100644 --- a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditorDebugger.cs +++ b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex/HexEditorDebugger.cs @@ -80,6 +80,8 @@ namespace Mono.MHex comboBox.Items.Add ("Hex 16"); comboBox.SelectedIndex = 0; editor.Options.StringRepresentationType = StringRepresentationTypes.ASCII; + editor.Accessible.Label = GettextCatalog.GetString ("Hexadecimal Text Editor"); + comboBox.SelectionChanged += delegate { switch (comboBox.SelectedIndex) { case 0: |