]> git.saurik.com Git - wxWidgets.git/blame - include/wx/access.h
adding an autorelease capability (got weird crashes when deleting tools from a toolba...
[wxWidgets.git] / include / wx / access.h
CommitLineData
45a959a3
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/access.h
3// Purpose: Accessibility classes
4// Author: Julian Smart
5// Modified by:
6// Created: 2003-02-12
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
45a959a3
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_ACCESSBASE_H_
13#define _WX_ACCESSBASE_H_
14
45a959a3
JS
15// ----------------------------------------------------------------------------
16// headers we have to include here
17// ----------------------------------------------------------------------------
18
07b6378f
WS
19#include "wx/defs.h"
20
c2eb1bc3
VZ
21#if wxUSE_ACCESSIBILITY
22
45a959a3
JS
23#include "wx/variant.h"
24
25typedef enum
26{
27 wxACC_FAIL,
c6e2af45 28 wxACC_FALSE,
45a959a3
JS
29 wxACC_OK,
30 wxACC_NOT_IMPLEMENTED,
31 wxACC_NOT_SUPPORTED
32} wxAccStatus;
33
34// Child ids are integer identifiers from 1 up.
35// So zero represents 'this' object.
36#define wxACC_SELF 0
37
38// Navigation constants
39
40typedef enum
41{
42 wxNAVDIR_DOWN,
45a959a3 43 wxNAVDIR_FIRSTCHILD,
45a959a3 44 wxNAVDIR_LASTCHILD,
45a959a3 45 wxNAVDIR_LEFT,
45a959a3 46 wxNAVDIR_NEXT,
45a959a3 47 wxNAVDIR_PREVIOUS,
45a959a3 48 wxNAVDIR_RIGHT,
45a959a3 49 wxNAVDIR_UP
45a959a3
JS
50} wxNavDir;
51
52// Role constants
53
4629016d 54typedef enum {
45a959a3 55 wxROLE_NONE,
45a959a3 56 wxROLE_SYSTEM_ALERT,
45a959a3 57 wxROLE_SYSTEM_ANIMATION,
45a959a3 58 wxROLE_SYSTEM_APPLICATION,
45a959a3 59 wxROLE_SYSTEM_BORDER,
45a959a3 60 wxROLE_SYSTEM_BUTTONDROPDOWN,
45a959a3 61 wxROLE_SYSTEM_BUTTONDROPDOWNGRID,
45a959a3 62 wxROLE_SYSTEM_BUTTONMENU,
45a959a3 63 wxROLE_SYSTEM_CARET,
45a959a3 64 wxROLE_SYSTEM_CELL,
45a959a3 65 wxROLE_SYSTEM_CHARACTER,
45a959a3 66 wxROLE_SYSTEM_CHART,
45a959a3 67 wxROLE_SYSTEM_CHECKBUTTON,
45a959a3 68 wxROLE_SYSTEM_CLIENT,
45a959a3 69 wxROLE_SYSTEM_CLOCK,
45a959a3 70 wxROLE_SYSTEM_COLUMN,
45a959a3 71 wxROLE_SYSTEM_COLUMNHEADER,
45a959a3 72 wxROLE_SYSTEM_COMBOBOX,
45a959a3 73 wxROLE_SYSTEM_CURSOR,
45a959a3 74 wxROLE_SYSTEM_DIAGRAM,
45a959a3 75 wxROLE_SYSTEM_DIAL,
45a959a3 76 wxROLE_SYSTEM_DIALOG,
45a959a3 77 wxROLE_SYSTEM_DOCUMENT,
45a959a3 78 wxROLE_SYSTEM_DROPLIST,
45a959a3 79 wxROLE_SYSTEM_EQUATION,
45a959a3 80 wxROLE_SYSTEM_GRAPHIC,
45a959a3 81 wxROLE_SYSTEM_GRIP,
45a959a3 82 wxROLE_SYSTEM_GROUPING,
45a959a3 83 wxROLE_SYSTEM_HELPBALLOON,
45a959a3 84 wxROLE_SYSTEM_HOTKEYFIELD,
45a959a3 85 wxROLE_SYSTEM_INDICATOR,
45a959a3 86 wxROLE_SYSTEM_LINK,
45a959a3 87 wxROLE_SYSTEM_LIST,
45a959a3 88 wxROLE_SYSTEM_LISTITEM,
45a959a3 89 wxROLE_SYSTEM_MENUBAR,
45a959a3 90 wxROLE_SYSTEM_MENUITEM,
45a959a3 91 wxROLE_SYSTEM_MENUPOPUP,
45a959a3 92 wxROLE_SYSTEM_OUTLINE,
45a959a3 93 wxROLE_SYSTEM_OUTLINEITEM,
45a959a3 94 wxROLE_SYSTEM_PAGETAB,
45a959a3 95 wxROLE_SYSTEM_PAGETABLIST,
45a959a3 96 wxROLE_SYSTEM_PANE,
45a959a3 97 wxROLE_SYSTEM_PROGRESSBAR,
45a959a3 98 wxROLE_SYSTEM_PROPERTYPAGE,
45a959a3 99 wxROLE_SYSTEM_PUSHBUTTON,
45a959a3 100 wxROLE_SYSTEM_RADIOBUTTON,
45a959a3 101 wxROLE_SYSTEM_ROW,
45a959a3 102 wxROLE_SYSTEM_ROWHEADER,
45a959a3 103 wxROLE_SYSTEM_SCROLLBAR,
45a959a3 104 wxROLE_SYSTEM_SEPARATOR,
45a959a3 105 wxROLE_SYSTEM_SLIDER,
45a959a3 106 wxROLE_SYSTEM_SOUND,
45a959a3 107 wxROLE_SYSTEM_SPINBUTTON,
45a959a3 108 wxROLE_SYSTEM_STATICTEXT,
45a959a3 109 wxROLE_SYSTEM_STATUSBAR,
45a959a3 110 wxROLE_SYSTEM_TABLE,
45a959a3 111 wxROLE_SYSTEM_TEXT,
45a959a3 112 wxROLE_SYSTEM_TITLEBAR,
45a959a3 113 wxROLE_SYSTEM_TOOLBAR,
45a959a3 114 wxROLE_SYSTEM_TOOLTIP,
45a959a3 115 wxROLE_SYSTEM_WHITESPACE,
45a959a3 116 wxROLE_SYSTEM_WINDOW
45a959a3
JS
117} wxAccRole;
118
371a5b4e
JS
119// Object types
120
121typedef enum {
122 wxOBJID_WINDOW = 0x00000000,
123 wxOBJID_SYSMENU = 0xFFFFFFFF,
124 wxOBJID_TITLEBAR = 0xFFFFFFFE,
125 wxOBJID_MENU = 0xFFFFFFFD,
126 wxOBJID_CLIENT = 0xFFFFFFFC,
127 wxOBJID_VSCROLL = 0xFFFFFFFB,
128 wxOBJID_HSCROLL = 0xFFFFFFFA,
129 wxOBJID_SIZEGRIP = 0xFFFFFFF9,
130 wxOBJID_CARET = 0xFFFFFFF8,
131 wxOBJID_CURSOR = 0xFFFFFFF7,
132 wxOBJID_ALERT = 0xFFFFFFF6,
133 wxOBJID_SOUND = 0xFFFFFFF5
134} wxAccObject;
45a959a3 135
371a5b4e 136// Accessible states
45a959a3 137
371a5b4e 138#define wxACC_STATE_SYSTEM_ALERT_HIGH 0x00000001
45a959a3 139#define wxACC_STATE_SYSTEM_ALERT_MEDIUM 0x00000002
45a959a3 140#define wxACC_STATE_SYSTEM_ALERT_LOW 0x00000004
45a959a3 141#define wxACC_STATE_SYSTEM_ANIMATED 0x00000008
45a959a3 142#define wxACC_STATE_SYSTEM_BUSY 0x00000010
45a959a3 143#define wxACC_STATE_SYSTEM_CHECKED 0x00000020
45a959a3 144#define wxACC_STATE_SYSTEM_COLLAPSED 0x00000040
45a959a3 145#define wxACC_STATE_SYSTEM_DEFAULT 0x00000080
45a959a3 146#define wxACC_STATE_SYSTEM_EXPANDED 0x00000100
45a959a3 147#define wxACC_STATE_SYSTEM_EXTSELECTABLE 0x00000200
45a959a3 148#define wxACC_STATE_SYSTEM_FLOATING 0x00000400
45a959a3 149#define wxACC_STATE_SYSTEM_FOCUSABLE 0x00000800
45a959a3 150#define wxACC_STATE_SYSTEM_FOCUSED 0x00001000
45a959a3 151#define wxACC_STATE_SYSTEM_HOTTRACKED 0x00002000
45a959a3 152#define wxACC_STATE_SYSTEM_INVISIBLE 0x00004000
45a959a3 153#define wxACC_STATE_SYSTEM_MARQUEED 0x00008000
45a959a3 154#define wxACC_STATE_SYSTEM_MIXED 0x00010000
45a959a3 155#define wxACC_STATE_SYSTEM_MULTISELECTABLE 0x00020000
45a959a3 156#define wxACC_STATE_SYSTEM_OFFSCREEN 0x00040000
45a959a3 157#define wxACC_STATE_SYSTEM_PRESSED 0x00080000
45a959a3 158#define wxACC_STATE_SYSTEM_PROTECTED 0x00100000
45a959a3 159#define wxACC_STATE_SYSTEM_READONLY 0x00200000
45a959a3 160#define wxACC_STATE_SYSTEM_SELECTABLE 0x00400000
45a959a3 161#define wxACC_STATE_SYSTEM_SELECTED 0x00800000
45a959a3 162#define wxACC_STATE_SYSTEM_SELFVOICING 0x01000000
45a959a3 163#define wxACC_STATE_SYSTEM_UNAVAILABLE 0x02000000
45a959a3
JS
164
165// Selection flag
166
167typedef enum
168{
169 wxACC_SEL_NONE = 0,
170 wxACC_SEL_TAKEFOCUS = 1,
171 wxACC_SEL_TAKESELECTION = 2,
172 wxACC_SEL_EXTENDSELECTION = 4,
173 wxACC_SEL_ADDSELECTION = 8,
174 wxACC_SEL_REMOVESELECTION = 16
175} wxAccSelectionFlags;
176
371a5b4e
JS
177// Accessibility event identifiers
178
179#define wxACC_EVENT_SYSTEM_SOUND 0x0001
180#define wxACC_EVENT_SYSTEM_ALERT 0x0002
181#define wxACC_EVENT_SYSTEM_FOREGROUND 0x0003
182#define wxACC_EVENT_SYSTEM_MENUSTART 0x0004
183#define wxACC_EVENT_SYSTEM_MENUEND 0x0005
184#define wxACC_EVENT_SYSTEM_MENUPOPUPSTART 0x0006
185#define wxACC_EVENT_SYSTEM_MENUPOPUPEND 0x0007
186#define wxACC_EVENT_SYSTEM_CAPTURESTART 0x0008
187#define wxACC_EVENT_SYSTEM_CAPTUREEND 0x0009
188#define wxACC_EVENT_SYSTEM_MOVESIZESTART 0x000A
189#define wxACC_EVENT_SYSTEM_MOVESIZEEND 0x000B
190#define wxACC_EVENT_SYSTEM_CONTEXTHELPSTART 0x000C
191#define wxACC_EVENT_SYSTEM_CONTEXTHELPEND 0x000D
192#define wxACC_EVENT_SYSTEM_DRAGDROPSTART 0x000E
193#define wxACC_EVENT_SYSTEM_DRAGDROPEND 0x000F
194#define wxACC_EVENT_SYSTEM_DIALOGSTART 0x0010
195#define wxACC_EVENT_SYSTEM_DIALOGEND 0x0011
196#define wxACC_EVENT_SYSTEM_SCROLLINGSTART 0x0012
197#define wxACC_EVENT_SYSTEM_SCROLLINGEND 0x0013
198#define wxACC_EVENT_SYSTEM_SWITCHSTART 0x0014
199#define wxACC_EVENT_SYSTEM_SWITCHEND 0x0015
200#define wxACC_EVENT_SYSTEM_MINIMIZESTART 0x0016
201#define wxACC_EVENT_SYSTEM_MINIMIZEEND 0x0017
202#define wxACC_EVENT_OBJECT_CREATE 0x8000
203#define wxACC_EVENT_OBJECT_DESTROY 0x8001
204#define wxACC_EVENT_OBJECT_SHOW 0x8002
205#define wxACC_EVENT_OBJECT_HIDE 0x8003
206#define wxACC_EVENT_OBJECT_REORDER 0x8004
207#define wxACC_EVENT_OBJECT_FOCUS 0x8005
208#define wxACC_EVENT_OBJECT_SELECTION 0x8006
209#define wxACC_EVENT_OBJECT_SELECTIONADD 0x8007
210#define wxACC_EVENT_OBJECT_SELECTIONREMOVE 0x8008
211#define wxACC_EVENT_OBJECT_SELECTIONWITHIN 0x8009
212#define wxACC_EVENT_OBJECT_STATECHANGE 0x800A
213#define wxACC_EVENT_OBJECT_LOCATIONCHANGE 0x800B
214#define wxACC_EVENT_OBJECT_NAMECHANGE 0x800C
215#define wxACC_EVENT_OBJECT_DESCRIPTIONCHANGE 0x800D
216#define wxACC_EVENT_OBJECT_VALUECHANGE 0x800E
217#define wxACC_EVENT_OBJECT_PARENTCHANGE 0x800F
218#define wxACC_EVENT_OBJECT_HELPCHANGE 0x8010
219#define wxACC_EVENT_OBJECT_DEFACTIONCHANGE 0x8011
220#define wxACC_EVENT_OBJECT_ACCELERATORCHANGE 0x8012
221
45a959a3
JS
222// ----------------------------------------------------------------------------
223// wxAccessible
224// All functions return an indication of success, failure, or not implemented.
225// ----------------------------------------------------------------------------
226
227class WXDLLEXPORT wxAccessible;
bef8d481
MB
228class WXDLLEXPORT wxWindow;
229class WXDLLEXPORT wxPoint;
230class WXDLLEXPORT wxRect;
45a959a3
JS
231class WXDLLEXPORT wxAccessibleBase : public wxObject
232{
233 DECLARE_NO_COPY_CLASS(wxAccessibleBase)
234
235public:
6fb99eb3
WS
236 wxAccessibleBase(wxWindow* win): m_window(win) {}
237 virtual ~wxAccessibleBase() {}
45a959a3
JS
238
239// Overridables
240
241 // Can return either a child object, or an integer
242 // representing the child element, starting from 1.
a37e4a07 243 // pt is in screen coordinates.
45a959a3
JS
244 virtual wxAccStatus HitTest(const wxPoint& WXUNUSED(pt), int* WXUNUSED(childId), wxAccessible** WXUNUSED(childObject))
245 { return wxACC_NOT_IMPLEMENTED; }
246
247 // Returns the rectangle for this object (id = 0) or a child element (id > 0).
a37e4a07 248 // rect is in screen coordinates.
45a959a3
JS
249 virtual wxAccStatus GetLocation(wxRect& WXUNUSED(rect), int WXUNUSED(elementId))
250 { return wxACC_NOT_IMPLEMENTED; }
251
252 // Navigates from fromId to toId/toObject.
253 virtual wxAccStatus Navigate(wxNavDir WXUNUSED(navDir), int WXUNUSED(fromId),
254 int* WXUNUSED(toId), wxAccessible** WXUNUSED(toObject))
255 { return wxACC_NOT_IMPLEMENTED; }
256
257 // Gets the name of the specified object.
258 virtual wxAccStatus GetName(int WXUNUSED(childId), wxString* WXUNUSED(name))
259 { return wxACC_NOT_IMPLEMENTED; }
260
261 // Gets the number of children.
a37e4a07 262 virtual wxAccStatus GetChildCount(int* WXUNUSED(childCount))
45a959a3
JS
263 { return wxACC_NOT_IMPLEMENTED; }
264
265 // Gets the specified child (starting from 1).
266 // If *child is NULL and return value is wxACC_OK,
267 // this means that the child is a simple element and
268 // not an accessible object.
269 virtual wxAccStatus GetChild(int WXUNUSED(childId), wxAccessible** WXUNUSED(child))
270 { return wxACC_NOT_IMPLEMENTED; }
271
272 // Gets the parent, or NULL.
273 virtual wxAccStatus GetParent(wxAccessible** WXUNUSED(parent))
274 { return wxACC_NOT_IMPLEMENTED; }
275
276 // Performs the default action. childId is 0 (the action for this object)
277 // or > 0 (the action for a child).
278 // Return wxACC_NOT_SUPPORTED if there is no default action for this
279 // window (e.g. an edit control).
280 virtual wxAccStatus DoDefaultAction(int WXUNUSED(childId))
281 { return wxACC_NOT_IMPLEMENTED; }
282
283 // Gets the default action for this object (0) or > 0 (the action for a child).
284 // Return wxACC_OK even if there is no action. actionName is the action, or the empty
285 // string if there is no action.
286 // The retrieved string describes the action that is performed on an object,
287 // not what the object does as a result. For example, a toolbar button that prints
288 // a document has a default action of "Press" rather than "Prints the current document."
289 virtual wxAccStatus GetDefaultAction(int WXUNUSED(childId), wxString* WXUNUSED(actionName))
290 { return wxACC_NOT_IMPLEMENTED; }
291
292 // Returns the description for this object or a child.
293 virtual wxAccStatus GetDescription(int WXUNUSED(childId), wxString* WXUNUSED(description))
294 { return wxACC_NOT_IMPLEMENTED; }
295
296 // Returns help text for this object or a child, similar to tooltip text.
297 virtual wxAccStatus GetHelpText(int WXUNUSED(childId), wxString* WXUNUSED(helpText))
298 { return wxACC_NOT_IMPLEMENTED; }
299
300 // Returns the keyboard shortcut for this object or child.
301 // Return e.g. ALT+K
302 virtual wxAccStatus GetKeyboardShortcut(int WXUNUSED(childId), wxString* WXUNUSED(shortcut))
303 { return wxACC_NOT_IMPLEMENTED; }
304
305 // Returns a role constant.
306 virtual wxAccStatus GetRole(int WXUNUSED(childId), wxAccRole* WXUNUSED(role))
307 { return wxACC_NOT_IMPLEMENTED; }
308
309 // Returns a state constant.
310 virtual wxAccStatus GetState(int WXUNUSED(childId), long* WXUNUSED(state))
311 { return wxACC_NOT_IMPLEMENTED; }
312
313 // Returns a localized string representing the value for the object
314 // or child.
315 virtual wxAccStatus GetValue(int WXUNUSED(childId), wxString* WXUNUSED(strValue))
316 { return wxACC_NOT_IMPLEMENTED; }
317
318 // Selects the object or child.
319 virtual wxAccStatus Select(int WXUNUSED(childId), wxAccSelectionFlags WXUNUSED(selectFlags))
320 { return wxACC_NOT_IMPLEMENTED; }
321
322 // Gets the window with the keyboard focus.
323 // If childId is 0 and child is NULL, no object in
324 // this subhierarchy has the focus.
325 // If this object has the focus, child should be 'this'.
326 virtual wxAccStatus GetFocus(int* WXUNUSED(childId), wxAccessible** WXUNUSED(child))
327 { return wxACC_NOT_IMPLEMENTED; }
328
ca5c6ac3 329#if wxUSE_VARIANT
45a959a3
JS
330 // Gets a variant representing the selected children
331 // of this object.
332 // Acceptable values:
333 // - a null variant (IsNull() returns TRUE)
334 // - a list variant (GetType() == wxT("list"))
335 // - an integer representing the selected child element,
336 // or 0 if this object is selected (GetType() == wxT("long"))
337 // - a "void*" pointer to a wxAccessible child object
338 virtual wxAccStatus GetSelections(wxVariant* WXUNUSED(selections))
339 { return wxACC_NOT_IMPLEMENTED; }
ca5c6ac3 340#endif // wxUSE_VARIANT
45a959a3
JS
341
342// Accessors
343
344 // Returns the window associated with this object.
345
346 wxWindow* GetWindow() { return m_window; }
347
348 // Sets the window associated with this object.
349
350 void SetWindow(wxWindow* window) { m_window = window; }
351
371a5b4e
JS
352// Operations
353
e00a5d3c 354 // Each platform's implementation must define this
371a5b4e
JS
355 // static void NotifyEvent(int eventType, wxWindow* window, wxAccObject objectType,
356 // int objectId);
357
45a959a3
JS
358private:
359
360// Data members
361
362 wxWindow* m_window;
363};
364
365
45a959a3
JS
366// ----------------------------------------------------------------------------
367// now include the declaration of the real class
368// ----------------------------------------------------------------------------
369
370#if defined(__WXMSW__)
371 #include "wx/msw/ole/access.h"
45a959a3
JS
372#endif
373
c2eb1bc3
VZ
374#endif // wxUSE_ACCESSIBILITY
375
376#endif // _WX_ACCESSBASE_H_
377