1 /*******************************************************************************
2 * Copyright (c) 2000, 2010 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;
17 import org.eclipse.swt.internal.*;
20 * Classes that implement this interface provide methods
21 * that deal with the events that are generated when an
22 * accessibility client sends a message to a control.
24 * After creating an instance of a class that implements
25 * this interface it can be added to a control using the
26 * <code>addAccessibleControlListener</code> method and removed
27 * using the <code>removeAccessibleControlListener</code> method.
28 * When a client requests information the appropriate method
31 * Note: Accessibility clients use child identifiers to specify
32 * whether they want information about a control or one of its children.
33 * Child identifiers are increasing integers beginning with 0.
34 * The identifier CHILDID_SELF represents the control itself.
36 * Note: This interface is typically used by implementors of
37 * a custom control to provide very detailed information about
38 * the control instance to accessibility clients.
41 * @see AccessibleControlAdapter
42 * @see AccessibleControlEvent
46 public interface AccessibleControlListener extends SWTEventListener {
49 * Sent when an accessibility client requests the identifier
50 * of the control child at the specified display coordinates.
52 * Return the identifier of the child at display point (x, y)
53 * in the <code>childID</code> field of the event object.
54 * Return CHILDID_SELF if point (x, y) is in the control itself
55 * and not in any child. Return CHILDID_NONE if point (x, y)
56 * is not contained in either the control or any of its children.
59 * @param e an event object containing the following fields:<ul>
60 * <li>x, y [IN] - the specified point in display coordinates</li>
61 * <li>childID [Typical OUT] - the ID of the child at point, or CHILDID_SELF, or CHILDID_NONE</li>
62 * <li>accessible [Optional OUT] - the accessible object for the control or child may be returned instead of the childID</li>
65 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.
71 * Return a rectangle describing the location of the specified
72 * control or child in the <code>x, y, width, and height</code>
73 * fields of the event object.
76 * @param e an event object containing the following fields:<ul>
77 * <li>childID [IN] - an identifier specifying the control or one of its children</li>
78 * <li>x, y, width, height [OUT] - the control or child location in display coordinates</li>
81 public void getLocation(AccessibleControlEvent e);
84 * Sent when an accessibility client requests the accessible object
85 * for a child of the control by index or childID, or when a client
86 * requests the index of an accessible object in its parent.
88 * The childID field in the event object can be one of the following:</p>
90 * <li>an integer child ID - return the accessible object for the specified child ID,
91 * or null if the specified child does not have its own accessible</li>
92 * <li>{@link ACC#CHILDID_CHILD_AT_INDEX} - return the accessible child object at the specified index,
93 * or null if this object has no children</li>
94 * <li>{@link ACC#CHILDID_CHILD_INDEX} - return the index of this accessible in its parent</li>
97 * @param e an event object containing the following fields:<ul>
98 * <li>childID [IN] - an identifier specifying a child of the control, or one of the predefined CHILDID constants</li>
99 * <li>detail [Optional IN] - the index of the child accessible to be returned when childID = CHILDID_CHILD_AT_INDEX</li>
100 * <li>detail [Optional OUT] - the index of this accessible in its parent when childID = CHILDID_CHILD_INDEX</li>
101 * <li>accessible [Optional OUT] - an Accessible for the specified childID or index, or null if one does not exist</li>
104 public void getChild(AccessibleControlEvent e);
107 * Sent when an accessibility client requests the number of
108 * children in the control.
110 * Return the number of child items in the <code>detail</code>
111 * field of the event object.
114 * @param e an event object containing the following fields:<ul>
115 * <li>detail [OUT] - the number of child items in this control</li>
118 public void getChildCount(AccessibleControlEvent e);
121 * Sent when an accessibility client requests the default action
122 * of the control, or the default action of a child of the control.
124 * This string is typically a verb describing what the user does to it.
125 * For example, a Push Button's default action is "Press", a Check Button's
126 * is "Check" or "UnCheck", and List items have the default action "Double Click".
128 * Return a string describing the default action of the specified
129 * control or child in the <code>result</code> field of the event object.
130 * Returning null tells the client to use the platform default action string.
133 * @param e an event object containing the following fields:<ul>
134 * <li>childID [IN] - an identifier specifying the control or one of its children</li>
135 * <li>result [OUT] - the requested default action string, or null</li>
138 public void getDefaultAction(AccessibleControlEvent e);
141 * Sent when an accessibility client requests the identity of
142 * the child or control that has keyboard focus.
144 * Return the identifier of the child that has focus in the
145 * <code>childID</code> field of the event object.
146 * Return CHILDID_SELF if the control itself has keyboard focus.
147 * Return CHILDID_NONE if neither the control nor any of its children has focus.
150 * @param e an event object containing the following fields:<ul>
151 * <li>childID [Typical OUT] - the ID of the child with focus, or CHILDID_SELF, or CHILDID_NONE</li>
152 * <li>accessible [Optional OUT] - the accessible object for a child may be returned instead of its childID</li>
155 public void getFocus(AccessibleControlEvent e);
158 * Sent when an accessibility client requests the role
159 * of the control, or the role of a child of the control.
161 * Return a role constant (constant defined in ACC beginning with ROLE_)
162 * that describes the role of the specified control or child in the
163 * <code>detail</code> field of the event object.
166 * @param e an event object containing the following fields:<ul>
167 * <li>childID [IN] - an identifier specifying the control or one of its children</li>
168 * <li>detail [OUT] - a role constant describing the role of the control or child</li>
171 public void getRole(AccessibleControlEvent e);
174 * Sent when an accessibility client requests the identity of
175 * the child or control that is currently selected.
177 * Return the identifier of the selected child in the
178 * <code>childID</code> field of the event object.
179 * Return CHILDID_SELF if the control itself is selected.
180 * Return CHILDID_MULTIPLE if multiple children are selected, and return an array of childIDs in the <code>children</code> field.
181 * Return CHILDID_NONE if neither the control nor any of its children are selected.
184 * @param e an event object containing the following fields:<ul>
185 * <li>childID [Typical OUT] - the ID of the selected child, or CHILDID_SELF, or CHILDID_MULTIPLE, or CHILDID_NONE</li>
186 * <li>children [Optional OUT] - the array of childIDs for the selected children if CHILDID_MULTIPLE is returned</li>
187 * <li>accessible [Optional OUT] - the accessible object for the control or child may be returned instead of the childID</li>
190 public void getSelection(AccessibleControlEvent e);
193 * Sent when an accessibility client requests the state
194 * of the control, or the state of a child of the control.
196 * Return a state mask (mask bit constants defined in ACC beginning with STATE_)
197 * that describes the current state of the specified control or child in the
198 * <code>detail</code> field of the event object.
201 * @param e an event object containing the following fields:<ul>
202 * <li>childID [IN] - an identifier specifying the control or one of its children</li>
203 * <li>detail [OUT] - a state mask describing the current state of the control or child</li>
206 public void getState(AccessibleControlEvent e);
209 * Sent when an accessibility client requests the value
210 * of the control, or the value of a child of the control.
212 * Many controls do not return a value. Examples of controls
213 * that do are: Combo returns the text string, Text returns
214 * its contents, ProgressBar returns a string representing a
215 * percentage, and Tree items return a string representing
216 * their level in the tree.
218 * Return a string describing the value of the specified control
219 * or child in the <code>result</code> field of the event object.
220 * Returning null tells the client to use the platform value string.
223 * @param e an event object containing the following fields:<ul>
224 * <li>childID [IN] - an identifier specifying the control or one of its children</li>
225 * <li>result [OUT] - the requested value string, or null</li>
228 public void getValue(AccessibleControlEvent e);
231 * Sent when an accessibility client requests the children, or visible children,
234 * Return the children as an array of childIDs or accessibles in the
235 * <code>children</code> field of the event object.
238 * @param e an event object containing the following fields:<ul>
239 * <li>detail [IN] - a flag that may have one of the following values:<ul>
240 * <li>0 (default) - return all children</li>
241 * <li>VISIBLE - return all visible children</li>
243 * <li>children [Typical OUT] - an array of childIDs</li>
244 * <li>children [Optional OUT] - an array of accessible objects for the children may be returned instead of the childIDs</li>
247 public void getChildren(AccessibleControlEvent e);