1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxAccessible class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 The wxAccessible class allows wxWidgets applications, and
14 wxWidgets itself, to return extended information about user interface elements
15 to client applications such as screen readers. This is the
16 main way in which wxWidgets implements accessibility features.
18 At present, only Microsoft Active Accessibility is supported
21 To use this class, derive from wxAccessible, implement appropriate
22 functions, and associate an object of the class with a
23 window using wxWindow::SetAccessible.
25 All functions return an indication of success, failure, or not implemented
26 using values of the wxAccStatus enum type.
28 If you return wxACC_NOT_IMPLEMENTED from any function, the system will try to
29 implement the appropriate functionality. However this will not work with
32 Most functions work with an @e object id, which can be zero to refer to
33 'this' UI element, or greater than zero to refer to the nth child element.
34 This allows you to specify elements that don't have a corresponding wxWindow or
35 wxAccessible; for example, the sash of a splitter window.
37 For details on the semantics of functions and types, please refer to the
38 Microsoft Active Accessibility 1.2 documentation.
40 This class is compiled into wxWidgets only if the wxUSE_ACCESSIBILITY setup
46 class wxAccessible
: public wxObject
50 Constructor, taking an optional window. The object can be associated with
53 wxAccessible(wxWindow
* win
= @NULL
);
61 Performs the default action for the object. @e childId is 0 (the action for
63 or greater than 0 (the action for a child). Return wxACC_NOT_SUPPORTED if there
64 is no default action for this window (e.g. an edit control).
66 virtual wxAccStatus
DoDefaultAction(int childId
);
69 Gets the specified child (starting from 1). If @e child is @NULL and the return
71 this means that the child is a simple element and not an accessible object.
73 virtual wxAccStatus
GetChild(int childId
, wxAccessible
** child
);
76 Returns the number of children in @e childCount.
78 virtual wxAccStatus
GetChildCount(int* childCount
);
81 Gets the default action for this object (0) or a child (greater than 0).
82 Return wxACC_OK even if there is no action. @e actionName is the action, or the
84 string if there is no action. The retrieved string describes the action that is
85 performed on an object,
86 not what the object does as a result. For example, a toolbar button that prints
87 a document has a default action of "Press" rather than "Prints the current
90 virtual wxAccStatus
GetDefaultAction(int childId
,
91 wxString
* actionName
);
94 Returns the description for this object or a child.
96 virtual wxAccStatus
GetDescription(int childId
,
97 wxString
* description
);
100 Gets the window with the keyboard focus. If childId is 0 and child is @NULL, no
102 this subhierarchy has the focus. If this object has the focus, child should be
105 virtual wxAccStatus
GetFocus(int* childId
, wxAccessible
** child
);
108 Returns help text for this object or a child, similar to tooltip text.
110 virtual wxAccStatus
GetHelpText(int childId
, wxString
* helpText
);
113 Returns the keyboard shortcut for this object or child.
116 virtual wxAccStatus
GetKeyboardShortcut(int childId
,
120 Returns the rectangle for this object (id is 0) or a child element (id is
122 @e rect is in screen coordinates.
124 virtual wxAccStatus
GetLocation(wxRect
& rect
, int elementId
);
127 Gets the name of the specified object.
129 virtual wxAccStatus
GetName(int childId
, wxString
* name
);
132 Returns the parent of this object, or @NULL.
134 virtual wxAccStatus
GetParent(wxAccessible
** parent
);
137 Returns a role constant describing this object. See wxAccessible for a list
140 virtual wxAccStatus
GetRole(int childId
, wxAccRole
* role
);
143 Gets a variant representing the selected children
146 Acceptable values are:
148 a null variant (IsNull() returns TRUE)
149 a list variant (GetType() == wxT("list"))
150 an integer representing the selected child element,
151 or 0 if this object is selected (GetType() == wxT("long"))
152 a "void*" pointer to a wxAccessible child object
154 virtual wxAccStatus
GetSelections(wxVariant
* selections
);
157 Returns a state constant. See wxAccessible for a list
160 virtual wxAccStatus
GetState(int childId
, long* state
);
163 Returns a localized string representing the value for the object
166 virtual wxAccStatus
GetValue(int childId
, wxString
* strValue
);
169 Returns the window associated with this object.
171 wxWindow
* GetWindow();
174 Returns a status value and object id to indicate whether the given point was on
176 a child object. Can return either a child object, or an integer
177 representing the child element, starting from 1.
179 @e pt is in screen coordinates.
181 virtual wxAccStatus
HitTest(const wxPoint
& pt
, int* childId
,
182 wxAccessible
** childObject
);
185 Navigates from @e fromId to @e toId/@e toObject.
187 virtual wxAccStatus
Navigate(wxNavDir navDir
, int fromId
,
189 wxAccessible
** toObject
);
192 Allows the application to send an event when something changes in an accessible
195 virtual static void NotifyEvent(int eventType
, wxWindow
* window
,
196 wxAccObject objectType
,
200 Selects the object or child. See wxAccessible for a list
201 of the selection actions.
203 virtual wxAccStatus
Select(int childId
,
204 wxAccSelectionFlags selectFlags
);
207 Sets the window associated with this object.
209 void SetWindow(wxWindow
* window
);