1 /*******************************************************************************
2  * Copyright (c) 2000, 2016 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 by index or childID, or when a client
88      * requests the index of an accessible object in its parent.
89      * <p>
90      * The childID field in the event object can be one of the following:<ul>
91      *    <li>an integer child ID - return the accessible object for the specified child ID,
92      *    	or null if the specified child does not have its own accessible</li>
93      *    <li>{@link ACC#CHILDID_CHILD_AT_INDEX} - return the accessible child object at the specified index,
94      *    	or null if this object has no children</li>
95      *    <li>{@link ACC#CHILDID_CHILD_INDEX} - return the index of this accessible in its parent</li>
96      * </ul></p>
97      *
98      * @param e an event object containing the following fields:<ul>
99      *    <li>childID [IN] - an identifier specifying a child of the control, or one of the predefined CHILDID constants</li>
100      *    <li>detail [Optional IN] - the index of the child accessible to be returned when childID = CHILDID_CHILD_AT_INDEX</li>
101      *    <li>detail [Optional OUT] - the index of this accessible in its parent when childID = CHILDID_CHILD_INDEX</li>
102      *    <li>accessible [Optional OUT] - an Accessible for the specified childID or index, or null if one does not exist</li>
103      * </ul>
104      */
105     public void getChild(AccessibleControlEvent e) {
106     }
107 
108     /**
109      * Sent when an accessibility client requests the number of
110      * children in the control.
111      * The default behavior is to do nothing.
112      * <p>
113      * Return the number of child items in the <code>detail</code>
114      * field of the event object.
115      * </p>
116      *
117      * @param e an event object containing the following fields:<ul>
118      *    <li>detail [OUT] - the number of child items in this control</li>
119      * </ul>
120      */
121     public void getChildCount(AccessibleControlEvent e) {
122     }
123 
124     /**
125      * Sent when an accessibility client requests the default action
126      * of the control, or the default action of a child of the control.
127      * The default behavior is to do nothing.
128      * <p>
129      * This string is typically a verb describing what the user does to it.
130      * For example, a Push Button's default action is "Press", a Check Button's
131      * is "Check" or "UnCheck", and List items have the default action "Double Click".
132      * </p><p>
133      * Return a string describing the default action of the specified
134      * control or child in the <code>result</code> field of the event object.
135      * Returning null tells the client to use the platform default action string.
136      * </p>
137      *
138      * @param e an event object containing the following fields:<ul>
139      *    <li>childID [IN] - an identifier specifying the control or one of its children</li>
140      *    <li>result [OUT] - the requested default action string, or null</li>
141      * </ul>
142      */
143     public void getDefaultAction(AccessibleControlEvent e) {
144     }
145 
146     /**
147      * Sent when an accessibility client requests the identity of
148      * the child or control that has keyboard focus.
149      * The default behavior is to do nothing.
150      * <p>
151      * Return the identifier of the child that has focus in the
152      * <code>childID</code> field of the event object.
153      * Return CHILDID_SELF if the control itself has keyboard focus.
154      * Return CHILDID_NONE if neither the control nor any of its children has focus.
155      * </p>
156      *
157      * @param e an event object containing the following fields:<ul>
158      *    <li>childID [Typical OUT] - the ID of the child with focus, or CHILDID_SELF, or CHILDID_NONE</li>
159      *    <li>accessible [Optional OUT] - the accessible object for a child may be returned instead of its childID</li>
160      * </ul>
161      */
162     public void getFocus(AccessibleControlEvent e) {
163     }
164 
165     /**
166      * Sent when an accessibility client requests the role
167      * of the control, or the role of a child of the control.
168      * The default behavior is to do nothing.
169      * <p>
170      * Return a role constant (constant defined in ACC beginning with ROLE_)
171      * that describes the role of the specified control or child in the
172      * <code>detail</code> field of the event object.
173      * </p>
174      *
175      * @param e an event object containing the following fields:<ul>
176      *    <li>childID [IN] - an identifier specifying the control or one of its children</li>
177      *    <li>detail [OUT] - a role constant describing the role of the control or child</li>
178      * </ul>
179      */
180     public void getRole(AccessibleControlEvent e) {
181     }
182 
183     /**
184      * Sent when an accessibility client requests the identity of
185      * the child or control that is currently selected.
186      * The default behavior is to do nothing.
187      * <p>
188      * Return the identifier of the selected child in the
189      * <code>childID</code> field of the event object.
190      * Return CHILDID_SELF if the control itself is selected.
191      * Return CHILDID_MULTIPLE if multiple children are selected, and return an array of childIDs in the <code>children</code> field.
192      * Return CHILDID_NONE if neither the control nor any of its children are selected.
193      * </p>
194      *
195      * @param e an event object containing the following fields:<ul>
196      *    <li>childID [Typical OUT] - the ID of the selected child, or CHILDID_SELF, or CHILDID_MULTIPLE, or CHILDID_NONE</li>
197      *    <li>children [Optional OUT] - the array of childIDs for the selected children if CHILDID_MULTIPLE is returned</li>
198      *    <li>accessible [Optional OUT] - the accessible object for the control or child may be returned instead of the childID</li>
199      * </ul>
200      */
201     public void getSelection(AccessibleControlEvent e) {
202     }
203 
204     /**
205      * Sent when an accessibility client requests the state
206      * of the control, or the state of a child of the control.
207      * The default behavior is to do nothing.
208      * <p>
209      * Return a state mask (mask bit constants defined in ACC beginning with STATE_)
210      * that describes the current state of the specified control or child in the
211      * <code>detail</code> field of the event object.
212      * </p>
213      *
214      * @param e an event object containing the following fields:<ul>
215      *    <li>childID [IN] - an identifier specifying the control or one of its children</li>
216      *    <li>detail [OUT] - a state mask describing the current state of the control or child</li>
217      * </ul>
218      */
219     public void getState(AccessibleControlEvent e) {
220     }
221 
222     /**
223      * Sent when an accessibility client requests the value
224      * of the control, or the value of a child of the control.
225      * The default behavior is to do nothing.
226      * <p>
227      * Many controls do not return a value. Examples of controls
228      * that do are: Combo returns the text string, Text returns
229      * its contents, ProgressBar returns a string representing a
230      * percentage, and Tree items return a string representing
231      * their level in the tree.
232      * </p><p>
233      * Return a string describing the value of the specified control
234      * or child in the <code>result</code> field of the event object.
235      * Returning null tells the client to use the platform value string.
236      * </p>
237      *
238      * @param e an event object containing the following fields:<ul>
239      *    <li>childID [IN] - an identifier specifying the control or one of its children</li>
240      *    <li>result [OUT] - the requested value string, or null</li>
241      * </ul>
242      */
243     public void getValue(AccessibleControlEvent e) {
244     }
245 
246     /**
247      * Sent when an accessibility client requests the children, or visible children,
248      * of the control. The default behavior is to do nothing.
249      * <p>
250      * Return the children as an array of childIDs or accessibles in the
251      * <code>children</code> field of the event object.
252      * </p>
253      *
254      * @param e an event object containing the following fields:<ul>
255      *    <li>detail [IN] - a flag that may have one of the following values:<ul>
256      *    	<li>0 (default) - return all children</li>
257      *    	<li>VISIBLE - return all visible children</li>
258      *    </ul>
259      *    <li>children [Typical OUT] - an array of childIDs</li>
260      *    <li>children [Optional OUT] - an array of accessible objects for the children may be returned instead of the childIDs</li>
261      * </ul>
262      */
263     public void getChildren(AccessibleControlEvent e) {
264     }
265 }