1 /******************************************************************************* 2 * Copyright (c) 2000, 2006 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.swt.accessibility; 12 13 14 import org.eclipse.swt.internal.SWTEventListener; 15 16 /** 17 * Classes that implement this interface provide methods 18 * that deal with the events that are generated when an 19 * accessibility client sends a message to a control. 20 * <p> 21 * After creating an instance of a class that implements 22 * this interface it can be added to a control using the 23 * <code>addAccessibleControlListener</code> method and removed 24 * using the <code>removeAccessibleControlListener</code> method. 25 * When a client requests information the appropriate method 26 * will be invoked. 27 * </p><p> 28 * Note: Accessibility clients use child identifiers to specify 29 * whether they want information about a control or one of its children. 30 * Child identifiers are increasing integers beginning with 0. 31 * The identifier CHILDID_SELF represents the control itself. 32 * </p><p> 33 * Note: This interface is typically used by implementors of 34 * a custom control to provide very detailed information about 35 * the control instance to accessibility clients. 36 * </p> 37 * 38 * @see AccessibleControlAdapter 39 * @see AccessibleControlEvent 40 * 41 * @since 2.0 42 */ 43 public interface AccessibleControlListener extends SWTEventListener { 44 45 /** 46 * Sent when an accessibility client requests the identifier 47 * of the control child at the specified display coordinates. 48 * <p> 49 * Return the identifier of the child at display point (x, y) 50 * in the <code>childID</code> field of the event object. 51 * Return CHILDID_SELF if point (x, y) is in the control itself 52 * and not in any child. Return CHILDID_NONE if point (x, y) 53 * is not contained in either the control or any of its children. 54 * </p> 55 * 56 * @param e an event object containing the following fields:<ul> 57 * <li>x, y [IN] - the specified point in display coordinates</li> 58 * <li>childID [Typical OUT] - the ID of the child at point, or CHILDID_SELF, or CHILDID_NONE</li> 59 * <li>accessible [Optional OUT] - the accessible object for the control or child may be returned instead of the childID</li> 60 * </ul> 61 */ 62 public void getChildAtPoint(AccessibleControlEvent e); 63 64 /** 65 * Sent when an accessibility client requests the location 66 * of the control, or the location of a child of the control. 67 * <p> 68 * Return a rectangle describing the location of the specified 69 * control or child in the <code>x, y, width, and height</code> 70 * fields of the event object. 71 * </p> 72 * 73 * @param e an event object containing the following fields:<ul> 74 * <li>childID [IN] - an identifier specifying the control or one of its children</li> 75 * <li>x, y, width, height [OUT] - the control or child location in display coordinates</li> 76 * </ul> 77 */ 78 public void getLocation(AccessibleControlEvent e); 79 80 /** 81 * Sent when an accessibility client requests the accessible object 82 * for a child of the control. 83 * <p> 84 * Return an <code>Accessible</code> for the specified control or 85 * child in the <code>accessible</code> field of the event object. 86 * Return null if the specified child does not have its own 87 * <code>Accessible</code>. 88 * </p> 89 * 90 * @param e an event object containing the following fields:<ul> 91 * <li>childID [IN] - an identifier specifying a child of the control</li> 92 * <li>accessible [OUT] - an Accessible for the specified childID, or null if one does not exist</li> 93 * </ul> 94 */ 95 public void getChild(AccessibleControlEvent e); 96 97 /** 98 * Sent when an accessibility client requests the number of 99 * children in the control. 100 * <p> 101 * Return the number of child items in the <code>detail</code> 102 * field of the event object. 103 * </p> 104 * 105 * @param e an event object containing the following fields:<ul> 106 * <li>detail [OUT] - the number of child items in this control</li> 107 * </ul> 108 */ 109 public void getChildCount(AccessibleControlEvent e); 110 111 /** 112 * Sent when an accessibility client requests the default action 113 * of the control, or the default action of a child of the control. 114 * <p> 115 * This string is typically a verb describing what the user does to it. 116 * For example, a Push Button's default action is "Press", a Check Button's 117 * is "Check" or "UnCheck", and List items have the default action "Double Click". 118 * </p><p> 119 * Return a string describing the default action of the specified 120 * control or child in the <code>result</code> field of the event object. 121 * Returning null tells the client to use the platform default action string. 122 * </p> 123 * 124 * @param e an event object containing the following fields:<ul> 125 * <li>childID [IN] - an identifier specifying the control or one of its children</li> 126 * <li>result [OUT] - the requested default action string, or null</li> 127 * </ul> 128 */ 129 public void getDefaultAction(AccessibleControlEvent e); 130 131 /** 132 * Sent when an accessibility client requests the identity of 133 * the child or control that has keyboard focus. 134 * <p> 135 * Return the identifier of the child that has focus in the 136 * <code>childID</code> field of the event object. 137 * Return CHILDID_SELF if the control itself has keyboard focus. 138 * Return CHILDID_NONE if neither the control nor any of its children has focus. 139 * </p> 140 * 141 * @param e an event object containing the following fields:<ul> 142 * <li>childID [Typical OUT] - the ID of the child with focus, or CHILDID_SELF, or CHILDID_NONE</li> 143 * <li>accessible [Optional OUT] - the accessible object for a child may be returned instead of its childID</li> 144 * </ul> 145 */ 146 public void getFocus(AccessibleControlEvent e); 147 148 /** 149 * Sent when an accessibility client requests the role 150 * of the control, or the role of a child of the control. 151 * <p> 152 * Return a role constant (constant defined in ACC beginning with ROLE_) 153 * that describes the role of the specified control or child in the 154 * <code>detail</code> field of the event object. 155 * </p> 156 * 157 * @param e an event object containing the following fields:<ul> 158 * <li>childID [IN] - an identifier specifying the control or one of its children</li> 159 * <li>detail [OUT] - a role constant describing the role of the control or child</li> 160 * </ul> 161 */ 162 public void getRole(AccessibleControlEvent e); 163 164 /** 165 * Sent when an accessibility client requests the identity of 166 * the child or control that is currently selected. 167 * <p> 168 * Return the identifier of the selected child in the 169 * <code>childID</code> field of the event object. 170 * Return CHILDID_SELF if the control itself is selected. 171 * Return CHILDID_MULTIPLE if multiple children are selected, and return an array of childIDs in the <code>children</code> field. 172 * Return CHILDID_NONE if neither the control nor any of its children are selected. 173 * </p> 174 * 175 * @param e an event object containing the following fields:<ul> 176 * <li>childID [Typical OUT] - the ID of the selected child, or CHILDID_SELF, or CHILDID_MULTIPLE, or CHILDID_NONE</li> 177 * <li>accessible [Optional OUT] - the accessible object for the control or child may be returned instead of the childID</li> 178 * </ul> 179 */ 180 public void getSelection(AccessibleControlEvent e); 181 182 /** 183 * Sent when an accessibility client requests the state 184 * of the control, or the state of a child of the control. 185 * <p> 186 * Return a state mask (mask bit constants defined in ACC beginning with STATE_) 187 * that describes the current state of the specified control or child in the 188 * <code>detail</code> field of the event object. 189 * </p> 190 * 191 * @param e an event object containing the following fields:<ul> 192 * <li>childID [IN] - an identifier specifying the control or one of its children</li> 193 * <li>detail [OUT] - a state mask describing the current state of the control or child</li> 194 * </ul> 195 */ 196 public void getState(AccessibleControlEvent e); 197 198 /** 199 * Sent when an accessibility client requests the value 200 * of the control, or the value of a child of the control. 201 * <p> 202 * Many controls do not return a value. Examples of controls 203 * that do are: Combo returns the text string, Text returns 204 * its contents, ProgressBar returns a string representing a 205 * percentage, and Tree items return a string representing 206 * their level in the tree. 207 * </p><p> 208 * Return a string describing the value of the specified control 209 * or child in the <code>result</code> field of the event object. 210 * Returning null tells the client to use the platform value string. 211 * </p> 212 * 213 * @param e an event object containing the following fields:<ul> 214 * <li>childID [IN] - an identifier specifying the control or one of its children</li> 215 * <li>result [OUT] - the requested value string, or null</li> 216 * </ul> 217 */ 218 public void getValue(AccessibleControlEvent e); 219 220 /** 221 * Sent when an accessibility client requests the children of the control. 222 * <p> 223 * Return the children as an array of childIDs in the <code>children</code> 224 * field of the event object. 225 * </p> 226 * 227 * @param e an event object containing the following fields:<ul> 228 * <li>children [Typical OUT] - an array of childIDs</li> 229 * <li>children [Optional OUT] - an array of accessible objects for the children may be returned instead of the childIDs</li> 230 * </ul> 231 */ 232 public void getChildren(AccessibleControlEvent e); 233 } 234