1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Accessibility classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_ACCESSBASE_H_
13 #define _WX_ACCESSBASE_H_
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "accessbase.h"
19 // ----------------------------------------------------------------------------
20 // headers we have to include here
21 // ----------------------------------------------------------------------------
23 #include "wx/variant.h"
30 wxACC_NOT_IMPLEMENTED
,
34 // Child ids are integer identifiers from 1 up.
35 // So zero represents 'this' object.
38 // Navigation constants
43 // Navigate to the sibling object located below the starting object.
46 // Navigate to the first child of this object. When using this flag,
47 // the lVal member of the varStart parameter must be CHILDID_SELF.
50 // Navigate to the last child of this object. When using this flag,
51 // the lVal member of the varStart parameter must be CHILDID_SELF.
54 // Navigate to the sibling object located to the left of the starting object.
57 // Navigate to the next logical object, generally a sibling to the starting object.
60 // Navigate to the previous logical object, generally a sibling to the starting object.
63 // Navigate to the sibling object located to the right of the starting object.
66 // Navigate to the sibling object located above the starting object.
75 // The object represents an alert or a condition that a user should
76 // be notified about. This role is used only for objects that embody
77 // an alert but are not associated with another user interface element
78 // such as a message box, graphic, text, or sound.
79 wxROLE_SYSTEM_ANIMATION
,
80 // The object represents an animation control, which contains content
81 // that changes over time, such as a control that displays a series of
82 // bitmap frames, like a film strip. Animation controls are displayed
83 // when files are copied, or when some other time-consuming task is performed.
84 wxROLE_SYSTEM_APPLICATION
,
85 // The object represents a main window for an application.
87 // The object represents a window border. The entire border is
88 // represented by a single object, rather than by separate objects
90 wxROLE_SYSTEM_BUTTONDROPDOWN
,
91 // The object represents a button that drops down a list of items.
92 wxROLE_SYSTEM_BUTTONDROPDOWNGRID
,
93 // The object represents a button that drops down a grid.
94 wxROLE_SYSTEM_BUTTONMENU
,
95 // The object represents a button that drops down a menu.
97 // The object represents the system caret.
99 // The object represents a cell within a table.
100 wxROLE_SYSTEM_CHARACTER
,
101 // The object represents a cartoon-like graphic object which is
102 // displayed to provide help to users of an application.
104 // The object represents a graphical image used to represent data.
105 wxROLE_SYSTEM_CHECKBUTTON
,
106 // The object represents a check box control, an option turned on
107 // or off independently of other options.
108 wxROLE_SYSTEM_CLIENT
,
109 // The object represents a window's client area.
111 // The object represents a control that displays time.
112 wxROLE_SYSTEM_COLUMN
,
113 // The object represents a column of cells within a table.
114 wxROLE_SYSTEM_COLUMNHEADER
,
115 // The object represents a column header, providing a visual label
116 // for a column in a table.
117 wxROLE_SYSTEM_COMBOBOX
,
118 // The object represents a combo box; an edit control with an
119 // associated list box that provides a set of predefined choices.
120 wxROLE_SYSTEM_CURSOR
,
121 // The object represents the system mouse pointer.
122 wxROLE_SYSTEM_DIAGRAM
,
123 // The object represents a graphical image used to diagram data.
125 // The object represents a dial or knob. This is also a read-only
126 // object with like a speedometer.
127 wxROLE_SYSTEM_DIALOG
,
128 // The object represents a dialog box or message box.
129 wxROLE_SYSTEM_DOCUMENT
,
130 // The object represents a document window. A document window is
131 // always contained within an application window. This role applies
132 // only to multiple-document interface (MDI) windows and refers to
133 // the object that contains the MDI title bar.
134 wxROLE_SYSTEM_DROPLIST
,
135 // The object represents a drop-down list box. It shows one item and
136 // allows the user to display and select another from a list of
137 // alternative values.
138 wxROLE_SYSTEM_EQUATION
,
139 // The object represents a mathematical equation.
140 wxROLE_SYSTEM_GRAPHIC
,
141 // The object represents a picture.
143 // The object represents a special mouse pointer, which allows a user
144 // to manipulate user interface elements such as a window. For
145 // example, a user clicks and drags a sizing grip in the lower-right
146 // corner of a window to resize it.
147 wxROLE_SYSTEM_GROUPING
,
148 // The object logically groups other objects. There is not always a
149 // parent-child relationship between the grouping object and the
150 // objects it contains.
151 wxROLE_SYSTEM_HELPBALLOON
,
152 // The object displays help in the form of a ToolTip or help balloon.
153 wxROLE_SYSTEM_HOTKEYFIELD
,
154 // The object represents a hot-key field that allows the user to
155 // enter a combination or sequence of keystrokes.
156 wxROLE_SYSTEM_INDICATOR
,
157 // The object represents an indicator such as a pointer graphic
158 // that points to the current item.
160 // The object represents a link to something else. This object might
161 // look like text or a graphic, but it acts like a button.
163 // The object represents a list box, allowing the user to select
164 // one or more items.
165 wxROLE_SYSTEM_LISTITEM
,
166 // The object represents an item in a list box or the list portion
167 // of a combo box, drop-down list box, or drop-down combo box.
168 wxROLE_SYSTEM_MENUBAR
,
169 // The object represents the menu bar, following (beneath) the title
170 // bar of a window, from which menus are selected by the user.
171 wxROLE_SYSTEM_MENUITEM
,
172 // The object represents a menu item, which is an entry in a menu
173 // that a user can choose to carry out a command, select an option,
174 // or display another menu. Functionally, a menu item is equivalent
175 // to a push button, radio button, check box, or menu.
176 wxROLE_SYSTEM_MENUPOPUP
,
177 // The object represents a menu, which presents a list of options
178 // from which the user can make a selection to perform an action.
179 // All menu types must have this role, including drop-down menus
180 // that are displayed by selection from a menu bar, and shortcut
181 // menus that are displayed when the right mouse button is clicked.
182 wxROLE_SYSTEM_OUTLINE
,
183 // The object represents an outline or tree structure, such as a
184 // tree view control, which displays a hierarchical list and allows
185 // the user to expand and collapse branches.
186 wxROLE_SYSTEM_OUTLINEITEM
,
187 // The object represents an item in an outline or tree structure.
188 wxROLE_SYSTEM_PAGETAB
,
189 // The object represents a page tab. The only child of a page tab
190 // control is a wxROLE_SYSTEM_GROUPING object that contains the
191 // contents of the associated page.
192 wxROLE_SYSTEM_PAGETABLIST
,
193 // The object represents a container of page tab controls.
195 // The object represents a pane within a frame or document window.
196 // Users can navigate between panes and within the contents of the
197 // current pane, but cannot navigate between items in different panes.
198 // Thus, panes represent a level of grouping lower than frame windows
199 // or documents, but above individual controls. The user navigates
200 // between panes by pressing TAB, F6, or CTRL+TAB, depending on
202 wxROLE_SYSTEM_PROGRESSBAR
,
203 // The object represents a progress bar, dynamically showing the user
204 // the percent complete of an operation in progress. This control takes no user input.
205 wxROLE_SYSTEM_PROPERTYPAGE
,
206 // The object represents a property sheet.
207 wxROLE_SYSTEM_PUSHBUTTON
,
208 // The object represents a push button control.
209 wxROLE_SYSTEM_RADIOBUTTON
,
210 // The object represents an option button, also called a radio button.
211 // It is one of a group of mutually exclusive options. All objects
212 // sharing a single parent that have this attribute are assumed to
213 // be part of single mutually exclusive group. Use
214 // wxROLE_SYSTEM_GROUPING objects to divide them into separate groups.
216 // The object represents a row of cells within a table.
217 wxROLE_SYSTEM_ROWHEADER
,
218 // The object represents a row header, that provides a visual label
220 wxROLE_SYSTEM_SCROLLBAR
,
221 // The object represents a vertical or horizontal scroll bar, which
222 // is part of the client area or used in a control.
223 wxROLE_SYSTEM_SEPARATOR
,
224 // The object is used to visually divide a space into two regions,
225 // such as a separator menu item or a bar that divides split panes
227 wxROLE_SYSTEM_SLIDER
,
228 // The object represents a slider, which allows the user to adjust
229 // a setting in given increments between minimum and maximum values.
231 // The object represents a system sound, which is associated with
232 // various system events.
233 wxROLE_SYSTEM_SPINBUTTON
,
234 // The object represents a spin box, which is a control that allows
235 // the user to increment or decrement the value displayed in a
236 // separate "buddy" control associated with the spin box.
237 wxROLE_SYSTEM_STATICTEXT
,
238 // The object represents read-only text such as labels for other
239 // controls or instructions in a dialog box. Static text cannot be
240 // modified or selected.
241 wxROLE_SYSTEM_STATUSBAR
,
242 // The object represents a status bar, which is an area at the
243 // bottom of a window that displays information about the current
244 // operation, state of the application, or selected object. The
245 // status bar has multiple fields, which display different kinds
248 // The object represents a table that contains rows and columns of
249 // cells, and optionally, row headers and column headers.
251 // The object represents selectable text that allows edits or is read-only.
252 wxROLE_SYSTEM_TITLEBAR
,
253 // The object represents a title or caption bar for a window.
254 wxROLE_SYSTEM_TOOLBAR
,
255 // The object represents a toolbar, which is a grouping of controls
256 // that provide easy access to frequently used features.
257 wxROLE_SYSTEM_TOOLTIP
,
258 // The object represents a ToolTip that provides helpful hints.
259 wxROLE_SYSTEM_WHITESPACE
,
260 // The object represents blank space between other objects.
262 // The object represents the window frame, which contains child objects
263 // such as a title bar, client, and other objects contained in a window.
268 #define wxACC_STATE_SYSTEM_ALERT_HIGH 0x0000001
270 Indicates important information to convey to the user
271 immediately. For example, a battery level indicator that
272 reaches a critical low level transitions to this state,
273 in which case a blind access utility announces this
274 information immediately to the user, and a screen
275 magnification program scrolls the screen so the battery
276 indicator is in view. This state is also appropriate for
277 any prompt or operation that must be completed before
278 the user can continue.
281 #define wxACC_STATE_SYSTEM_ALERT_MEDIUM 0x00000002
283 Indicates important information that is not conveyed to
284 the user immediately. For example, when a battery level
285 indicator is starting to reach a low level, it generates
286 a medium-level alert. Blind access utilities then
287 generate a sound to let the user know that important
288 information is available, without actually interrupting
289 the user's work. The user could then query the alert
290 information at his or her leisure.
293 #define wxACC_STATE_SYSTEM_ALERT_LOW 0x00000004
295 Indicates low-priority information that is not important
296 to the user. This state is used, for example, when Word
297 changes the appearance of the TipWizard button on its
298 toolbar to indicate that it has a hint for the user.
301 #define wxACC_STATE_SYSTEM_ANIMATED 0x00000008
303 The object's appearance changes rapidly or constantly.
304 Graphics that are occasionally animated are described as
305 wxROLE_SYSTEM_GRAPHIC with the State property set to
306 This state is be used to indicate
307 that the object's location is changing.
310 #define wxACC_STATE_SYSTEM_BUSY 0x00000010
312 The control cannot accept input at this time.
315 #define wxACC_STATE_SYSTEM_CHECKED 0x00000020
317 The object's check box is selected.
320 #define wxACC_STATE_SYSTEM_COLLAPSED 0x00000040
322 Children of this object that have the
323 ROLE_SYSTEM_OUTLINEITEM role are hidden.
326 #define wxACC_STATE_SYSTEM_DEFAULT 0x00000080
328 The default button or menu item.
331 #define wxACC_STATE_SYSTEM_EXPANDED 0x00000100
333 Children of this object that have the
334 ROLE_SYSTEM_OUTLINEITEM role are displayed.
337 #define wxACC_STATE_SYSTEM_EXTSELECTABLE 0x00000200
339 Indicates that an object extends its selection using
340 SELFLAG_EXTENDSELECTION in the IAccessible::accSelect
344 #define wxACC_STATE_SYSTEM_FLOATING 0x00000400
346 The object is not clipped to the boundary of its parent
347 object and does not move automatically when the parent
351 #define wxACC_STATE_SYSTEM_FOCUSABLE 0x00000800
353 The object is on the active window and ready to receive
357 #define wxACC_STATE_SYSTEM_FOCUSED 0x00001000
359 The object has the keyboard focus. Do not confuse object
360 focus with object selection. For more information, see
361 Selection and Focus Properties and Methods.
364 #define wxACC_STATE_SYSTEM_HOTTRACKED 0x00002000
366 The object is hot-tracked by the mouse, meaning that its
367 appearance has changed to indicate that the mouse
368 pointer is located over it.
371 #define wxACC_STATE_SYSTEM_INVISIBLE 0x00004000
373 Object is hidden or not visible. A list of files names
374 in a list box contain several hundred names, but only a
375 few are visible to the user. The rest are clipped by the
376 parent and have wxACC_STATE_SYSTEM_INVISIBLE set. Objects that
377 are never visible are set as wxACC_STATE_SYSTEM_OFFSCREEN.
378 Note that an object is considered visible when the
379 wxACC_STATE_SYSTEM_INVISIBLE flag is not set, and yet obscured
380 by another application, so is not visible to the user.
381 For example, an object is considered visible if it
382 appears in the main window of an application even though
383 it is obscured by a dialog.
386 #define wxACC_STATE_SYSTEM_MARQUEED 0x00008000
388 Indicates scrolling or moving text or graphics.
391 #define wxACC_STATE_SYSTEM_MIXED 0x00010000
393 Indicates that the state of a three-state check box or
394 toolbar button is not determined. The check box is
395 neither checked nor unchecked and is therefore in the
396 third or mixed state.
399 #define wxACC_STATE_SYSTEM_MULTISELECTABLE 0x00020000
401 Object accepts multiple selected items,
402 SELFLAG_ADDSELECTION for the IAccessible::accSelect
406 #define wxACC_STATE_SYSTEM_OFFSCREEN 0x00040000
408 Indicates that the object has no on-screen
409 representation. A sound or alert object has this state,
410 or a hidden window that is never made visible.
413 #define wxACC_STATE_SYSTEM_PRESSED 0x00080000
415 The object is pressed.
418 #define wxACC_STATE_SYSTEM_PROTECTED 0x00100000
420 The object is a password-protected edit control.
423 #define wxACC_STATE_SYSTEM_READONLY 0x00200000
425 The object is read-only.
428 #define wxACC_STATE_SYSTEM_SELECTABLE 0x00400000
430 The object accepts selection.
433 #define wxACC_STATE_SYSTEM_SELECTED 0x00800000
435 The object is selected.
438 #define wxACC_STATE_SYSTEM_SELFVOICING 0x01000000
440 The object or child uses text-to-speech (TTS) for
441 description purposes. A speech-based accessibility aid
442 does not announce information when an object with this
443 state has the focus because the object automatically
444 announces information.
447 #define wxACC_STATE_SYSTEM_UNAVAILABLE 0x02000000
449 The object is unavailable.
457 wxACC_SEL_TAKEFOCUS
= 1,
458 wxACC_SEL_TAKESELECTION
= 2,
459 wxACC_SEL_EXTENDSELECTION
= 4,
460 wxACC_SEL_ADDSELECTION
= 8,
461 wxACC_SEL_REMOVESELECTION
= 16
462 } wxAccSelectionFlags
;
464 // ----------------------------------------------------------------------------
466 // All functions return an indication of success, failure, or not implemented.
467 // ----------------------------------------------------------------------------
469 class WXDLLEXPORT wxAccessible
;
470 class WXDLLEXPORT wxAccessibleBase
: public wxObject
472 DECLARE_NO_COPY_CLASS(wxAccessibleBase
)
475 wxAccessibleBase(wxWindow
* win
): m_window(win
) {};
476 virtual ~wxAccessibleBase() {};
480 // Can return either a child object, or an integer
481 // representing the child element, starting from 1.
482 virtual wxAccStatus
HitTest(const wxPoint
& WXUNUSED(pt
), int* WXUNUSED(childId
), wxAccessible
** WXUNUSED(childObject
))
483 { return wxACC_NOT_IMPLEMENTED
; }
485 // Returns the rectangle for this object (id = 0) or a child element (id > 0).
486 virtual wxAccStatus
GetLocation(wxRect
& WXUNUSED(rect
), int WXUNUSED(elementId
))
487 { return wxACC_NOT_IMPLEMENTED
; }
489 // Navigates from fromId to toId/toObject.
490 virtual wxAccStatus
Navigate(wxNavDir
WXUNUSED(navDir
), int WXUNUSED(fromId
),
491 int* WXUNUSED(toId
), wxAccessible
** WXUNUSED(toObject
))
492 { return wxACC_NOT_IMPLEMENTED
; }
494 // Gets the name of the specified object.
495 virtual wxAccStatus
GetName(int WXUNUSED(childId
), wxString
* WXUNUSED(name
))
496 { return wxACC_NOT_IMPLEMENTED
; }
498 // Gets the number of children.
499 virtual wxAccStatus
GetChildCount(int* WXUNUSED(childId
))
500 { return wxACC_NOT_IMPLEMENTED
; }
502 // Gets the specified child (starting from 1).
503 // If *child is NULL and return value is wxACC_OK,
504 // this means that the child is a simple element and
505 // not an accessible object.
506 virtual wxAccStatus
GetChild(int WXUNUSED(childId
), wxAccessible
** WXUNUSED(child
))
507 { return wxACC_NOT_IMPLEMENTED
; }
509 // Gets the parent, or NULL.
510 virtual wxAccStatus
GetParent(wxAccessible
** WXUNUSED(parent
))
511 { return wxACC_NOT_IMPLEMENTED
; }
513 // Performs the default action. childId is 0 (the action for this object)
514 // or > 0 (the action for a child).
515 // Return wxACC_NOT_SUPPORTED if there is no default action for this
516 // window (e.g. an edit control).
517 virtual wxAccStatus
DoDefaultAction(int WXUNUSED(childId
))
518 { return wxACC_NOT_IMPLEMENTED
; }
520 // Gets the default action for this object (0) or > 0 (the action for a child).
521 // Return wxACC_OK even if there is no action. actionName is the action, or the empty
522 // string if there is no action.
523 // The retrieved string describes the action that is performed on an object,
524 // not what the object does as a result. For example, a toolbar button that prints
525 // a document has a default action of "Press" rather than "Prints the current document."
526 virtual wxAccStatus
GetDefaultAction(int WXUNUSED(childId
), wxString
* WXUNUSED(actionName
))
527 { return wxACC_NOT_IMPLEMENTED
; }
529 // Returns the description for this object or a child.
530 virtual wxAccStatus
GetDescription(int WXUNUSED(childId
), wxString
* WXUNUSED(description
))
531 { return wxACC_NOT_IMPLEMENTED
; }
533 // Returns help text for this object or a child, similar to tooltip text.
534 virtual wxAccStatus
GetHelpText(int WXUNUSED(childId
), wxString
* WXUNUSED(helpText
))
535 { return wxACC_NOT_IMPLEMENTED
; }
537 // Returns the keyboard shortcut for this object or child.
539 virtual wxAccStatus
GetKeyboardShortcut(int WXUNUSED(childId
), wxString
* WXUNUSED(shortcut
))
540 { return wxACC_NOT_IMPLEMENTED
; }
542 // Returns a role constant.
543 virtual wxAccStatus
GetRole(int WXUNUSED(childId
), wxAccRole
* WXUNUSED(role
))
544 { return wxACC_NOT_IMPLEMENTED
; }
546 // Returns a state constant.
547 virtual wxAccStatus
GetState(int WXUNUSED(childId
), long* WXUNUSED(state
))
548 { return wxACC_NOT_IMPLEMENTED
; }
550 // Returns a localized string representing the value for the object
552 virtual wxAccStatus
GetValue(int WXUNUSED(childId
), wxString
* WXUNUSED(strValue
))
553 { return wxACC_NOT_IMPLEMENTED
; }
555 // Selects the object or child.
556 virtual wxAccStatus
Select(int WXUNUSED(childId
), wxAccSelectionFlags
WXUNUSED(selectFlags
))
557 { return wxACC_NOT_IMPLEMENTED
; }
559 // Gets the window with the keyboard focus.
560 // If childId is 0 and child is NULL, no object in
561 // this subhierarchy has the focus.
562 // If this object has the focus, child should be 'this'.
563 virtual wxAccStatus
GetFocus(int* WXUNUSED(childId
), wxAccessible
** WXUNUSED(child
))
564 { return wxACC_NOT_IMPLEMENTED
; }
566 // Gets a variant representing the selected children
568 // Acceptable values:
569 // - a null variant (IsNull() returns TRUE)
570 // - a list variant (GetType() == wxT("list"))
571 // - an integer representing the selected child element,
572 // or 0 if this object is selected (GetType() == wxT("long"))
573 // - a "void*" pointer to a wxAccessible child object
574 virtual wxAccStatus
GetSelections(wxVariant
* WXUNUSED(selections
))
575 { return wxACC_NOT_IMPLEMENTED
; }
579 // Returns the window associated with this object.
581 wxWindow
* GetWindow() { return m_window
; }
583 // Sets the window associated with this object.
585 void SetWindow(wxWindow
* window
) { m_window
= window
; }
598 Possibly have ways to access other accessible objects.
599 What if they're not explicitly implemented? Should be able to use
600 the accessible API to retrieve info about them. Probably
601 should use a quite different client API, to be able to
602 retrieve info from other apps too.
603 But try to avoid implementing this unless absolutely necessary.
607 // ----------------------------------------------------------------------------
608 // now include the declaration of the real class
609 // ----------------------------------------------------------------------------
611 #if defined(__WXMSW__)
612 #include "wx/msw/ole/access.h"
613 #elif defined(__WXMOTIF__)
614 #include "wx/generic/access.h"
615 #elif defined(__WXMGL__)
616 #include "wx/generic/access.h"
617 #elif defined(__WXGTK__)
618 #include "wx/generic/access.h"
619 #elif defined(__WXX11__)
620 #include "wx/generic/access.h"
621 #elif defined(__WXMAC__)
622 #include "wx/generic/access.h"
623 #elif defined(__WXPM__)
624 #include "wx/generic/access.h"