Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Text pattern to UpDownControls #3878

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/System.Windows.Forms/src/Resources/SR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -6731,4 +6731,7 @@ Stack trace where the illegal operation occurred was:
<data name="PropertyGridViewDropDownControlHolderAccessibleName" xml:space="preserve">
<value>Drop down control holder</value>
</data>
<data name="UpDownEditLocalizedControlTypeName" xml:space="preserve">
<value>Edit</value>
</data>
</root>
5 changes: 5 additions & 0 deletions src/System.Windows.Forms/src/Resources/xlf/SR.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/System.Windows.Forms/src/Resources/xlf/SR.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/System.Windows.Forms/src/Resources/xlf/SR.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/System.Windows.Forms/src/Resources/xlf/SR.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/System.Windows.Forms/src/Resources/xlf/SR.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/System.Windows.Forms/src/Resources/xlf/SR.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/System.Windows.Forms/src/Resources/xlf/SR.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/System.Windows.Forms/src/Resources/xlf/SR.pl.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/System.Windows.Forms/src/Resources/xlf/SR.pt-BR.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/System.Windows.Forms/src/Resources/xlf/SR.ru.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/System.Windows.Forms/src/Resources/xlf/SR.tr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hans.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hant.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// 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 UpDownBase
{
internal partial class UpDownEdit
{
internal class UpDownEditAccessibleObject : ControlAccessibleObject
{
private readonly UpDownEdit _owningUpDownEdit;
private readonly TextBoxBaseUiaTextProvider _textProvider;
private readonly UpDownBase _parent;

public UpDownEditAccessibleObject(UpDownEdit owner, UpDownBase parent) : base(owner)
{
_parent = parent ?? throw new ArgumentNullException(nameof(parent));
_owningUpDownEdit = owner;
_textProvider = new TextBoxBaseUiaTextProvider(owner);
UseTextProviders(_textProvider, _textProvider);
}

internal override bool IsIAccessibleExSupported() => true;

public override string? Name
{
get => _parent.AccessibilityObject.Name;
set => _parent.AccessibilityObject.Name = value;
}

public override string? KeyboardShortcut => _parent.AccessibilityObject.KeyboardShortcut;

internal override object? GetPropertyValue(UiaCore.UIA propertyID)
=> propertyID switch
{
UiaCore.UIA.IsTextPatternAvailablePropertyId => IsPatternSupported(UiaCore.UIA.TextPatternId),
UiaCore.UIA.IsTextPattern2AvailablePropertyId => IsPatternSupported(UiaCore.UIA.TextPattern2Id),
_ => base.GetPropertyValue(propertyID),
};

internal override bool IsPatternSupported(UiaCore.UIA patternId)
=> patternId switch
{
UiaCore.UIA.TextPatternId => true,
UiaCore.UIA.TextPattern2Id => true,
_ => base.IsPatternSupported(patternId)
};

internal override bool IsReadOnly => _owningUpDownEdit.ReadOnly;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// 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.

Expand All @@ -11,7 +11,7 @@ namespace System.Windows.Forms
{
public abstract partial class UpDownBase
{
internal class UpDownEdit : TextBox
internal partial class UpDownEdit : TextBox
{
private readonly UpDownBase _parent;
private bool _doubleClickFired;
Expand All @@ -30,11 +30,13 @@ public override string Text
set
{
bool valueChanged = (value != base.Text);
base.Text = value;
if (valueChanged)
{
AccessibilityNotifyClients(AccessibleEvents.NameChange, -1);
AccessibilityObject.RaiseAutomationNotification(Automation.AutomationNotificationKind.ActionCompleted,
Automation.AutomationNotificationProcessing.CurrentThenMostRecent, SR.UpDownEditLocalizedControlTypeName);
AccessibilityObject.RaiseAutomationEvent(UiaCore.UIA.Text_TextChangedEventId);
}
base.Text = value;
}
}

Expand Down Expand Up @@ -108,24 +110,6 @@ protected override void OnGotFocus(EventArgs e)

protected override void OnLostFocus(EventArgs e)
=> _parent.InvokeLostFocus(_parent, e);

internal class UpDownEditAccessibleObject : ControlAccessibleObject
{
readonly UpDownBase _parent;

public UpDownEditAccessibleObject(UpDownEdit owner, UpDownBase parent) : base(owner)
{
_parent = parent;
}

public override string Name
{
get => _parent.AccessibilityObject.Name;
set => _parent.AccessibilityObject.Name = value;
}

public override string KeyboardShortcut => _parent.AccessibilityObject.KeyboardShortcut;
}
}
}
}

This file was deleted.

Loading