access.h 14 KB

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