ItemStatus and ItemType UIA properties (#20669)
* ItemStatus and ItemType UIA properties * ItemStatus property change notification --------- Co-authored-by: Jan Kučera <miloush@users.noreply.github.com>
This commit is contained in:
@@ -31,6 +31,12 @@ namespace Avalonia.Automation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static AutomationProperty HelpTextProperty { get; } = new AutomationProperty();
|
public static AutomationProperty HelpTextProperty { get; } = new AutomationProperty();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies the itemStatus automation property. The class name property value is returned
|
||||||
|
/// by the <see cref="AutomationPeer.GetItemStatus"/> method.
|
||||||
|
/// </summary>
|
||||||
|
public static AutomationProperty ItemStatusProperty { get; } = new AutomationProperty();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Identifies the landmark type automation property. The class name property value is returned
|
/// Identifies the landmark type automation property. The class name property value is returned
|
||||||
/// by the <see cref="AutomationPeer.GetLandmarkType"/> method.
|
/// by the <see cref="AutomationPeer.GetLandmarkType"/> method.
|
||||||
|
|||||||
@@ -319,6 +319,41 @@ namespace Avalonia.Automation.Peers
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
public int GetHeadingLevel() => GetHeadingLevelCore();
|
public int GetHeadingLevel() => GetHeadingLevelCore();
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the item type that is associated with this automation peer.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// <list type="table">
|
||||||
|
/// <item>
|
||||||
|
/// <term>Windows</term>
|
||||||
|
/// <description><c>UIA_ItemTypePropertyId</c></description>
|
||||||
|
/// </item>
|
||||||
|
/// <item>
|
||||||
|
/// <term>macOS</term>
|
||||||
|
/// <description>No mapping.</description>
|
||||||
|
/// </item>
|
||||||
|
/// </list>
|
||||||
|
/// </remarks>
|
||||||
|
public string? GetItemType() => GetItemTypeCore();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the item status that is associated with this automation peer.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// <list type="table">
|
||||||
|
/// <item>
|
||||||
|
/// <term>Windows</term>
|
||||||
|
/// <description><c>UIA_ItemStatusPropertyId</c></description>
|
||||||
|
/// </item>
|
||||||
|
/// <item>
|
||||||
|
/// <term>macOS</term>
|
||||||
|
/// <description>No mapping.</description>
|
||||||
|
/// </item>
|
||||||
|
/// </list>
|
||||||
|
/// </remarks>
|
||||||
|
public string? GetItemStatus() => GetItemStatusCore();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the <see cref="AutomationPeer"/> that is the parent of this <see cref="AutomationPeer"/>.
|
/// Gets the <see cref="AutomationPeer"/> that is the parent of this <see cref="AutomationPeer"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -562,6 +597,8 @@ namespace Avalonia.Automation.Peers
|
|||||||
protected virtual string? GetHelpTextCore() => null;
|
protected virtual string? GetHelpTextCore() => null;
|
||||||
protected virtual AutomationLandmarkType? GetLandmarkTypeCore() => null;
|
protected virtual AutomationLandmarkType? GetLandmarkTypeCore() => null;
|
||||||
protected virtual int GetHeadingLevelCore() => 0;
|
protected virtual int GetHeadingLevelCore() => 0;
|
||||||
|
protected virtual string? GetItemTypeCore() => null;
|
||||||
|
protected virtual string? GetItemStatusCore() => null;
|
||||||
protected abstract AutomationPeer? GetParentCore();
|
protected abstract AutomationPeer? GetParentCore();
|
||||||
protected abstract bool HasKeyboardFocusCore();
|
protected abstract bool HasKeyboardFocusCore();
|
||||||
protected abstract bool IsContentElementCore();
|
protected abstract bool IsContentElementCore();
|
||||||
|
|||||||
@@ -199,6 +199,8 @@ namespace Avalonia.Automation.Peers
|
|||||||
protected override string? GetAutomationIdCore() => AutomationProperties.GetAutomationId(Owner) ?? Owner.Name;
|
protected override string? GetAutomationIdCore() => AutomationProperties.GetAutomationId(Owner) ?? Owner.Name;
|
||||||
protected override Rect GetBoundingRectangleCore() => GetBounds(Owner);
|
protected override Rect GetBoundingRectangleCore() => GetBounds(Owner);
|
||||||
protected override string GetClassNameCore() => Owner.GetType().Name;
|
protected override string GetClassNameCore() => Owner.GetType().Name;
|
||||||
|
protected override string? GetItemStatusCore() => AutomationProperties.GetItemStatus(Owner);
|
||||||
|
protected override string? GetItemTypeCore() => AutomationProperties.GetItemType(Owner);
|
||||||
protected override bool HasKeyboardFocusCore() => Owner.IsFocused;
|
protected override bool HasKeyboardFocusCore() => Owner.IsFocused;
|
||||||
protected override bool IsContentElementCore() => true;
|
protected override bool IsContentElementCore() => true;
|
||||||
protected override bool IsControlElementCore() => true;
|
protected override bool IsControlElementCore() => true;
|
||||||
@@ -281,6 +283,13 @@ namespace Avalonia.Automation.Peers
|
|||||||
{
|
{
|
||||||
InvalidateParent();
|
InvalidateParent();
|
||||||
}
|
}
|
||||||
|
else if (e.Property == AutomationProperties.ItemStatusProperty)
|
||||||
|
{
|
||||||
|
RaisePropertyChangedEvent(
|
||||||
|
AutomationElementIdentifiers.ItemStatusProperty,
|
||||||
|
e.OldValue,
|
||||||
|
e.NewValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ namespace Avalonia.Win32.Automation
|
|||||||
{ AutomationElementIdentifiers.HelpTextProperty, UiaPropertyId.HelpText },
|
{ AutomationElementIdentifiers.HelpTextProperty, UiaPropertyId.HelpText },
|
||||||
{ AutomationElementIdentifiers.LandmarkTypeProperty, UiaPropertyId.LandmarkType },
|
{ AutomationElementIdentifiers.LandmarkTypeProperty, UiaPropertyId.LandmarkType },
|
||||||
{ AutomationElementIdentifiers.HeadingLevelProperty, UiaPropertyId.HeadingLevel },
|
{ AutomationElementIdentifiers.HeadingLevelProperty, UiaPropertyId.HeadingLevel },
|
||||||
|
{ AutomationElementIdentifiers.ItemStatusProperty, UiaPropertyId.ItemStatus },
|
||||||
{ ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty, UiaPropertyId.ExpandCollapseExpandCollapseState },
|
{ ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty, UiaPropertyId.ExpandCollapseExpandCollapseState },
|
||||||
{ RangeValuePatternIdentifiers.IsReadOnlyProperty, UiaPropertyId.RangeValueIsReadOnly},
|
{ RangeValuePatternIdentifiers.IsReadOnlyProperty, UiaPropertyId.RangeValueIsReadOnly},
|
||||||
{ RangeValuePatternIdentifiers.MaximumProperty, UiaPropertyId.RangeValueMaximum },
|
{ RangeValuePatternIdentifiers.MaximumProperty, UiaPropertyId.RangeValueMaximum },
|
||||||
@@ -135,6 +136,8 @@ namespace Avalonia.Win32.Automation
|
|||||||
UiaPropertyId.IsEnabled => InvokeSync(() => Peer.IsEnabled()),
|
UiaPropertyId.IsEnabled => InvokeSync(() => Peer.IsEnabled()),
|
||||||
UiaPropertyId.IsKeyboardFocusable => InvokeSync(() => Peer.IsKeyboardFocusable()),
|
UiaPropertyId.IsKeyboardFocusable => InvokeSync(() => Peer.IsKeyboardFocusable()),
|
||||||
UiaPropertyId.IsOffscreen => InvokeSync(() => Peer.IsOffscreen()),
|
UiaPropertyId.IsOffscreen => InvokeSync(() => Peer.IsOffscreen()),
|
||||||
|
UiaPropertyId.ItemType => InvokeSync(() => Peer.GetItemType()),
|
||||||
|
UiaPropertyId.ItemStatus => InvokeSync(() => Peer.GetItemStatus()),
|
||||||
UiaPropertyId.LocalizedControlType => InvokeSync(() => Peer.GetLocalizedControlType()),
|
UiaPropertyId.LocalizedControlType => InvokeSync(() => Peer.GetLocalizedControlType()),
|
||||||
UiaPropertyId.Name => InvokeSync(() => Peer.GetName()),
|
UiaPropertyId.Name => InvokeSync(() => Peer.GetName()),
|
||||||
UiaPropertyId.HelpText => InvokeSync(() => Peer.GetHelpText()),
|
UiaPropertyId.HelpText => InvokeSync(() => Peer.GetHelpText()),
|
||||||
|
|||||||
Reference in New Issue
Block a user