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"
29 wxACC_NOT_IMPLEMENTED
,
33 // Child ids are integer identifiers from 1 up.
34 // So zero represents 'this' object.
37 // Navigation constants
42 // Navigate to the sibling object located below the starting object.
45 // Navigate to the first child of this object. When using this flag,
46 // the lVal member of the varStart parameter must be CHILDID_SELF.
49 // Navigate to the last child of this object. When using this flag,
50 // the lVal member of the varStart parameter must be CHILDID_SELF.
53 // Navigate to the sibling object located to the left of the starting object.
56 // Navigate to the next logical object, generally a sibling to the starting object.
59 // Navigate to the previous logical object, generally a sibling to the starting object.
62 // Navigate to the sibling object located to the right of the starting object.
65 // Navigate to the sibling object located above the starting object.
74 // The object represents an alert or a condition that a user should
75 // be notified about. This role is used only for objects that embody
76 // an alert but are not associated with another user interface element
77 // such as a message box, graphic, text, or sound.
78 wxROLE_SYSTEM_ANIMATION
,
79 // The object represents an animation control, which contains content
80 // that changes over time, such as a control that displays a series of
81 // bitmap frames, like a film strip. Animation controls are displayed
82 // when files are copied, or when some other time-consuming task is performed.
83 wxROLE_SYSTEM_APPLICATION
,
84 // The object represents a main window for an application.
86 // The object represents a window border. The entire border is
87 // represented by a single object, rather than by separate objects
89 wxROLE_SYSTEM_BUTTONDROPDOWN
,
90 // The object represents a button that drops down a list of items.
91 wxROLE_SYSTEM_BUTTONDROPDOWNGRID
,
92 // The object represents a button that drops down a grid.
93 wxROLE_SYSTEM_BUTTONMENU
,
94 // The object represents a button that drops down a menu.
96 // The object represents the system caret.
98 // The object represents a cell within a table.
99 wxROLE_SYSTEM_CHARACTER
,
100 // The object represents a cartoon-like graphic object which is
101 // displayed to provide help to users of an application.
103 // The object represents a graphical image used to represent data.
104 wxROLE_SYSTEM_CHECKBUTTON
,
105 // The object represents a check box control, an option turned on
106 // or off independently of other options.
107 wxROLE_SYSTEM_CLIENT
,
108 // The object represents a window's client area.
110 // The object represents a control that displays time.
111 wxROLE_SYSTEM_COLUMN
,
112 // The object represents a column of cells within a table.
113 wxROLE_SYSTEM_COLUMNHEADER
,
114 // The object represents a column header, providing a visual label
115 // for a column in a table.
116 wxROLE_SYSTEM_COMBOBOX
,
117 // The object represents a combo box; an edit control with an
118 // associated list box that provides a set of predefined choices.
119 wxROLE_SYSTEM_CURSOR
,
120 // The object represents the system mouse pointer.
121 wxROLE_SYSTEM_DIAGRAM
,
122 // The object represents a graphical image used to diagram data.
124 // The object represents a dial or knob. This is also a read-only
125 // object with like a speedometer.
126 wxROLE_SYSTEM_DIALOG
,
127 // The object represents a dialog box or message box.
128 wxROLE_SYSTEM_DOCUMENT
,
129 // The object represents a document window. A document window is
130 // always contained within an application window. This role applies
131 // only to multiple-document interface (MDI) windows and refers to
132 // the object that contains the MDI title bar.
133 wxROLE_SYSTEM_DROPLIST
,
134 // The object represents a drop-down list box. It shows one item and
135 // allows the user to display and select another from a list of
136 // alternative values.
137 wxROLE_SYSTEM_EQUATION
,
138 // The object represents a mathematical equation.
139 wxROLE_SYSTEM_GRAPHIC
,
140 // The object represents a picture.
142 // The object represents a special mouse pointer, which allows a user
143 // to manipulate user interface elements such as a window. For
144 // example, a user clicks and drags a sizing grip in the lower-right
145 // corner of a window to resize it.
146 wxROLE_SYSTEM_GROUPING
,
147 // The object logically groups other objects. There is not always a
148 // parent-child relationship between the grouping object and the
149 // objects it contains.
150 wxROLE_SYSTEM_HELPBALLOON
,
151 // The object displays help in the form of a ToolTip or help balloon.
152 wxROLE_SYSTEM_HOTKEYFIELD
,
153 // The object represents a hot-key field that allows the user to
154 // enter a combination or sequence of keystrokes.
155 wxROLE_SYSTEM_INDICATOR
,
156 // The object represents an indicator such as a pointer graphic
157 // that points to the current item.
159 // The object represents a link to something else. This object might
160 // look like text or a graphic, but it acts like a button.
162 // The object represents a list box, allowing the user to select
163 // one or more items.
164 wxROLE_SYSTEM_LISTITEM
,
165 // The object represents an item in a list box or the list portion
166 // of a combo box, drop-down list box, or drop-down combo box.
167 wxROLE_SYSTEM_MENUBAR
,
168 // The object represents the menu bar, following (beneath) the title
169 // bar of a window, from which menus are selected by the user.
170 wxROLE_SYSTEM_MENUITEM
,
171 // The object represents a menu item, which is an entry in a menu
172 // that a user can choose to carry out a command, select an option,
173 // or display another menu. Functionally, a menu item is equivalent
174 // to a push button, radio button, check box, or menu.
175 wxROLE_SYSTEM_MENUPOPUP
,
176 // The object represents a menu, which presents a list of options
177 // from which the user can make a selection to perform an action.
178 // All menu types must have this role, including drop-down menus
179 // that are displayed by selection from a menu bar, and shortcut
180 // menus that are displayed when the right mouse button is clicked.
181 wxROLE_SYSTEM_OUTLINE
,
182 // The object represents an outline or tree structure, such as a
183 // tree view control, which displays a hierarchical list and allows
184 // the user to expand and collapse branches.
185 wxROLE_SYSTEM_OUTLINEITEM
,
186 // The object represents an item in an outline or tree structure.
187 wxROLE_SYSTEM_PAGETAB
,
188 // The object represents a page tab. The only child of a page tab
189 // control is a wxROLE_SYSTEM_GROUPING object that contains the
190 // contents of the associated page.
191 wxROLE_SYSTEM_PAGETABLIST
,
192 // The object represents a container of page tab controls.
194 // The object represents a pane within a frame or document window.
195 // Users can navigate between panes and within the contents of the
196 // current pane, but cannot navigate between items in different panes.
197 // Thus, panes represent a level of grouping lower than frame windows
198 // or documents, but above individual controls. The user navigates
199 // between panes by pressing TAB, F6, or CTRL+TAB, depending on
201 wxROLE_SYSTEM_PROGRESSBAR
,
202 // The object represents a progress bar, dynamically showing the user
203 // the percent complete of an operation in progress. This control takes no user input.
204 wxROLE_SYSTEM_PROPERTYPAGE
,
205 // The object represents a property sheet.
206 wxROLE_SYSTEM_PUSHBUTTON
,
207 // The object represents a push button control.
208 wxROLE_SYSTEM_RADIOBUTTON
,
209 // The object represents an option button, also called a radio button.
210 // It is one of a group of mutually exclusive options. All objects
211 // sharing a single parent that have this attribute are assumed to
212 // be part of single mutually exclusive group. Use
213 // wxROLE_SYSTEM_GROUPING objects to divide them into separate groups.
215 // The object represents a row of cells within a table.
216 wxROLE_SYSTEM_ROWHEADER
,
217 // The object represents a row header, that provides a visual label
219 wxROLE_SYSTEM_SCROLLBAR
,
220 // The object represents a vertical or horizontal scroll bar, which
221 // is part of the client area or used in a control.
222 wxROLE_SYSTEM_SEPARATOR
,
223 // The object is used to visually divide a space into two regions,
224 // such as a separator menu item or a bar that divides split panes
226 wxROLE_SYSTEM_SLIDER
,
227 // The object represents a slider, which allows the user to adjust
228 // a setting in given increments between minimum and maximum values.
230 // The object represents a system sound, which is associated with
231 // various system events.
232 wxROLE_SYSTEM_SPINBUTTON
,
233 // The object represents a spin box, which is a control that allows
234 // the user to increment or decrement the value displayed in a
235 // separate "buddy" control associated with the spin box.
236 wxROLE_SYSTEM_STATICTEXT
,
237 // The object represents read-only text such as labels for other
238 // controls or instructions in a dialog box. Static text cannot be
239 // modified or selected.
240 wxROLE_SYSTEM_STATUSBAR
,
241 // The object represents a status bar, which is an area at the
242 // bottom of a window that displays information about the current
243 // operation, state of the application, or selected object. The
244 // status bar has multiple fields, which display different kinds
247 // The object represents a table that contains rows and columns of
248 // cells, and optionally, row headers and column headers.
250 // The object represents selectable text that allows edits or is read-only.
251 wxROLE_SYSTEM_TITLEBAR
,
252 // The object represents a title or caption bar for a window.
253 wxROLE_SYSTEM_TOOLBAR
,
254 // The object represents a toolbar, which is a grouping of controls
255 // that provide easy access to frequently used features.
256 wxROLE_SYSTEM_TOOLTIP
,
257 // The object represents a ToolTip that provides helpful hints.
258 wxROLE_SYSTEM_WHITESPACE
,
259 // The object represents blank space between other objects.
261 // The object represents the window frame, which contains child objects
262 // such as a title bar, client, and other objects contained in a window.
267 #define wxACC_STATE_SYSTEM_ALERT_HIGH 0x0000001
269 Indicates important information to convey to the user
270 immediately. For example, a battery level indicator that
271 reaches a critical low level transitions to this state,
272 in which case a blind access utility announces this
273 information immediately to the user, and a screen
274 magnification program scrolls the screen so the battery
275 indicator is in view. This state is also appropriate for
276 any prompt or operation that must be completed before
277 the user can continue.
280 #define wxACC_STATE_SYSTEM_ALERT_MEDIUM 0x00000002
282 Indicates important information that is not conveyed to
283 the user immediately. For example, when a battery level
284 indicator is starting to reach a low level, it generates
285 a medium-level alert. Blind access utilities then
286 generate a sound to let the user know that important
287 information is available, without actually interrupting
288 the user's work. The user could then query the alert
289 information at his or her leisure.
292 #define wxACC_STATE_SYSTEM_ALERT_LOW 0x00000004
294 Indicates low-priority information that is not important
295 to the user. This state is used, for example, when Word
296 changes the appearance of the TipWizard button on its
297 toolbar to indicate that it has a hint for the user.
300 #define wxACC_STATE_SYSTEM_ANIMATED 0x00000008
302 The object's appearance changes rapidly or constantly.
303 Graphics that are occasionally animated are described as
304 wxROLE_SYSTEM_GRAPHIC with the State property set to
305 This state is be used to indicate
306 that the object's location is changing.
309 #define wxACC_STATE_SYSTEM_BUSY 0x00000010
311 The control cannot accept input at this time.
314 #define wxACC_STATE_SYSTEM_CHECKED 0x00000020
316 The object's check box is selected.
319 #define wxACC_STATE_SYSTEM_COLLAPSED 0x00000040
321 Children of this object that have the
322 ROLE_SYSTEM_OUTLINEITEM role are hidden.
325 #define wxACC_STATE_SYSTEM_DEFAULT 0x00000080
327 The default button or menu item.
330 #define wxACC_STATE_SYSTEM_EXPANDED 0x00000100
332 Children of this object that have the
333 ROLE_SYSTEM_OUTLINEITEM role are displayed.
336 #define wxACC_STATE_SYSTEM_EXTSELECTABLE 0x00000200
338 Indicates that an object extends its selection using
339 SELFLAG_EXTENDSELECTION in the IAccessible::accSelect
343 #define wxACC_STATE_SYSTEM_FLOATING 0x00000400
345 The object is not clipped to the boundary of its parent
346 object and does not move automatically when the parent
350 #define wxACC_STATE_SYSTEM_FOCUSABLE 0x00000800
352 The object is on the active window and ready to receive
356 #define wxACC_STATE_SYSTEM_FOCUSED 0x00001000
358 The object has the keyboard focus. Do not confuse object
359 focus with object selection. For more information, see
360 Selection and Focus Properties and Methods.
363 #define wxACC_STATE_SYSTEM_HOTTRACKED 0x00002000
365 The object is hot-tracked by the mouse, meaning that its
366 appearance has changed to indicate that the mouse
367 pointer is located over it.
370 #define wxACC_STATE_SYSTEM_INVISIBLE 0x00004000
372 Object is hidden or not visible. A list of files names
373 in a list box contain several hundred names, but only a
374 few are visible to the user. The rest are clipped by the
375 parent and have wxACC_STATE_SYSTEM_INVISIBLE set. Objects that
376 are never visible are set as wxACC_STATE_SYSTEM_OFFSCREEN.
377 Note that an object is considered visible when the
378 wxACC_STATE_SYSTEM_INVISIBLE flag is not set, and yet obscured
379 by another application, so is not visible to the user.
380 For example, an object is considered visible if it
381 appears in the main window of an application even though
382 it is obscured by a dialog.
385 #define wxACC_STATE_SYSTEM_MARQUEED 0x00008000
387 Indicates scrolling or moving text or graphics.
390 #define wxACC_STATE_SYSTEM_MIXED 0x00010000
392 Indicates that the state of a three-state check box or
393 toolbar button is not determined. The check box is
394 neither checked nor unchecked and is therefore in the
395 third or mixed state.
398 #define wxACC_STATE_SYSTEM_MULTISELECTABLE 0x00020000
400 Object accepts multiple selected items,
401 SELFLAG_ADDSELECTION for the IAccessible::accSelect
405 #define wxACC_STATE_SYSTEM_OFFSCREEN 0x00040000
407 Indicates that the object has no on-screen
408 representation. A sound or alert object has this state,
409 or a hidden window that is never made visible.
412 #define wxACC_STATE_SYSTEM_PRESSED 0x00080000
414 The object is pressed.
417 #define wxACC_STATE_SYSTEM_PROTECTED 0x00100000
419 The object is a password-protected edit control.
422 #define wxACC_STATE_SYSTEM_READONLY 0x00200000
424 The object is read-only.
427 #define wxACC_STATE_SYSTEM_SELECTABLE 0x00400000
429 The object accepts selection.
432 #define wxACC_STATE_SYSTEM_SELECTED 0x00800000
434 The object is selected.
437 #define wxACC_STATE_SYSTEM_SELFVOICING 0x01000000
439 The object or child uses text-to-speech (TTS) for
440 description purposes. A speech-based accessibility aid
441 does not announce information when an object with this
442 state has the focus because the object automatically
443 announces information.
446 #define wxACC_STATE_SYSTEM_UNAVAILABLE 0x02000000
448 The object is unavailable.
456 wxACC_SEL_TAKEFOCUS
= 1,
457 wxACC_SEL_TAKESELECTION
= 2,
458 wxACC_SEL_EXTENDSELECTION
= 4,
459 wxACC_SEL_ADDSELECTION
= 8,
460 wxACC_SEL_REMOVESELECTION
= 16
461 } wxAccSelectionFlags
;
463 // ----------------------------------------------------------------------------
465 // All functions return an indication of success, failure, or not implemented.
466 // ----------------------------------------------------------------------------
468 class WXDLLEXPORT wxAccessible
;
469 class WXDLLEXPORT wxAccessibleBase
: public wxObject
471 DECLARE_NO_COPY_CLASS(wxAccessibleBase
)
474 wxAccessibleBase(wxWindow
* win
): m_window(win
) {};
475 virtual ~wxAccessibleBase() {};
479 // Can return either a child object, or an integer
480 // representing the child element, starting from 1.
481 virtual wxAccStatus
HitTest(const wxPoint
& WXUNUSED(pt
), int* WXUNUSED(childId
), wxAccessible
** WXUNUSED(childObject
))
482 { return wxACC_NOT_IMPLEMENTED
; }
484 // Returns the rectangle for this object (id = 0) or a child element (id > 0).
485 virtual wxAccStatus
GetLocation(wxRect
& WXUNUSED(rect
), int WXUNUSED(elementId
))
486 { return wxACC_NOT_IMPLEMENTED
; }
488 // Navigates from fromId to toId/toObject.
489 virtual wxAccStatus
Navigate(wxNavDir
WXUNUSED(navDir
), int WXUNUSED(fromId
),
490 int* WXUNUSED(toId
), wxAccessible
** WXUNUSED(toObject
))
491 { return wxACC_NOT_IMPLEMENTED
; }
493 // Gets the name of the specified object.
494 virtual wxAccStatus
GetName(int WXUNUSED(childId
), wxString
* WXUNUSED(name
))
495 { return wxACC_NOT_IMPLEMENTED
; }
497 // Gets the number of children.
498 virtual wxAccStatus
GetChildCount(int* WXUNUSED(childId
))
499 { return wxACC_NOT_IMPLEMENTED
; }
501 // Gets the specified child (starting from 1).
502 // If *child is NULL and return value is wxACC_OK,
503 // this means that the child is a simple element and
504 // not an accessible object.
505 virtual wxAccStatus
GetChild(int WXUNUSED(childId
), wxAccessible
** WXUNUSED(child
))
506 { return wxACC_NOT_IMPLEMENTED
; }
508 // Gets the parent, or NULL.
509 virtual wxAccStatus
GetParent(wxAccessible
** WXUNUSED(parent
))
510 { return wxACC_NOT_IMPLEMENTED
; }
512 // Performs the default action. childId is 0 (the action for this object)
513 // or > 0 (the action for a child).
514 // Return wxACC_NOT_SUPPORTED if there is no default action for this
515 // window (e.g. an edit control).
516 virtual wxAccStatus
DoDefaultAction(int WXUNUSED(childId
))
517 { return wxACC_NOT_IMPLEMENTED
; }
519 // Gets the default action for this object (0) or > 0 (the action for a child).
520 // Return wxACC_OK even if there is no action. actionName is the action, or the empty
521 // string if there is no action.
522 // The retrieved string describes the action that is performed on an object,
523 // not what the object does as a result. For example, a toolbar button that prints
524 // a document has a default action of "Press" rather than "Prints the current document."
525 virtual wxAccStatus
GetDefaultAction(int WXUNUSED(childId
), wxString
* WXUNUSED(actionName
))
526 { return wxACC_NOT_IMPLEMENTED
; }
528 // Returns the description for this object or a child.
529 virtual wxAccStatus
GetDescription(int WXUNUSED(childId
), wxString
* WXUNUSED(description
))
530 { return wxACC_NOT_IMPLEMENTED
; }
532 // Returns help text for this object or a child, similar to tooltip text.
533 virtual wxAccStatus
GetHelpText(int WXUNUSED(childId
), wxString
* WXUNUSED(helpText
))
534 { return wxACC_NOT_IMPLEMENTED
; }
536 // Returns the keyboard shortcut for this object or child.
538 virtual wxAccStatus
GetKeyboardShortcut(int WXUNUSED(childId
), wxString
* WXUNUSED(shortcut
))
539 { return wxACC_NOT_IMPLEMENTED
; }
541 // Returns a role constant.
542 virtual wxAccStatus
GetRole(int WXUNUSED(childId
), wxAccRole
* WXUNUSED(role
))
543 { return wxACC_NOT_IMPLEMENTED
; }
545 // Returns a state constant.
546 virtual wxAccStatus
GetState(int WXUNUSED(childId
), long* WXUNUSED(state
))
547 { return wxACC_NOT_IMPLEMENTED
; }
549 // Returns a localized string representing the value for the object
551 virtual wxAccStatus
GetValue(int WXUNUSED(childId
), wxString
* WXUNUSED(strValue
))
552 { return wxACC_NOT_IMPLEMENTED
; }
554 // Selects the object or child.
555 virtual wxAccStatus
Select(int WXUNUSED(childId
), wxAccSelectionFlags
WXUNUSED(selectFlags
))
556 { return wxACC_NOT_IMPLEMENTED
; }
558 // Gets the window with the keyboard focus.
559 // If childId is 0 and child is NULL, no object in
560 // this subhierarchy has the focus.
561 // If this object has the focus, child should be 'this'.
562 virtual wxAccStatus
GetFocus(int* WXUNUSED(childId
), wxAccessible
** WXUNUSED(child
))
563 { return wxACC_NOT_IMPLEMENTED
; }
565 // Gets a variant representing the selected children
567 // Acceptable values:
568 // - a null variant (IsNull() returns TRUE)
569 // - a list variant (GetType() == wxT("list"))
570 // - an integer representing the selected child element,
571 // or 0 if this object is selected (GetType() == wxT("long"))
572 // - a "void*" pointer to a wxAccessible child object
573 virtual wxAccStatus
GetSelections(wxVariant
* WXUNUSED(selections
))
574 { return wxACC_NOT_IMPLEMENTED
; }
578 // Returns the window associated with this object.
580 wxWindow
* GetWindow() { return m_window
; }
582 // Sets the window associated with this object.
584 void SetWindow(wxWindow
* window
) { m_window
= window
; }
597 Possibly have ways to access other accessible objects.
598 What if they're not explicitly implemented? Should be able to use
599 the accessible API to retrieve info about them. Probably
600 should use a quite different client API, to be able to
601 retrieve info from other apps too.
602 But try to avoid implementing this unless absolutely necessary.
606 // ----------------------------------------------------------------------------
607 // now include the declaration of the real class
608 // ----------------------------------------------------------------------------
610 #if defined(__WXMSW__)
611 #include "wx/msw/ole/access.h"
612 #elif defined(__WXMOTIF__)
613 #include "wx/generic/access.h"
614 #elif defined(__WXMGL__)
615 #include "wx/generic/access.h"
616 #elif defined(__WXGTK__)
617 #include "wx/generic/access.h"
618 #elif defined(__WXX11__)
619 #include "wx/generic/access.h"
620 #elif defined(__WXMAC__)
621 #include "wx/generic/access.h"
622 #elif defined(__WXPM__)
623 #include "wx/generic/access.h"