1 /*******************************************************************************
2 * Copyright (c) 2000, 2016 IBM Corporation and others.
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
9 * SPDX-License-Identifier: EPL-2.0
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.accessibility;
18 * This adapter class provides default implementations for the
19 * methods described by the <code>AccessibleControlListener</code> interface.
21 * Classes that wish to deal with <code>AccessibleControlEvent</code>s can
22 * extend this class and override only the methods that they are
25 * Note: Accessibility clients use child identifiers to specify
26 * whether they want information about a control or one of its children.
27 * Child identifiers are increasing integers beginning with 0.
28 * The identifier CHILDID_SELF represents the control itself.
29 * When returning a child identifier to a client, you may use CHILDID_NONE
30 * to indicate that no child or control has the required information.
32 * Note: This adapter is typically used by implementors of
33 * a custom control to provide very detailed information about
34 * the control instance to accessibility clients.
37 * @see AccessibleControlListener
38 * @see AccessibleControlEvent
39 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
43 public abstract class AccessibleControlAdapter implements AccessibleControlListener {
46 * Sent when an accessibility client requests the identifier
47 * of the control child at the specified display coordinates.
48 * The default behavior is to do nothing.
50 * Return the identifier of the child at display point (x, y)
51 * in the <code>childID</code> field of the event object.
52 * Return CHILDID_SELF if point (x, y) is in the control itself
53 * and not in any child. Return CHILDID_NONE if point (x, y)
54 * is not contained in either the control or any of its children.
57 * @param e an event object containing the following fields:<ul>
58 * <li>x, y [IN] - the specified point in display coordinates</li>
59 * <li>childID [Typical OUT] - the ID of the child at point, or CHILDID_SELF, or CHILDID_NONE</li>
60 * <li>accessible [Optional OUT] - the accessible object for the control or child may be returned instead of the childID</li>
64 public void getChildAtPoint(AccessibleControlEvent e) {
68 * Sent when an accessibility client requests the location
69 * of the control, or the location of a child of the control.
70 * The default behavior is to do nothing.
72 * Return a rectangle describing the location of the specified
73 * control or child in the <code>x, y, width, and height</code>
74 * fields of the event object.
77 * @param e an event object containing the following fields:<ul>
78 * <li>childID [IN] - an identifier specifying the control or one of its children</li>
79 * <li>x, y, width, height [OUT] - the control or child location in display coordinates</li>
83 public void getLocation(AccessibleControlEvent e) {
87 * Sent when an accessibility client requests the accessible object
88 * for a child of the control by index or childID, or when a client
89 * requests the index of an accessible object in its parent.
91 * The childID field in the event object can be one of the following:</p>
93 * <li>an integer child ID - return the accessible object for the specified child ID,
94 * or null if the specified child does not have its own accessible</li>
95 * <li>{@link ACC#CHILDID_CHILD_AT_INDEX} - return the accessible child object at the specified index,
96 * or null if this object has no children</li>
97 * <li>{@link ACC#CHILDID_CHILD_INDEX} - return the index of this accessible in its parent</li>
100 * @param e an event object containing the following fields:<ul>
101 * <li>childID [IN] - an identifier specifying a child of the control, or one of the predefined CHILDID constants</li>
102 * <li>detail [Optional IN] - the index of the child accessible to be returned when childID = CHILDID_CHILD_AT_INDEX</li>
103 * <li>detail [Optional OUT] - the index of this accessible in its parent when childID = CHILDID_CHILD_INDEX</li>
104 * <li>accessible [Optional OUT] - an Accessible for the specified childID or index, or null if one does not exist</li>
108 public void getChild(AccessibleControlEvent e) {
112 * Sent when an accessibility client requests the number of
113 * children in the control.
114 * The default behavior is to do nothing.
116 * Return the number of child items in the <code>detail</code>
117 * field of the event object.
120 * @param e an event object containing the following fields:<ul>
121 * <li>detail [OUT] - the number of child items in this control</li>
125 public void getChildCount(AccessibleControlEvent e) {
129 * Sent when an accessibility client requests the default action
130 * of the control, or the default action of a child of the control.
131 * The default behavior is to do nothing.
133 * This string is typically a verb describing what the user does to it.
134 * For example, a Push Button's default action is "Press", a Check Button's
135 * is "Check" or "UnCheck", and List items have the default action "Double Click".
137 * Return a string describing the default action of the specified
138 * control or child in the <code>result</code> field of the event object.
139 * Returning null tells the client to use the platform default action string.
142 * @param e an event object containing the following fields:<ul>
143 * <li>childID [IN] - an identifier specifying the control or one of its children</li>
144 * <li>result [OUT] - the requested default action string, or null</li>
148 public void getDefaultAction(AccessibleControlEvent e) {
152 * Sent when an accessibility client requests the identity of
153 * the child or control that has keyboard focus.
154 * The default behavior is to do nothing.
156 * Return the identifier of the child that has focus in the
157 * <code>childID</code> field of the event object.
158 * Return CHILDID_SELF if the control itself has keyboard focus.
159 * Return CHILDID_NONE if neither the control nor any of its children has focus.
162 * @param e an event object containing the following fields:<ul>
163 * <li>childID [Typical OUT] - the ID of the child with focus, or CHILDID_SELF, or CHILDID_NONE</li>
164 * <li>accessible [Optional OUT] - the accessible object for a child may be returned instead of its childID</li>
168 public void getFocus(AccessibleControlEvent e) {
172 * Sent when an accessibility client requests the role
173 * of the control, or the role of a child of the control.
174 * The default behavior is to do nothing.
176 * Return a role constant (constant defined in ACC beginning with ROLE_)
177 * that describes the role of the specified control or child in the
178 * <code>detail</code> field of the event object.
181 * @param e an event object containing the following fields:<ul>
182 * <li>childID [IN] - an identifier specifying the control or one of its children</li>
183 * <li>detail [OUT] - a role constant describing the role of the control or child</li>
187 public void getRole(AccessibleControlEvent e) {
191 * Sent when an accessibility client requests the identity of
192 * the child or control that is currently selected.
193 * The default behavior is to do nothing.
195 * Return the identifier of the selected child in the
196 * <code>childID</code> field of the event object.
197 * Return CHILDID_SELF if the control itself is selected.
198 * Return CHILDID_MULTIPLE if multiple children are selected, and return an array of childIDs in the <code>children</code> field.
199 * Return CHILDID_NONE if neither the control nor any of its children are selected.
202 * @param e an event object containing the following fields:<ul>
203 * <li>childID [Typical OUT] - the ID of the selected child, or CHILDID_SELF, or CHILDID_MULTIPLE, or CHILDID_NONE</li>
204 * <li>children [Optional OUT] - the array of childIDs for the selected children if CHILDID_MULTIPLE is returned</li>
205 * <li>accessible [Optional OUT] - the accessible object for the control or child may be returned instead of the childID</li>
209 public void getSelection(AccessibleControlEvent e) {
213 * Sent when an accessibility client requests the state
214 * of the control, or the state of a child of the control.
215 * The default behavior is to do nothing.
217 * Return a state mask (mask bit constants defined in ACC beginning with STATE_)
218 * that describes the current state of the specified control or child in the
219 * <code>detail</code> field of the event object.
222 * @param e an event object containing the following fields:<ul>
223 * <li>childID [IN] - an identifier specifying the control or one of its children</li>
224 * <li>detail [OUT] - a state mask describing the current state of the control or child</li>
228 public void getState(AccessibleControlEvent e) {
232 * Sent when an accessibility client requests the value
233 * of the control, or the value of a child of the control.
234 * The default behavior is to do nothing.
236 * Many controls do not return a value. Examples of controls
237 * that do are: Combo returns the text string, Text returns
238 * its contents, ProgressBar returns a string representing a
239 * percentage, and Tree items return a string representing
240 * their level in the tree.
242 * Return a string describing the value of the specified control
243 * or child in the <code>result</code> field of the event object.
244 * Returning null tells the client to use the platform value string.
247 * @param e an event object containing the following fields:<ul>
248 * <li>childID [IN] - an identifier specifying the control or one of its children</li>
249 * <li>result [OUT] - the requested value string, or null</li>
253 public void getValue(AccessibleControlEvent e) {
257 * Sent when an accessibility client requests the children, or visible children,
258 * of the control. The default behavior is to do nothing.
260 * Return the children as an array of childIDs or accessibles in the
261 * <code>children</code> field of the event object.
264 * @param e an event object containing the following fields:<ul>
265 * <li>detail [IN] - a flag that may have one of the following values:<ul>
266 * <li>0 (default) - return all children</li>
267 * <li>VISIBLE - return all visible children</li>
269 * <li>children [Typical OUT] - an array of childIDs</li>
270 * <li>children [Optional OUT] - an array of accessible objects for the children may be returned instead of the childIDs</li>
274 public void getChildren(AccessibleControlEvent e) {