nsIAccessible.idl 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "nsISupports.idl"
  6. #include "nsIArray.idl"
  7. interface nsIPersistentProperties;
  8. interface nsIDOMCSSPrimitiveValue;
  9. interface nsIDOMNode;
  10. interface nsIAccessibleDocument;
  11. interface nsIAccessibleRelation;
  12. %{C++
  13. namespace mozilla {
  14. namespace a11y {
  15. class Accessible;
  16. }
  17. }
  18. %}
  19. /**
  20. * A cross-platform interface that supports platform-specific
  21. * accessibility APIs like MSAA and ATK. Contains the sum of what's needed
  22. * to support IAccessible as well as ATK's generic accessibility objects.
  23. * Can also be used by in-process accessibility clients to get information
  24. * about objects in the accessible tree. The accessible tree is a subset of
  25. * nodes in the DOM tree -- such as documents, focusable elements and text.
  26. * Mozilla creates the implementations of nsIAccessible on demand.
  27. * See http://www.mozilla.org/projects/ui/accessibility for more information.
  28. */
  29. [scriptable, builtinclass, uuid(de2869d9-563c-4943-996b-31a4daa4d097)]
  30. interface nsIAccessible : nsISupports
  31. {
  32. /**
  33. * Parent node in accessible tree.
  34. */
  35. readonly attribute nsIAccessible parent;
  36. /**
  37. * Next sibling in accessible tree
  38. */
  39. readonly attribute nsIAccessible nextSibling;
  40. /**
  41. * Previous sibling in accessible tree
  42. */
  43. readonly attribute nsIAccessible previousSibling;
  44. /**
  45. * First child in accessible tree
  46. */
  47. readonly attribute nsIAccessible firstChild;
  48. /**
  49. * Last child in accessible tree
  50. */
  51. readonly attribute nsIAccessible lastChild;
  52. /**
  53. * Array of all this element's children.
  54. */
  55. readonly attribute nsIArray children;
  56. /**
  57. * Number of accessible children
  58. */
  59. readonly attribute long childCount;
  60. /**
  61. * The 0-based index of this accessible in its parent's list of children,
  62. * or -1 if this accessible does not have a parent.
  63. */
  64. readonly attribute long indexInParent;
  65. /**
  66. * The DOM node this nsIAccessible is associated with.
  67. */
  68. readonly attribute nsIDOMNode DOMNode;
  69. /**
  70. * For remote accessibles the id of the related DOM node.
  71. */
  72. readonly attribute DOMString id;
  73. /**
  74. * The document accessible that this access node resides in.
  75. */
  76. readonly attribute nsIAccessibleDocument document;
  77. /**
  78. * The root document accessible that this access node resides in.
  79. */
  80. readonly attribute nsIAccessibleDocument rootDocument;
  81. /**
  82. * The language for the current DOM node, e.g. en, de, etc.
  83. */
  84. readonly attribute DOMString language;
  85. /**
  86. * Accessible name -- the main text equivalent for this node. The name is
  87. * specified by ARIA or by native markup. Example of ARIA markup is
  88. * aria-labelledby attribute placed on element of this accessible. Example
  89. * of native markup is HTML label linked with HTML element of this accessible.
  90. *
  91. * Value can be string or null. A null value indicates that AT may attempt to
  92. * compute the name. Any string value, including the empty string, should be
  93. * considered author-intentional, and respected.
  94. */
  95. readonly attribute AString name;
  96. /**
  97. * Accessible value -- a number or a secondary text equivalent for this node
  98. * Widgets that use role attribute can force a value using the valuenow attribute
  99. */
  100. readonly attribute AString value;
  101. /**
  102. * Accessible description -- long text associated with this node
  103. */
  104. readonly attribute AString description;
  105. /**
  106. * Provides localized string of accesskey name, such as Alt+D.
  107. * The modifier may be affected by user and platform preferences.
  108. * Usually alt+letter, or just the letter alone for menu items.
  109. */
  110. readonly attribute AString accessKey;
  111. /**
  112. * Provides localized string of global keyboard accelerator for default
  113. * action, such as Ctrl+O for Open file
  114. */
  115. readonly attribute AString keyboardShortcut;
  116. /**
  117. * Enumerated accessible role (see the constants defined in nsIAccessibleRole).
  118. *
  119. * @note The values might depend on platform because of variations. Widgets
  120. * can use ARIA role attribute to force the final role.
  121. */
  122. readonly attribute unsigned long role;
  123. /**
  124. * Accessible states -- bit fields which describe boolean properties of node.
  125. * Many states are only valid given a certain role attribute that supports
  126. * them.
  127. *
  128. * @param aState - the first bit field (see nsIAccessibleStates::STATE_*
  129. * constants)
  130. * @param aExtraState - the second bit field
  131. * (see nsIAccessibleStates::EXT_STATE_* constants)
  132. */
  133. void getState(out unsigned long aState, out unsigned long aExtraState);
  134. /**
  135. * Help text associated with node
  136. *
  137. * @note As of now, this just returns empty string.
  138. */
  139. readonly attribute AString help;
  140. /**
  141. * Focused accessible child of node
  142. */
  143. readonly attribute nsIAccessible focusedChild;
  144. /**
  145. * Attributes of accessible
  146. */
  147. readonly attribute nsIPersistentProperties attributes;
  148. /**
  149. * Returns grouping information. Used for tree items, list items, tab panel
  150. * labels, radio buttons, etc. Also used for collectons of non-text objects.
  151. *
  152. * @param groupLevel - 1-based, similar to ARIA 'level' property
  153. * @param similarItemsInGroup - 1-based, similar to ARIA 'setsize' property,
  154. * inclusive of the current item
  155. * @param positionInGroup - 1-based, similar to ARIA 'posinset' property
  156. */
  157. void groupPosition(out long aGroupLevel, out long aSimilarItemsInGroup,
  158. out long aPositionInGroup);
  159. /**
  160. * Accessible child which contains the coordinate at (x, y) in screen pixels.
  161. * If the point is in the current accessible but not in a child, the
  162. * current accessible will be returned.
  163. * If the point is in neither the current accessible or a child, then
  164. * null will be returned.
  165. *
  166. * @param x screen's x coordinate
  167. * @param y screen's y coordinate
  168. * @return the deepest accessible child containing the given point
  169. */
  170. nsIAccessible getChildAtPoint(in long x, in long y);
  171. /**
  172. * Deepest accessible child which contains the coordinate at (x, y) in screen
  173. * pixels. If the point is in the current accessible but not in a child, the
  174. * current accessible will be returned. If the point is in neither the current
  175. * accessible or a child, then null will be returned.
  176. *
  177. * @param x screen's x coordinate
  178. * @param y screen's y coordinate
  179. * @return the deepest accessible child containing the given point
  180. */
  181. nsIAccessible getDeepestChildAtPoint(in long x, in long y);
  182. /**
  183. * Nth accessible child using zero-based index or last child if index less than zero
  184. */
  185. nsIAccessible getChildAt(in long aChildIndex);
  186. /**
  187. * Return accessible relation by the given relation type (see.
  188. * constants defined in nsIAccessibleRelation).
  189. */
  190. nsIAccessibleRelation getRelationByType(in unsigned long aRelationType);
  191. /**
  192. * Returns multiple accessible relations for this object.
  193. */
  194. nsIArray getRelations();
  195. /**
  196. * Return accessible's x and y coordinates relative to the screen and
  197. * accessible's width and height.
  198. */
  199. void getBounds(out long x, out long y, out long width, out long height);
  200. /**
  201. * Add or remove this accessible to the current selection
  202. */
  203. void setSelected(in boolean isSelected);
  204. /**
  205. * Select this accessible node only
  206. */
  207. void takeSelection();
  208. /**
  209. * Focus this accessible node,
  210. * The state STATE_FOCUSABLE indicates whether this node is normally focusable.
  211. * It is the callers responsibility to determine whether this node is focusable.
  212. * accTakeFocus on a node that is not normally focusable (such as a table),
  213. * will still set focus on that node, although normally that will not be visually
  214. * indicated in most style sheets.
  215. */
  216. void takeFocus();
  217. /**
  218. * The number of accessible actions associated with this accessible
  219. */
  220. readonly attribute uint8_t actionCount;
  221. /**
  222. * The name of the accessible action at the given zero-based index
  223. */
  224. AString getActionName(in uint8_t index);
  225. /**
  226. * The description of the accessible action at the given zero-based index
  227. */
  228. AString getActionDescription(in uint8_t aIndex);
  229. /**
  230. * Perform the accessible action at the given zero-based index
  231. * Action number 0 is the default action
  232. */
  233. void doAction(in uint8_t index);
  234. /**
  235. * Makes an object visible on screen.
  236. *
  237. * @param scrollType - defines where the object should be placed on
  238. * the screen (see nsIAccessibleScrollType for
  239. * available constants).
  240. */
  241. void scrollTo(in unsigned long aScrollType);
  242. /**
  243. * Moves the top left of an object to a specified location.
  244. *
  245. * @param coordinateType [in] - specifies whether the coordinates are relative to
  246. * the screen or the parent object (for available
  247. * constants refer to nsIAccessibleCoordinateType)
  248. * @param x [in] - defines the x coordinate
  249. * @param y [in] - defines the y coordinate
  250. */
  251. void scrollToPoint(in unsigned long coordinateType, in long x, in long y);
  252. %{C++
  253. virtual mozilla::a11y::Accessible* ToInternalAccessible() const = 0;
  254. %}
  255. };