Fix property cache hit guarding to-do with the global object (544161, r=jorendorff).
[mozilla-central.git] / accessible / public / nsIAccessible.idl
blobb18137e667399ac4e6a5443912e49e663e00f194
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 2003
20 * the Initial Developer. All Rights Reserved.
22 * Original Author: Eric D Vaughan (evaughan@netscape.com)
23 * Contributor(s): Aaron Leventhal (aaronl@netscape.com)
24 * John Gaunt (jgaunt@netscape.com)
25 * Kyle Yuan (kyle.yuan@sun.com)
26 * HÃ¥kan Waara (hwaara@gmail.com)
28 * Alternatively, the contents of this file may be used under the terms of
29 * either the GNU General Public License Version 2 or later (the "GPL"), or
30 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 * in which case the provisions of the GPL or the LGPL are applicable instead
32 * of those above. If you wish to allow use of your version of this file only
33 * under the terms of either the GPL or the LGPL, and not to allow others to
34 * use your version of this file under the terms of the MPL, indicate your
35 * decision by deleting the provisions above and replace them with the notice
36 * and other provisions required by the GPL or the LGPL. If you do not delete
37 * the provisions above, a recipient may use your version of this file under
38 * the terms of any one of the MPL, the GPL or the LGPL.
40 * ***** END LICENSE BLOCK ***** */
42 #include "nsISupports.idl"
43 #include "nsIArray.idl"
45 interface nsIPersistentProperties;
46 interface nsIDOMDOMStringList;
47 interface nsIAccessibleRelation;
49 /**
50 * A cross-platform interface that supports platform-specific
51 * accessibility APIs like MSAA and ATK. Contains the sum of what's needed
52 * to support IAccessible as well as ATK's generic accessibility objects.
53 * Can also be used by in-process accessibility clients to get information
54 * about objects in the accessible tree. The accessible tree is a subset of
55 * nodes in the DOM tree -- such as documents, focusable elements and text.
56 * Mozilla creates the implementations of nsIAccessible on demand.
57 * See http://www.mozilla.org/projects/ui/accessibility for more information.
59 * @status UNDER_REVIEW
61 [scriptable, uuid(c81d8f8c-8585-4094-bc7c-71dd01494906)]
62 interface nsIAccessible : nsISupports
64 /**
65 * Parent node in accessible tree.
67 readonly attribute nsIAccessible parent;
69 /**
70 * Next sibling in accessible tree
72 readonly attribute nsIAccessible nextSibling;
74 /**
75 * Previous sibling in accessible tree
77 readonly attribute nsIAccessible previousSibling;
79 /**
80 * First child in accessible tree
82 readonly attribute nsIAccessible firstChild;
84 /**
85 * Last child in accessible tree
87 readonly attribute nsIAccessible lastChild;
89 /**
90 * Array of all this element's children.
92 readonly attribute nsIArray children;
94 /**
95 * Number of accessible children
97 readonly attribute long childCount;
99 /**
100 * The 0-based index of this accessible in its parent's list of children,
101 * or -1 if this accessible does not have a parent.
103 readonly attribute long indexInParent;
106 * Accessible name -- the main text equivalent for this node. The name is
107 * specified by ARIA or by native markup. Example of ARIA markup is
108 * aria-labelledby attribute placed on element of this accessible. Example
109 * of native markup is HTML label linked with HTML element of this accessible.
111 * Value can be string or null. A null value indicates that AT may attempt to
112 * compute the name. Any string value, including the empty string, should be
113 * considered author-intentional, and respected.
115 attribute AString name;
118 * Accessible value -- a number or a secondary text equivalent for this node
119 * Widgets that use role attribute can force a value using the valuenow attribute
121 readonly attribute AString value;
124 * Accessible description -- long text associated with this node
126 readonly attribute AString description;
129 * Provides localized string of accesskey name, such as Alt+D.
130 * The modifier may be affected by user and platform preferences.
131 * Usually alt+letter, or just the letter alone for menu items.
133 readonly attribute AString keyboardShortcut;
136 * Provides localized string of global keyboard accelerator for default
137 * action, such as Ctrl+O for Open file
139 readonly attribute AString defaultKeyBinding;
142 * Provides array of localized string of global keyboard accelerator for
143 * the given action index supported by accessible.
145 * @param aActionIndex - index of the given action
147 nsIDOMDOMStringList getKeyBindings(in PRUint8 aActionIndex);
150 * Enumerated accessible role (see the constants defined in nsIAccessibleRole).
152 * @note The values might depend on platform because of variations. Widgets
153 * can use ARIA role attribute to force the final role.
155 readonly attribute unsigned long role;
158 * Accessible states -- bit fields which describe boolean properties of node.
159 * Many states are only valid given a certain role attribute that supports
160 * them.
162 * @param aState - the first bit field (see nsIAccessibleStates::STATE_*
163 * constants)
164 * @param aExtraState - the second bit field
165 * (see nsIAccessibleStates::EXT_STATE_* constants)
167 void getState(out unsigned long aState, out unsigned long aExtraState);
170 * Help text associated with node
172 readonly attribute AString help;
175 * Focused accessible child of node
177 readonly attribute nsIAccessible focusedChild;
180 * Attributes of accessible
182 readonly attribute nsIPersistentProperties attributes;
185 * Returns grouping information. Used for tree items, list items, tab panel
186 * labels, radio buttons, etc. Also used for collectons of non-text objects.
188 * @param groupLevel - 1-based, similar to ARIA 'level' property
189 * @param similarItemsInGroup - 1-based, similar to ARIA 'setsize' property,
190 * inclusive of the current item
191 * @param positionInGroup - 1-based, similar to ARIA 'posinset' property
193 void groupPosition(out long aGroupLevel, out long aSimilarItemsInGroup,
194 out long aPositionInGroup);
197 * Accessible child which contains the coordinate at (x, y) in screen pixels.
198 * If the point is in the current accessible but not in a child, the
199 * current accessible will be returned.
200 * If the point is in neither the current accessible or a child, then
201 * null will be returned.
203 * @param x screen's x coordinate
204 * @param y screen's y coordinate
205 * @return the deepest accessible child containing the given point
207 nsIAccessible getChildAtPoint(in long x, in long y);
210 * Deepest accessible child which contains the coordinate at (x, y) in screen
211 * pixels. If the point is in the current accessible but not in a child, the
212 * current accessible will be returned. If the point is in neither the current
213 * accessible or a child, then null will be returned.
215 * @param x screen's x coordinate
216 * @param y screen's y coordinate
217 * @return the deepest accessible child containing the given point
219 nsIAccessible getDeepestChildAtPoint(in long x, in long y);
222 * Nth accessible child using zero-based index or last child if index less than zero
224 nsIAccessible getChildAt(in long aChildIndex);
227 * Accessible node geometrically to the right of this one
229 nsIAccessible getAccessibleToRight();
232 * Accessible node geometrically to the left of this one
234 nsIAccessible getAccessibleToLeft();
237 * Accessible node geometrically above this one
239 nsIAccessible getAccessibleAbove();
242 * Accessible node geometrically below this one
244 nsIAccessible getAccessibleBelow();
247 * Return accessible relation by the given relation type (see.
248 * constants defined in nsIAccessibleRelation).
250 nsIAccessibleRelation getRelationByType(in unsigned long aRelationType);
253 * Returns the number of accessible relations for this object.
255 readonly attribute unsigned long relationsCount;
258 * Returns one accessible relation for this object.
260 * @param index - relation index (0-based)
262 nsIAccessibleRelation getRelation(in unsigned long index);
265 * Returns multiple accessible relations for this object.
267 nsIArray getRelations();
270 * Return accessible's x and y coordinates relative to the screen and
271 * accessible's width and height.
273 void getBounds(out long x, out long y, out long width, out long height);
276 * Add or remove this accessible to the current selection
278 void setSelected(in boolean isSelected);
281 * Extend the current selection from its current accessible anchor node
282 * to this accessible
284 void extendSelection();
287 * Select this accessible node only
289 void takeSelection();
292 * Focus this accessible node,
293 * The state STATE_FOCUSABLE indicates whether this node is normally focusable.
294 * It is the callers responsibility to determine whether this node is focusable.
295 * accTakeFocus on a node that is not normally focusable (such as a table),
296 * will still set focus on that node, although normally that will not be visually
297 * indicated in most style sheets.
299 void takeFocus();
302 * The number of accessible actions associated with this accessible
304 readonly attribute PRUint8 numActions;
307 * The name of the accessible action at the given zero-based index
309 AString getActionName(in PRUint8 index);
312 * The description of the accessible action at the given zero-based index
314 AString getActionDescription(in PRUint8 aIndex);
317 * Perform the accessible action at the given zero-based index
318 * Action number 0 is the default action
320 void doAction(in PRUint8 index);
323 * Get a pointer to accessibility interface for this node, which is specific
324 * to the OS/accessibility toolkit we're running on.
326 [noscript] void getNativeInterface(out voidPtr aOutAccessible);