nsIAccessible
From MDC
The nsIAccessible interface is a cross-platform interface that supports platform-specific accessibility APIs like MSAA and ATK. Contains the sum of what's needed to support IAccessible as well as ATK's generic accessibility objects.
Can also be used by in-process accessibility clients to get information about objects in the accessible tree. The accessible tree is a subset of nodes in the DOM tree -- such as documents, focusable elements and text. Mozilla creates the implementations of nsIAccessible on demand.
See: http://www.mozilla.org/projects/ui/accessibility for more information.
nsIAccessible is defined in accessible/public/nsIAccessible.idl. It is scriptable and
is currently under review.
Inherits from: nsISupports
[edit] Method overview
nsIDOMDOMStringList getKeyBindings(in PRUint8 aActionIndex);
|
void getFinalState(out unsigned long aState, out unsigned long aExtraState);
|
void groupPosition(out long aGroupLevel, out long aSimilarItemsInGroup, out long aPositionInGroup);
|
nsIAccessible getChildAtPoint(in long x, in long y);
|
nsIAccessible getChildAt(in long aChildIndex);
|
nsIAccessible getAccessibleToRight();
|
nsIAccessible getAccessibleToLeft();
|
nsIAccessible getAccessibleAbove();
|
nsIAccessible getAccessibleBelow();
|
nsIAccessible getAccessibleRelated(in unsigned long aRelationType);
|
nsIAccessibleRelation getRelation(in unsigned long index);
|
nsIArray getRelations();
|
void getBounds(out long x, out long y, out long width, out long height);
|
void setSelected(in boolean isSelected);
|
void extendSelection();
|
void takeSelection();
|
void takeFocus();
|
AString getActionName(in PRUint8 index);
|
AString getActionDescription(in PRUint8 aIndex);
|
void doAction(in PRUint8 index);
|
[edit] Attributes
| Attribute | Type | Description |
parent
| nsIAccessible
| Parent node in accessible tree. |
nextSibling
| nsIAccessible
| Next sibling in accessible tree. |
previousSibling
| nsIAccessible
| Previous sibling in accessible tree. |
firstChild
| nsIAccessible
| First child in accessible tree. |
lastChild
| nsIAccessible
| Last child in accessible tree. |
children
| nsIArray
| Array of all this element's children. |
childCount
| long
| Number of accessible children. |
indexInParent
| long
| The 0-based index of this accessible in its parent's list of children, or -1 if this accessible does not have a parent.
|
name
| AString
| Accessible name -- the main text equivalent for this node. |
value
| AString
| Accessible value -- a number or a secondary text equivalent for this node. Widgets that use role attribute can force a value using the valuenow attribute. |
description
| AString
| Accessible description -- long text associated with this node. |
keyboardShortcut
| AString
| Provides localized string of accesskey name, such as Alt+D. The modifier may be affected by user and platform preferences. Usually alt+letter, or just the letter alone for menu items..
|
defaultKeyBinding
| AString
| Provides localized string of global keyboard accelerator for default action, such as Ctrl+O for Open file.
|
role
| unsigned long
| Natural enumerated accessible role for the associated element. The values depend on platform because of variations. See the ROLE_* constants defined in nsIAccessibleRole.
This does not take into account role attribute as the |
finalRole
| unsigned long
| Enumerated accessible role. The values depend on platform because of variations. See the ROLE_* constants defined in nsIAccessibleRole. Widgets can use role attribute to force the final role
|
help
| AString
| Help text associated with node. |
focusedChild
| nsIAccessible
| Focused accessible child of node. |
attributes
| nsIPersistentProperties
| Attributes of accessible. |
relationsCount
| unsigned long
| Returns the number of accessible relations for this object. |
numActions
| PRUint8
| The number of accessible actions associated with this accessible. |
[edit] Methods
[edit] getKeyBindings()
This method provides array of localized string of global keyboard accelerator for the given action index supported by accessible.
nsIDOMDOMStringList getKeyBindings( in PRUint8 aActionIndex );
[edit] Parameters
- aActionIndex
- Index of the given action.
[edit] Return value
Returns array of localized string of global keyboard accelerator.
[edit] getFinalState()
This method retrieves a final state. Accessible states -- bit fields which describe boolean properties of node. Many states are only valid given a certain role attribute that supports them.
void getFinalState( out unsigned long aState, out unsigned long aExtraState );
[edit] Parameters
- aState
- The first bit field (See:
nsIAccessibleStatesSTATE_*constants). - aExtraState
- The second bit field (See:
nsIAccessibleStatesEXT_STATE_*constants).
[edit] groupPosition()
This method returns grouping information. Used for tree items, list items, tab panel labels, radio buttons, etc. Also used for collectons of non-text objects.
void groupPosition( out long aGroupLevel, out long aSimilarItemsInGroup, out long aPositionInGroup );
[edit] Parameters
- aGroupLevel
- 1-based, similar to ARIA
levelproperty. - aSimilarItemsInGroup
- 1-based, similar to ARIA
setsizeproperty, inclusive of the current item. - aPositionInGroup
- 1-based, similar to ARIA
posinsetproperty.
[edit] getChildAtPoint()
This method returns an accessible child which contains the coordinate at (x, y) in screen pixels.
If the point is in the current accessible but not in a child, the current accessible will be returned.
If the point is in neither the current accessible or a child, then NULL will be returned.
nsIAccessible getChildAtPoint( in long x, in long y );
[edit] Parameters
- x
- Accessible's X-coordinate.
- y
- Accessible's Y-coordinate.
[edit] Return value
Returns an accessible child at given (x, y) coordinate.
[edit] getChildAt()
This method returns Nth accessible child using zero-based index or last child if index than less than zero.
nsIAccessible getChildAt( in long aChildIndex );
[edit] Parameters
- aChildIndex
- The index of the Nth child.
[edit] Return value
Returns Nth accessible child using zero-based index or last child if index is less than zero.
[edit] getAccessibleToRight()
This method returns an accessible node geometrically to the right of this one.
nsIAccessible getAccessibleToRight();
[edit] Parameters
None.
[edit] Return value
Returns an accessible node geometrically to the right of this one.
[edit] getAccessibleToLeft()
This method returns an accessible node geometrically to the left of this one.
nsIAccessible getAccessibleToLeft();
[edit] Parameters
None.
[edit] Return value
Returns an accessible node geometrically to the left of this one.
[edit] getAccessibleAbove()
This method returns an accessible node geometrically above this one.
nsIAccessible getAccessibleAbove();
[edit] Parameters
None.
[edit] Return value
Returns an accessible node geometrically above this one.
[edit] getAccessibleBelow()
This method returns an accessible node geometrically below this one.
nsIAccessible getAccessibleBelow();
[edit] Parameters
None.
[edit] Return value
Returns an accessible node geometrically below this one.
[edit] getAccessibleRelated()
This method returns an accessible related to this one by the given relation type (See: constants defined in nsIAccessibleRelation).
nsIAccessible getAccessibleRelated( in unsigned long aRelationType );
[edit] Parameters
- aRelationType
- The relation type between the accessible.
[edit] Return value
Returns an accessible which is related to the one provided by the given relation type.
[edit] getRelation()
This method returns one accessible relation for this object.
nsIAccessibleRelation getRelation( in unsigned long index );
[edit] Parameters
- index
- The index for which relation is to be retrieved.
[edit] Return value
Returns one accessible relation for this object.
[edit] getRelations()
This method returns multiple accessible relations for this object.
nsIArray getRelations();
[edit] Parameters
None.
[edit] Return value
Returns multiple accessible relations for this object.
[edit] getBounds()
This method returns accessible's (x and y) coordinates relative to the screen and accessible's width and height.
void getBounds( out long x, out long y, out long width, out long height );
[edit] Parameters
- x
- Accessible's X-coordinate.
- y
- Accessible's Y-coordinate.
- width
- Accessible's width.
- height
- Accessible's height.
[edit] Return value
Returns accessible's (x and y) coordinates relative to the screen and accessible's width and height.
[edit] setSelected()
This method adds or remove this accessible to the current selection.
void setSelected( in boolean isSelected );
[edit] Parameters
- isSelected
- The current selection.
[edit] extendSelection()
This method extends the current selection from its current accessible anchor node to this accessible.
void extendSelection();
[edit] Parameters
None.
[edit] takeSelection()
This method selects this accessible node only.
void takeSelection();
[edit] Parameters
None.
[edit] takeFocus()
This method focuses this accessible node.
The state STATE_FOCUSABLE indicates whether this node is normally focusable. It is the callers responsibility to determine whether this node is focusable.accTakeFocus on a node that is not normally focusable (such as a table), will still set focus on that node, although normally that will not be visually indicated in most style sheets.
void takeFocus();
[edit] Parameters
None.
[edit] getActionName()
This method retrieves the name of the accessible action at the given zero-based index.
AString getActionName( in PRUint8 index );
[edit] Parameters
- index
- The zero-based index.
[edit] Return value
Returns the name of the accessible action.
[edit] getActionDescription()
This method retrieves the description of the accessible action at the given zero-based index.
AString getActionDescription( in PRUint8 aIndex );
[edit] Parameters
- aIndex
- The zero-based index.
[edit] Return value
Returns the description of the accessible action.
[edit] doAction()
This method performs the accessible action at the given zero-based index. Action number 0 is the default action.
void doAction( in PRUint8 index );
[edit] Parameters
- index
- The zero-based index.