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