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