1 /******************************************************************************* 2 * Copyright (c) 2000, 2008 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.AccessibleControlAdapter; 14 15 import org.eclipse.swt.accessibility.AccessibleControlListener; 16 import org.eclipse.swt.accessibility.AccessibleControlEvent; 17 18 /** 19 * This adapter class provides default implementations for the 20 * methods described by the <code>AccessibleControlListener</code> interface. 21 * <p> 22 * Classes that wish to deal with <code>AccessibleControlEvent</code>s can 23 * extend this class and override only the methods that they are 24 * interested in. 25 * </p><p> 26 * Note: Accessibility clients use child identifiers to specify 27 * whether they want information about a control or one of its children. 28 * Child identifiers are increasing integers beginning with 0. 29 * The identifier CHILDID_SELF represents the control itself. 30 * When returning a child identifier to a client, you may use CHILDID_NONE 31 * to indicate that no child or control has the required information. 32 * </p><p> 33 * Note: This adapter 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 AccessibleControlListener 39 * @see AccessibleControlEvent 40 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> 41 * 42 * @since 2.0 43 */ 44 public abstract class AccessibleControlAdapter : AccessibleControlListener { 45 46 /** 47 * Sent when an accessibility client requests the identifier 48 * of the control child at the specified display coordinates. 49 * The default behavior is to do nothing. 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 /** 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. 71 * <p> 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. 75 * </p> 76 * 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> 80 * </ul> 81 */ 82 public void getLocation(AccessibleControlEvent e) { 83 } 84 85 /** 86 * Sent when an accessibility client requests the accessible object 87 * for a child of the control. 88 * The default behavior is to do nothing. 89 * <p> 90 * Return an <code>Accessible</code> for the specified control or 91 * child in the <code>accessible</code> field of the event object. 92 * Return null if the specified child does not have its own 93 * <code>Accessible</code>. 94 * </p> 95 * 96 * @param e an event object containing the following fields:<ul> 97 * <li>childID [IN] - an identifier specifying a child of the control</li> 98 * <li>accessible [OUT] - an Accessible for the specified childID, or null if one does not exist</li> 99 * </ul> 100 */ 101 public void getChild(AccessibleControlEvent e) { 102 } 103 104 /** 105 * Sent when an accessibility client requests the number of 106 * children in the control. 107 * The default behavior is to do nothing. 108 * <p> 109 * Return the number of child items in the <code>detail</code> 110 * field of the event object. 111 * </p> 112 * 113 * @param e an event object containing the following fields:<ul> 114 * <li>detail [OUT] - the number of child items in this control</li> 115 * </ul> 116 */ 117 public void getChildCount(AccessibleControlEvent e) { 118 } 119 120 /** 121 * Sent when an accessibility client requests the default action 122 * of the control, or the default action of a child of the control. 123 * The default behavior is to do nothing. 124 * <p> 125 * This string is typically a verb describing what the user does to it. 126 * For example, a Push Button's default action is "Press", a Check Button's 127 * is "Check" or "UnCheck", and List items have the default action "Double Click". 128 * </p><p> 129 * Return a string describing the default action of the specified 130 * control or child in the <code>result</code> field of the event object. 131 * Returning null tells the client to use the platform default action string. 132 * </p> 133 * 134 * @param e an event object containing the following fields:<ul> 135 * <li>childID [IN] - an identifier specifying the control or one of its children</li> 136 * <li>result [OUT] - the requested default action string, or null</li> 137 * </ul> 138 */ 139 public void getDefaultAction(AccessibleControlEvent e) { 140 } 141 142 /** 143 * Sent when an accessibility client requests the identity of 144 * the child or control that has keyboard focus. 145 * The default behavior is to do nothing. 146 * <p> 147 * Return the identifier of the child that has focus in the 148 * <code>childID</code> field of the event object. 149 * Return CHILDID_SELF if the control itself has keyboard focus. 150 * Return CHILDID_NONE if neither the control nor any of its children has focus. 151 * </p> 152 * 153 * @param e an event object containing the following fields:<ul> 154 * <li>childID [Typical OUT] - the ID of the child with focus, or CHILDID_SELF, or CHILDID_NONE</li> 155 * <li>accessible [Optional OUT] - the accessible object for a child may be returned instead of its childID</li> 156 * </ul> 157 */ 158 public void getFocus(AccessibleControlEvent e) { 159 } 160 161 /** 162 * Sent when an accessibility client requests the role 163 * of the control, or the role of a child of the control. 164 * The default behavior is to do nothing. 165 * <p> 166 * Return a role constant (constant defined in ACC beginning with ROLE_) 167 * that describes the role of the specified control or child in the 168 * <code>detail</code> field of the event object. 169 * </p> 170 * 171 * @param e an event object containing the following fields:<ul> 172 * <li>childID [IN] - an identifier specifying the control or one of its children</li> 173 * <li>detail [OUT] - a role constant describing the role of the control or child</li> 174 * </ul> 175 */ 176 public void getRole(AccessibleControlEvent e) { 177 } 178 179 /** 180 * Sent when an accessibility client requests the identity of 181 * the child or control that is currently selected. 182 * The default behavior is to do nothing. 183 * <p> 184 * Return the identifier of the selected child in the 185 * <code>childID</code> field of the event object. 186 * Return CHILDID_SELF if the control itself is selected. 187 * Return CHILDID_MULTIPLE if multiple children are selected, and return an array of childIDs in the <code>children</code> field. 188 * Return CHILDID_NONE if neither the control nor any of its children are selected. 189 * </p> 190 * 191 * @param e an event object containing the following fields:<ul> 192 * <li>childID [Typical OUT] - the ID of the selected child, or CHILDID_SELF, or CHILDID_MULTIPLE, or CHILDID_NONE</li> 193 * <li>accessible [Optional OUT] - the accessible object for the control or child may be returned instead of the childID</li> 194 * </ul> 195 */ 196 public void getSelection(AccessibleControlEvent e) { 197 } 198 199 /** 200 * Sent when an accessibility client requests the state 201 * of the control, or the state of a child of the control. 202 * The default behavior is to do nothing. 203 * <p> 204 * Return a state mask (mask bit constants defined in ACC beginning with STATE_) 205 * that describes the current state of the specified control or child in the 206 * <code>detail</code> field of the event object. 207 * </p> 208 * 209 * @param e an event object containing the following fields:<ul> 210 * <li>childID [IN] - an identifier specifying the control or one of its children</li> 211 * <li>detail [OUT] - a state mask describing the current state of the control or child</li> 212 * </ul> 213 */ 214 public void getState(AccessibleControlEvent e) { 215 } 216 217 /** 218 * Sent when an accessibility client requests the value 219 * of the control, or the value of a child of the control. 220 * The default behavior is to do nothing. 221 * <p> 222 * Many controls do not return a value. Examples of controls 223 * that do are: Combo returns the text string, Text returns 224 * its contents, ProgressBar returns a string representing a 225 * percentage, and Tree items return a string representing 226 * their level in the tree. 227 * </p><p> 228 * Return a string describing the value of the specified control 229 * or child in the <code>result</code> field of the event object. 230 * Returning null tells the client to use the platform value string. 231 * </p> 232 * 233 * @param e an event object containing the following fields:<ul> 234 * <li>childID [IN] - an identifier specifying the control or one of its children</li> 235 * <li>result [OUT] - the requested value string, or null</li> 236 * </ul> 237 */ 238 public void getValue(AccessibleControlEvent e) { 239 } 240 241 /** 242 * Sent when an accessibility client requests the children of the control. 243 * The default behavior is to do nothing. 244 * <p> 245 * Return the children as an array of childIDs in the <code>children</code> 246 * field of the event object. 247 * </p> 248 * 249 * @param e an event object containing the following fields:<ul> 250 * <li>children [Typical OUT] - an array of childIDs</li> 251 * <li>accessible [Optional OUT] - an array of accessible objects for the children may be returned instead of the childIDs</li> 252 * </ul> 253 */ 254 public void getChildren(AccessibleControlEvent e) { 255 } 256 }