Browse Source
Post NSAccessibility notifications for property changes on macOS (#21074)
pull/21083/head
Jumar Macato
4 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
48 additions and
2 deletions
-
native/Avalonia.Native/src/OSX/AvnWindow.mm
-
native/Avalonia.Native/src/OSX/automation.mm
-
src/Avalonia.Native/AvnAutomationPeer.cs
-
src/Avalonia.Native/avn.idl
|
|
|
@ -656,6 +656,18 @@ |
|
|
|
|
|
|
|
- (void)raisePropertyChanged:(AvnAutomationProperty)property |
|
|
|
{ |
|
|
|
switch (property) |
|
|
|
{ |
|
|
|
case AutomationPeer_Name: |
|
|
|
NSAccessibilityPostNotification(self, NSAccessibilityTitleChangedNotification); |
|
|
|
break; |
|
|
|
case AutomationPeer_BoundingRectangle: |
|
|
|
NSAccessibilityPostNotification(self, NSAccessibilityMovedNotification); |
|
|
|
NSAccessibilityPostNotification(self, NSAccessibilityResizedNotification); |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@end |
|
|
|
|
|
|
|
@ -488,8 +488,32 @@ |
|
|
|
|
|
|
|
- (void)raisePropertyChanged:(AvnAutomationProperty)property |
|
|
|
{ |
|
|
|
if (property == AutomationPeer_Name && _peer->GetLiveSetting() != LiveSettingOff) |
|
|
|
[self raiseLiveRegionChanged]; |
|
|
|
switch (property) |
|
|
|
{ |
|
|
|
case AutomationPeer_Name: |
|
|
|
NSAccessibilityPostNotification(self, NSAccessibilityTitleChangedNotification); |
|
|
|
if (_peer->GetLiveSetting() != LiveSettingOff) |
|
|
|
[self raiseLiveRegionChanged]; |
|
|
|
break; |
|
|
|
case ValueProvider_Value: |
|
|
|
case RangeValueProvider_Value: |
|
|
|
NSAccessibilityPostNotification(self, NSAccessibilityValueChangedNotification); |
|
|
|
break; |
|
|
|
case AutomationPeer_BoundingRectangle: |
|
|
|
NSAccessibilityPostNotification(self, NSAccessibilityMovedNotification); |
|
|
|
NSAccessibilityPostNotification(self, NSAccessibilityResizedNotification); |
|
|
|
break; |
|
|
|
case SelectionItemProvider_IsSelected: |
|
|
|
case SelectionProvider_Selection: |
|
|
|
NSAccessibilityPostNotification(self, NSAccessibilitySelectedChildrenChangedNotification); |
|
|
|
break; |
|
|
|
case ToggleProvider_ToggleState: |
|
|
|
case ExpandCollapseProvider_ExpandCollapseState: |
|
|
|
NSAccessibilityPostNotification(self, NSAccessibilityValueChangedNotification); |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
- (void)raiseLiveRegionChanged |
|
|
|
|
|
|
|
@ -19,6 +19,11 @@ namespace Avalonia.Native |
|
|
|
{ AutomationElementIdentifiers.ClassNameProperty, AvnAutomationProperty.AutomationPeer_ClassName }, |
|
|
|
{ AutomationElementIdentifiers.NameProperty, AvnAutomationProperty.AutomationPeer_Name }, |
|
|
|
{ RangeValuePatternIdentifiers.ValueProperty, AvnAutomationProperty.RangeValueProvider_Value }, |
|
|
|
{ ValuePatternIdentifiers.ValueProperty, AvnAutomationProperty.ValueProvider_Value }, |
|
|
|
{ TogglePatternIdentifiers.ToggleStateProperty, AvnAutomationProperty.ToggleProvider_ToggleState }, |
|
|
|
{ ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty, AvnAutomationProperty.ExpandCollapseProvider_ExpandCollapseState }, |
|
|
|
{ SelectionItemPatternIdentifiers.IsSelectedProperty, AvnAutomationProperty.SelectionItemProvider_IsSelected }, |
|
|
|
{ SelectionPatternIdentifiers.SelectionProperty, AvnAutomationProperty.SelectionProvider_Selection }, |
|
|
|
}; |
|
|
|
|
|
|
|
private static readonly ConditionalWeakTable<AutomationPeer, AvnAutomationPeer> s_wrappers = new(); |
|
|
|
|
|
|
|
@ -403,6 +403,11 @@ enum AvnAutomationProperty |
|
|
|
AutomationPeer_ClassName, |
|
|
|
AutomationPeer_Name, |
|
|
|
RangeValueProvider_Value, |
|
|
|
ValueProvider_Value, |
|
|
|
ToggleProvider_ToggleState, |
|
|
|
ExpandCollapseProvider_ExpandCollapseState, |
|
|
|
SelectionItemProvider_IsSelected, |
|
|
|
SelectionProvider_Selection, |
|
|
|
} |
|
|
|
|
|
|
|
struct AvnSize |
|
|
|
|