-
Notifications
You must be signed in to change notification settings - Fork 997
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement TextPattern support for Text controls
- Implement base integration to AccessibleObject - Add TextPattern support for TextBox (singleline and multiline) and MaskedTextBox - Disable managed UiaTextProvider for RichTextBox to use native provider as the native Win32 RichEdit control already supports TextPattern. Return ControlAccessibleObject as AccessibilityInstance instead TextBoxBaseAccessibleObject (the latter supports managed UiaTextProvider). - Add tests Fixes #1588
- Loading branch information
1 parent
7545756
commit f2baffc
Showing
15 changed files
with
1,792 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
~override System.Windows.Forms.RichTextBox.CreateAccessibilityInstance() -> System.Windows.Forms.AccessibleObject | ||
~override System.Windows.Forms.TextBox.OnKeyUp(System.Windows.Forms.KeyEventArgs e) -> void | ||
~override System.Windows.Forms.TextBox.OnMouseDown(System.Windows.Forms.MouseEventArgs e) -> void |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/System.Windows.Forms/src/System/Windows/Forms/TextBoxBase.TextBoxBaseAccessibleObject.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using static Interop; | ||
|
||
namespace System.Windows.Forms | ||
{ | ||
public abstract partial class TextBoxBase | ||
{ | ||
internal class TextBoxBaseAccessibleObject : ControlAccessibleObject | ||
{ | ||
private readonly TextBoxBase _owningTextBoxBase; | ||
private readonly TextBoxBaseUiaTextProvider _textProvider; | ||
|
||
public TextBoxBaseAccessibleObject(TextBoxBase owner) : base(owner) | ||
{ | ||
_owningTextBoxBase = owner; | ||
_textProvider = new TextBoxBaseUiaTextProvider(owner); | ||
|
||
UseTextProviders(_textProvider, _textProvider); | ||
} | ||
|
||
internal override bool IsIAccessibleExSupported() => true; | ||
|
||
internal override bool IsPatternSupported(UiaCore.UIA patternId) => | ||
patternId switch | ||
{ | ||
UiaCore.UIA.TextPatternId => true, | ||
UiaCore.UIA.TextPattern2Id => true, | ||
_ => base.IsPatternSupported(patternId) | ||
}; | ||
|
||
internal override object? GetPropertyValue(UiaCore.UIA propertyID) => | ||
propertyID switch | ||
{ | ||
UiaCore.UIA.IsTextPatternAvailablePropertyId => IsPatternSupported(UiaCore.UIA.TextPatternId), | ||
UiaCore.UIA.IsTextPattern2AvailablePropertyId => IsPatternSupported(UiaCore.UIA.TextPattern2Id), | ||
UiaCore.UIA.IsValuePatternAvailablePropertyId => IsPatternSupported(UiaCore.UIA.ValuePatternId), | ||
_ => base.GetPropertyValue(propertyID) | ||
}; | ||
|
||
internal override bool IsReadOnly => _owningTextBoxBase.ReadOnly; | ||
} | ||
} | ||
} |
Oops, something went wrong.