Accessibility/Comparisons:ATK To UA: Difference between revisions
(start of ATK to UA) |
No edit summary |
||
Line 25: | Line 25: | ||
; AXChildrenAttribute : will return an array of all accessible children of the widget, skipping any ignored widgets on the way. | ; AXChildrenAttribute : will return an array of all accessible children of the widget, skipping any ignored widgets on the way. | ||
; AXParentAttribute : will return the accessible parent of this widget, skipping any ignored widgets on the way. | ; AXParentAttribute : will return the accessible parent of this widget, skipping any ignored widgets on the way. | ||
== Traversing the DOM (AtkDocument) == | |||
This does not currently exist in UA, like with many things that are web-specific. | |||
== Text editing (AtkEditableText) == | |||
=== Basic === | |||
To get/set the value of a text widget you use the [http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSAccessibility_Protocol/Reference/Reference.html#//apple_ref/doc/c_ref/NSAccessibilityValueAttribute AXValueAttribute]. There are also some [http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSAccessibility_Protocol/Reference/Reference.html#//apple_ref/doc/uid/20000945-DontLinkElementID_2 text-specific attributes]. | |||
Copying, cutting, pasting etc. are not actions in UA, but the user invokes the menu on the text widget ([http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSAccessibility_Protocol/Reference/Reference.html#//apple_ref/doc/c_ref/NSAccessibilityShowMenuAction AXShowMenu action]) and then picks the action (copy, paste, cut, etc). | |||
A third-party could of course use standard Cocoa methods on the text widget to let the user perform this in some other way. | |||
=== Rich text-editing === | |||
Rich text-editing is done by querying a text widget for [http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSAccessibility_Protocol/Reference/Reference.html#//apple_ref/doc/uid/20000945-DontLinkElementID_3 the attributes of specific ranges]. For example, you can: | |||
* Get the bounds of a range | |||
* Get the styled text of a range (as an NSAttributedText object) | |||
* Get the range for a line, or an index, or all visible characters | |||
etc. |
Revision as of 15:53, 29 May 2006
ATK to UA, interfaces
This page provides an overview how to do some common operations in UA, when a developer is used to ATK. I highgly recommend to read the introduction to UA before reading this document.
Any developer serious in implementing UA support should always read Apple's official accessibility documentation; this is by no means an end-all be-all document, but can give you an idea about how things work. Feel free to add and edit entries.
Interfaces
Actions (AtkAction)
There are only three APIs dealing with actions in UA:
- accessibilityActionNames
- gives an array of strings telling the available actions that this widget supports.
- accessibilityActionDescription
- returns a human-readable (localized) description of a specified action.
- accessibilityPerformAction
- performs a specified action.
Making a view/widget accessible (AtkComponent)
In UA, every widget has to implement a few methods to be made accessible. Those views that are invisible, and uninteresting to the user should implement the accessibilityIsIgnored method to return NO (false).
The position and size of a widget is not accessible-specific, so you call the necessary NSView methods to get that information.
Hit-testing (getting the accessible object at a given point on the screen) can be done using the accessibilityHitTest: method on any view.
To get the currently focused widget's accessibility object, accessibilityFocusedUIElement is used, which will return the deepest accessible descendant.
To set focus, there is the AXFocused attribute that is often settable. To see if a specified attribute is settable, use the accessibilityIsAttributeSettable: and then accessibilitySetValue:forAttribute: to set it.
To "manually" traverse and inspect the accessibility hierarchy of a view/widget, you get the value of these attributes:
- AXChildrenAttribute
- will return an array of all accessible children of the widget, skipping any ignored widgets on the way.
- AXParentAttribute
- will return the accessible parent of this widget, skipping any ignored widgets on the way.
Traversing the DOM (AtkDocument)
This does not currently exist in UA, like with many things that are web-specific.
Text editing (AtkEditableText)
Basic
To get/set the value of a text widget you use the AXValueAttribute. There are also some text-specific attributes.
Copying, cutting, pasting etc. are not actions in UA, but the user invokes the menu on the text widget (AXShowMenu action) and then picks the action (copy, paste, cut, etc).
A third-party could of course use standard Cocoa methods on the text widget to let the user perform this in some other way.
Rich text-editing
Rich text-editing is done by querying a text widget for the attributes of specific ranges. For example, you can:
- Get the bounds of a range
- Get the styled text of a range (as an NSAttributedText object)
- Get the range for a line, or an index, or all visible characters
etc.