1
0

accessible.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. #ifndef __ACCESSIBLE_H
  2. #define __ACCESSIBLE_H
  3. #include <bfc/common.h>
  4. // Message sent to the OS window in order to retrieve an accessibility interface
  5. #define WM_GETOBJECT 0x003D
  6. // undef some stuff we're gonna #define ourselves
  7. #ifdef OBJID_WINDOW
  8. #undef OBJID_WINDOW
  9. #endif
  10. #ifdef OBJID_SYSMENU
  11. #undef OBJID_SYSMENU
  12. #endif
  13. #ifdef OBJID_TITLEBAR
  14. #undef OBJID_TITLEBAR
  15. #endif
  16. #ifdef OBJID_MENU
  17. #undef OBJID_MENU
  18. #endif
  19. #ifdef OBJID_CLIENT
  20. #undef OBJID_CLIENT
  21. #endif
  22. #ifdef OBJID_VSCROLL
  23. #undef OBJID_VSCROLL
  24. #endif
  25. #ifdef OBJID_HSCROLL
  26. #undef OBJID_HSCROLL
  27. #endif
  28. #ifdef OBJID_SIZEGRIP
  29. #undef OBJID_SIZEGRIP
  30. #endif
  31. #ifdef OBJID_CARET
  32. #undef OBJID_CARET
  33. #endif
  34. #ifdef OBJID_CURSOR
  35. #undef OBJID_CURSOR
  36. #endif
  37. #ifdef OBJID_ALERT
  38. #undef OBJID_ALERT
  39. #endif
  40. #ifdef OBJID_SOUND
  41. #undef OBJID_SOUND
  42. #endif
  43. #ifdef STATE_SYSTEM_VALID
  44. #undef STATE_SYSTEM_VALID
  45. #endif // STATE_SYSTEM_VALID
  46. // Accessibility system object IDs
  47. #define OBJID_WINDOW 0x00000000
  48. #define OBJID_SYSMENU 0xFFFFFFFF
  49. #define OBJID_TITLEBAR 0xFFFFFFFE
  50. #define OBJID_MENU 0xFFFFFFFD
  51. #define OBJID_CLIENT 0xFFFFFFFC
  52. #define OBJID_VSCROLL 0xFFFFFFFB
  53. #define OBJID_HSCROLL 0xFFFFFFFA
  54. #define OBJID_SIZEGRIP 0xFFFFFFF9
  55. #define OBJID_CARET 0xFFFFFFF8
  56. #define OBJID_CURSOR 0xFFFFFFF7
  57. #define OBJID_ALERT 0xFFFFFFF6
  58. #define OBJID_SOUND 0xFFFFFFF5
  59. #if 0
  60. #define ROLE_SYSTEM_TITLEBAR 0x00000001
  61. #define ROLE_SYSTEM_MENUBAR 0x00000002
  62. #define ROLE_SYSTEM_SCROLLBAR 0x00000003
  63. #define ROLE_SYSTEM_GRIP 0x00000004
  64. #define ROLE_SYSTEM_SOUND 0x00000005
  65. #define ROLE_SYSTEM_CURSOR 0x00000006
  66. #define ROLE_SYSTEM_CARET 0x00000007
  67. #define ROLE_SYSTEM_ALERT 0x00000008
  68. #define ROLE_SYSTEM_WINDOW 0x00000009
  69. #define ROLE_SYSTEM_CLIENT 0x0000000A
  70. #define ROLE_SYSTEM_MENUPOPUP 0x0000000B
  71. #define ROLE_SYSTEM_MENUITEM 0x0000000C
  72. #define ROLE_SYSTEM_TOOLTIP 0x0000000D
  73. #define ROLE_SYSTEM_APPLICATION 0x0000000E
  74. #define ROLE_SYSTEM_DOCUMENT 0x0000000F
  75. #define ROLE_SYSTEM_PANE 0x00000010
  76. #define ROLE_SYSTEM_CHART 0x00000011
  77. #define ROLE_SYSTEM_DIALOG 0x00000012
  78. #define ROLE_SYSTEM_BORDER 0x00000013
  79. #define ROLE_SYSTEM_GROUPING 0x00000014
  80. #define ROLE_SYSTEM_SEPARATOR 0x00000015
  81. #define ROLE_SYSTEM_TOOLBAR 0x00000016
  82. #define ROLE_SYSTEM_STATUSBAR 0x00000017
  83. #define ROLE_SYSTEM_TABLE 0x00000018
  84. #define ROLE_SYSTEM_COLUMNHEADER 0x00000019
  85. #define ROLE_SYSTEM_ROWHEADER 0x0000001A
  86. #define ROLE_SYSTEM_COLUMN 0x0000001B
  87. #define ROLE_SYSTEM_ROW 0x0000001C
  88. #define ROLE_SYSTEM_CELL 0x0000001D
  89. #define ROLE_SYSTEM_LINK 0x0000001E
  90. #define ROLE_SYSTEM_HELPBALLOON 0x0000001F
  91. #define ROLE_SYSTEM_CHARACTER 0x00000020
  92. #define ROLE_SYSTEM_LIST 0x00000021
  93. #define ROLE_SYSTEM_LISTITEM 0x00000022
  94. #define ROLE_SYSTEM_OUTLINE 0x00000023
  95. #define ROLE_SYSTEM_OUTLINEITEM 0x00000024
  96. #define ROLE_SYSTEM_PAGETAB 0x00000025
  97. #define ROLE_SYSTEM_PROPERTYPAGE 0x00000026
  98. #define ROLE_SYSTEM_INDICATOR 0x00000027
  99. #define ROLE_SYSTEM_GRAPHIC 0x00000028
  100. #define ROLE_SYSTEM_STATICTEXT 0x00000029
  101. #define ROLE_SYSTEM_TEXT 0x0000002A // Editable, selectable, etc.
  102. #define ROLE_SYSTEM_PUSHBUTTON 0x0000002B
  103. #define ROLE_SYSTEM_CHECKBUTTON 0x0000002C
  104. #define ROLE_SYSTEM_RADIOBUTTON 0x0000002D
  105. #define ROLE_SYSTEM_COMBOBOX 0x0000002E
  106. #define ROLE_SYSTEM_DROPLIST 0x0000002F
  107. #define ROLE_SYSTEM_PROGRESSBAR 0x00000030
  108. #define ROLE_SYSTEM_DIAL 0x00000031
  109. #define ROLE_SYSTEM_HOTKEYFIELD 0x00000032
  110. #define ROLE_SYSTEM_SLIDER 0x00000033
  111. #define ROLE_SYSTEM_SPINBUTTON 0x00000034
  112. #define ROLE_SYSTEM_DIAGRAM 0x00000035
  113. #define ROLE_SYSTEM_ANIMATION 0x00000036
  114. #define ROLE_SYSTEM_EQUATION 0x00000037
  115. #define ROLE_SYSTEM_BUTTONDROPDOWN 0x00000038
  116. #define ROLE_SYSTEM_BUTTONMENU 0x00000039
  117. #define ROLE_SYSTEM_BUTTONDROPDOWNGRID 0x0000003A
  118. #define ROLE_SYSTEM_WHITESPACE 0x0000003B
  119. #define ROLE_SYSTEM_PAGETABLIST 0x0000003C
  120. #define ROLE_SYSTEM_CLOCK 0x0000003D
  121. #endif
  122. #define STATE_SYSTEM_UNAVAILABLE 0x00000001 // Disabled
  123. #define STATE_SYSTEM_SELECTED 0x00000002
  124. #define STATE_SYSTEM_FOCUSED 0x00000004
  125. #define STATE_SYSTEM_PRESSED 0x00000008
  126. #define STATE_SYSTEM_CHECKED 0x00000010
  127. #define STATE_SYSTEM_MIXED 0x00000020 // 3-state checkbox or toolbar button
  128. #define STATE_SYSTEM_READONLY 0x00000040
  129. #define STATE_SYSTEM_HOTTRACKED 0x00000080
  130. #define STATE_SYSTEM_DEFAULT 0x00000100
  131. #define STATE_SYSTEM_EXPANDED 0x00000200
  132. #define STATE_SYSTEM_COLLAPSED 0x00000400
  133. #define STATE_SYSTEM_BUSY 0x00000800
  134. #define STATE_SYSTEM_FLOATING 0x00001000 // Children "owned" not "contained" by parent
  135. #define STATE_SYSTEM_MARQUEED 0x00002000
  136. #define STATE_SYSTEM_ANIMATED 0x00004000
  137. #define STATE_SYSTEM_INVISIBLE 0x00008000
  138. #define STATE_SYSTEM_OFFSCREEN 0x00010000
  139. #define STATE_SYSTEM_SIZEABLE 0x00020000
  140. #define STATE_SYSTEM_MOVEABLE 0x00040000
  141. #define STATE_SYSTEM_SELFVOICING 0x00080000
  142. #define STATE_SYSTEM_FOCUSABLE 0x00100000
  143. #define STATE_SYSTEM_SELECTABLE 0x00200000
  144. #define STATE_SYSTEM_LINKED 0x00400000
  145. #define STATE_SYSTEM_TRAVERSED 0x00800000
  146. #define STATE_SYSTEM_MULTISELECTABLE 0x01000000 // Supports multiple selection
  147. #define STATE_SYSTEM_EXTSELECTABLE 0x02000000 // Supports extended selection
  148. #define STATE_SYSTEM_ALERT_LOW 0x04000000 // This information is of low priority
  149. #define STATE_SYSTEM_ALERT_MEDIUM 0x08000000 // This information is of medium priority
  150. #define STATE_SYSTEM_ALERT_HIGH 0x10000000 // This information is of high priority
  151. #define STATE_SYSTEM_VALID 0x1FFFFFFF
  152. /*
  153. * Reserved IDs for system objects
  154. */
  155. #define OBJID_WINDOW 0x00000000
  156. #define OBJID_SYSMENU 0xFFFFFFFF
  157. #define OBJID_TITLEBAR 0xFFFFFFFE
  158. #define OBJID_MENU 0xFFFFFFFD
  159. #define OBJID_CLIENT 0xFFFFFFFC
  160. #define OBJID_VSCROLL 0xFFFFFFFB
  161. #define OBJID_HSCROLL 0xFFFFFFFA
  162. #define OBJID_SIZEGRIP 0xFFFFFFF9
  163. #define OBJID_CARET 0xFFFFFFF8
  164. #define OBJID_CURSOR 0xFFFFFFF7
  165. #define OBJID_ALERT 0xFFFFFFF6
  166. #define OBJID_SOUND 0xFFFFFFF5
  167. /*
  168. * EVENT DEFINITION
  169. */
  170. #define EVENT_MIN 0x00000001
  171. #define EVENT_MAX 0x7FFFFFFF
  172. /*
  173. * EVENT_SYSTEM_SOUND
  174. * Sent when a sound is played. Currently nothing is generating this, we
  175. * this event when a system sound (for menus, etc) is played. Apps
  176. * generate this, if accessible, when a private sound is played. For
  177. * example, if Mail plays a "New Mail" sound.
  178. *
  179. * System Sounds:
  180. * (Generated by PlaySoundEvent in USER itself)
  181. * hwnd is NULL
  182. * idObject is OBJID_SOUND
  183. * idChild is sound child ID if one
  184. * App Sounds:
  185. * (PlaySoundEvent won't generate notification; up to app)
  186. * hwnd + idObject gets interface pointer to Sound object
  187. * idChild identifies the sound in question
  188. * are going to be cleaning up the SOUNDSENTRY feature in the control panel
  189. * and will use this at that time. Applications implementing WinEvents
  190. * are perfectly welcome to use it. Clients of IAccessible* will simply
  191. * turn around and get back a non-visual object that describes the sound.
  192. */
  193. #define EVENT_SYSTEM_SOUND 0x0001
  194. /*
  195. * EVENT_SYSTEM_ALERT
  196. * System Alerts:
  197. * (Generated by MessageBox() calls for example)
  198. * hwnd is hwndMessageBox
  199. * idObject is OBJID_ALERT
  200. * App Alerts:
  201. * (Generated whenever)
  202. * hwnd+idObject gets interface pointer to Alert
  203. */
  204. #define EVENT_SYSTEM_ALERT 0x0002
  205. /*
  206. * EVENT_SYSTEM_FOREGROUND
  207. * Sent when the foreground (active) window changes, even if it is changing
  208. * to another window in the same thread as the previous one.
  209. * hwnd is hwndNewForeground
  210. * idObject is OBJID_WINDOW
  211. * idChild is INDEXID_OBJECT
  212. */
  213. #define EVENT_SYSTEM_FOREGROUND 0x0003
  214. /*
  215. * Menu
  216. * hwnd is window (top level window or popup menu window)
  217. * idObject is ID of control (OBJID_MENU, OBJID_SYSMENU, OBJID_SELF for popup)
  218. * idChild is CHILDID_SELF
  219. *
  220. * EVENT_SYSTEM_MENUSTART
  221. * EVENT_SYSTEM_MENUEND
  222. * For MENUSTART, hwnd+idObject+idChild refers to the control with the menu bar,
  223. * or the control bringing up the context menu.
  224. *
  225. * Sent when entering into and leaving from menu mode (system, app bar, and
  226. * track popups).
  227. */
  228. #define EVENT_SYSTEM_MENUSTART 0x0004
  229. #define EVENT_SYSTEM_MENUEND 0x0005
  230. /*
  231. * EVENT_SYSTEM_MENUPOPUPSTART
  232. * EVENT_SYSTEM_MENUPOPUPEND
  233. * Sent when a menu popup comes up and just before it is taken down. Note
  234. * that for a call to TrackPopupMenu(), a client will see EVENT_SYSTEM_MENUSTART
  235. * followed almost immediately by EVENT_SYSTEM_MENUPOPUPSTART for the popup
  236. * being shown.
  237. *
  238. * For MENUPOPUP, hwnd+idObject+idChild refers to the NEW popup coming up, not the
  239. * parent item which is hierarchical. You can get the parent menu/popup by
  240. * asking for the accParent object.
  241. */
  242. #define EVENT_SYSTEM_MENUPOPUPSTART 0x0006
  243. #define EVENT_SYSTEM_MENUPOPUPEND 0x0007
  244. /*
  245. * EVENT_SYSTEM_CAPTURESTART
  246. * EVENT_SYSTEM_CAPTUREEND
  247. * Sent when a window takes the capture and releases the capture.
  248. */
  249. #define EVENT_SYSTEM_CAPTURESTART 0x0008
  250. #define EVENT_SYSTEM_CAPTUREEND 0x0009
  251. /*
  252. * Move Size
  253. * EVENT_SYSTEM_MOVESIZESTART
  254. * EVENT_SYSTEM_MOVESIZEEND
  255. * Sent when a window enters and leaves move-size dragging mode.
  256. */
  257. #define EVENT_SYSTEM_MOVESIZESTART 0x000A
  258. #define EVENT_SYSTEM_MOVESIZEEND 0x000B
  259. /*
  260. * Context Help
  261. * EVENT_SYSTEM_CONTEXTHELPSTART
  262. * EVENT_SYSTEM_CONTEXTHELPEND
  263. * Sent when a window enters and leaves context sensitive help mode.
  264. */
  265. #define EVENT_SYSTEM_CONTEXTHELPSTART 0x000C
  266. #define EVENT_SYSTEM_CONTEXTHELPEND 0x000D
  267. /*
  268. * Drag & Drop
  269. * EVENT_SYSTEM_DRAGDROPSTART
  270. * EVENT_SYSTEM_DRAGDROPEND
  271. * Send the START notification just before going into drag&drop loop. Send
  272. * the END notification just after canceling out.
  273. * Note that it is up to apps and OLE to generate this, since the system
  274. * doesn't know. Like EVENT_SYSTEM_SOUND, it will be a while before this
  275. * is prevalent.
  276. */
  277. #define EVENT_SYSTEM_DRAGDROPSTART 0x000E
  278. #define EVENT_SYSTEM_DRAGDROPEND 0x000F
  279. /*
  280. * Dialog
  281. * Send the START notification right after the dialog is completely
  282. * initialized and visible. Send the END right before the dialog
  283. * is hidden and goes away.
  284. * EVENT_SYSTEM_DIALOGSTART
  285. * EVENT_SYSTEM_DIALOGEND
  286. */
  287. #define EVENT_SYSTEM_DIALOGSTART 0x0010
  288. #define EVENT_SYSTEM_DIALOGEND 0x0011
  289. /*
  290. * EVENT_SYSTEM_SCROLLING
  291. * EVENT_SYSTEM_SCROLLINGSTART
  292. * EVENT_SYSTEM_SCROLLINGEND
  293. * Sent when beginning and ending the tracking of a scrollbar in a window,
  294. * and also for scrollbar controls.
  295. */
  296. #define EVENT_SYSTEM_SCROLLINGSTART 0x0012
  297. #define EVENT_SYSTEM_SCROLLINGEND 0x0013
  298. /*
  299. * Alt-Tab Window
  300. * Send the START notification right after the switch window is initialized
  301. * and visible. Send the END right before it is hidden and goes away.
  302. * EVENT_SYSTEM_SWITCHSTART
  303. * EVENT_SYSTEM_SWITCHEND
  304. */
  305. #define EVENT_SYSTEM_SWITCHSTART 0x0014
  306. #define EVENT_SYSTEM_SWITCHEND 0x0015
  307. /*
  308. * EVENT_SYSTEM_MINIMIZESTART
  309. * EVENT_SYSTEM_MINIMIZEEND
  310. * Sent when a window minimizes and just before it restores.
  311. */
  312. #define EVENT_SYSTEM_MINIMIZESTART 0x0016
  313. #define EVENT_SYSTEM_MINIMIZEEND 0x0017
  314. /*
  315. * Object events
  316. *
  317. * The system AND apps generate these. The system generates these for
  318. * real windows. Apps generate these for objects within their window which
  319. * act like a separate control, e.g. an item in a list view.
  320. *
  321. * When the system generate them, dwParam2 is always WMOBJID_SELF. When
  322. * apps generate them, apps put the has-meaning-to-the-app-only ID value
  323. * in dwParam2.
  324. * For all events, if you want detailed accessibility information, callers
  325. * should
  326. * * Call AccessibleObjectFromWindow() with the hwnd, idObject parameters
  327. * of the event, and IID_IAccessible as the REFIID, to get back an
  328. * IAccessible* to talk to
  329. * * Initialize and fill in a VARIANT as VT_I4 with lVal the idChild
  330. * parameter of the event.
  331. * * If idChild isn't zero, call get_accChild() in the container to see
  332. * if the child is an object in its own right. If so, you will get
  333. * back an IDispatch* object for the child. You should release the
  334. * parent, and call QueryInterface() on the child object to get its
  335. * IAccessible*. Then you talk directly to the child. Otherwise,
  336. * if get_accChild() returns you nothing, you should continue to
  337. * use the child VARIANT. You will ask the container for the properties
  338. * of the child identified by the VARIANT. In other words, the
  339. * child in this case is accessible but not a full-blown object.
  340. * Like a button on a titlebar which is 'small' and has no children.
  341. */
  342. /*
  343. * For all EVENT_OBJECT events,
  344. * hwnd is the dude to Send the WM_GETOBJECT message to (unless NULL,
  345. * see above for system things)
  346. * idObject is the ID of the object that can resolve any queries a
  347. * client might have. It's a way to deal with windowless controls,
  348. * controls that are just drawn on the screen in some larger parent
  349. * window (like SDM), or standard frame elements of a window.
  350. * idChild is the piece inside of the object that is affected. This
  351. * allows clients to access things that are too small to have full
  352. * blown objects in their own right. Like the thumb of a scrollbar.
  353. * The hwnd/idObject pair gets you to the container, the dude you
  354. * probably want to talk to most of the time anyway. The idChild
  355. * can then be passed into the acc properties to get the name/value
  356. * of it as needed.
  357. *
  358. * Example #1:
  359. * System propagating a listbox selection change
  360. * EVENT_OBJECT_SELECTION
  361. * hwnd == listbox hwnd
  362. * idObject == OBJID_WINDOW
  363. * idChild == new selected item, or CHILDID_SELF if
  364. * nothing now selected within container.
  365. * Word '97 propagating a listbox selection change
  366. * hwnd == SDM window
  367. * idObject == SDM ID to get at listbox 'control'
  368. * idChild == new selected item, or CHILDID_SELF if
  369. * nothing
  370. *
  371. * Example #2:
  372. * System propagating a menu item selection on the menu bar
  373. * EVENT_OBJECT_SELECTION
  374. * hwnd == top level window
  375. * idObject == OBJID_MENU
  376. * idChild == ID of child menu bar item selected
  377. *
  378. * Example #3:
  379. * System propagating a dropdown coming off of said menu bar item
  380. * EVENT_OBJECT_CREATE
  381. * hwnd == popup item
  382. * idObject == OBJID_WINDOW
  383. * idChild == CHILDID_SELF
  384. *
  385. * Example #4:
  386. *
  387. * For EVENT_OBJECT_REORDER, the object referred to by hwnd/idObject is the
  388. * PARENT container in which the zorder is occurring. This is because if
  389. * one child is zordering, all of them are changing their relative zorder.
  390. */
  391. #define EVENT_OBJECT_CREATE 0x8000 // hwnd + ID + idChild is created item
  392. #define EVENT_OBJECT_DESTROY 0x8001 // hwnd + ID + idChild is destroyed item
  393. #define EVENT_OBJECT_SHOW 0x8002 // hwnd + ID + idChild is shown item
  394. #define EVENT_OBJECT_HIDE 0x8003 // hwnd + ID + idChild is hidden item
  395. #define EVENT_OBJECT_REORDER 0x8004 // hwnd + ID + idChild is parent of zordering children
  396. /*
  397. * NOTE:
  398. * Minimize the number of notifications!
  399. *
  400. * When you are hiding a parent object, obviously all child objects are no
  401. * longer visible on screen. They still have the same "visible" status,
  402. * but are not truly visible. Hence do not send HIDE notifications for the
  403. * children also. One implies all. The same goes for SHOW.
  404. */
  405. #define EVENT_OBJECT_FOCUS 0x8005 // hwnd + ID + idChild is focused item
  406. #define EVENT_OBJECT_SELECTION 0x8006 // hwnd + ID + idChild is selected item (if only one), or idChild is OBJID_WINDOW if complex
  407. #define EVENT_OBJECT_SELECTIONADD 0x8007 // hwnd + ID + idChild is item added
  408. #define EVENT_OBJECT_SELECTIONREMOVE 0x8008 // hwnd + ID + idChild is item removed
  409. #define EVENT_OBJECT_SELECTIONWITHIN 0x8009 // hwnd + ID + idChild is parent of changed selected items
  410. /*
  411. * NOTES:
  412. * There is only one "focused" child item in a parent. This is the place
  413. * keystrokes are going at a given moment. Hence only send a notification
  414. * about where the NEW focus is going. A NEW item getting the focus already
  415. * implies that the OLD item is losing it.
  416. *
  417. * SELECTION however can be multiple. Hence the different SELECTION
  418. * notifications. Here's when to use each:
  419. *
  420. * (1) Send a SELECTION notification in the simple single selection
  421. * case (like the focus) when the item with the selection is
  422. * merely moving to a different item within a container. hwnd + ID
  423. * is the container control, idChildItem is the new child with the
  424. * selection.
  425. *
  426. * (2) Send a SELECTIONADD notification when a new item has simply been added
  427. * to the selection within a container. This is appropriate when the
  428. * number of newly selected items is very small. hwnd + ID is the
  429. * container control, idChildItem is the new child added to the selection.
  430. *
  431. * (3) Send a SELECTIONREMOVE notification when a new item has simply been
  432. * removed from the selection within a container. This is appropriate
  433. * when the number of newly selected items is very small, just like
  434. * SELECTIONADD. hwnd + ID is the container control, idChildItem is the
  435. * new child removed from the selection.
  436. *
  437. * (4) Send a SELECTIONWITHIN notification when the selected items within a
  438. * control have changed substantially. Rather than propagate a large
  439. * number of changes to reflect removal for some items, addition of
  440. * others, just tell somebody who cares that a lot happened. It will
  441. * be faster an easier for somebody watching to just turn around and
  442. * query the container control what the new bunch of selected items
  443. * are.
  444. */
  445. #define EVENT_OBJECT_STATECHANGE 0x800A // hwnd + ID + idChild is item w/ state change
  446. /*
  447. * Examples of when to send an EVENT_OBJECT_STATECHANGE include
  448. * * It is being enabled/disabled (USER does for windows)
  449. * * It is being pressed/released (USER does for buttons)
  450. * * It is being checked/unchecked (USER does for radio/check buttons)
  451. */
  452. #define EVENT_OBJECT_LOCATIONCHANGE 0x800B // hwnd + ID + idChild is moved/sized item
  453. /*
  454. * Note:
  455. * A LOCATIONCHANGE is not sent for every child object when the parent
  456. * changes shape/moves. Send one notification for the topmost object
  457. * that is changing. For example, if the user resizes a top level window,
  458. * USER will generate a LOCATIONCHANGE for it, but not for the menu bar,
  459. * title bar, scrollbars, etc. that are also changing shape/moving.
  460. *
  461. * In other words, it only generates LOCATIONCHANGE notifications for
  462. * real windows that are moving/sizing. It will not generate a LOCATIONCHANGE
  463. * for every non-floating child window when the parent moves (the children are
  464. * logically moving also on screen, but not relative to the parent).
  465. *
  466. * Now, if the app itself resizes child windows as a result of being
  467. * sized, USER will generate LOCATIONCHANGEs for those dudes also because
  468. * it doesn't know better.
  469. *
  470. * Note also that USER will generate LOCATIONCHANGE notifications for two
  471. * non-window sys objects:
  472. * (1) System caret
  473. * (2) Cursor
  474. */
  475. #define EVENT_OBJECT_NAMECHANGE 0x800C // hwnd + ID + idChild is item w/ name change
  476. #define EVENT_OBJECT_DESCRIPTIONCHANGE 0x800D // hwnd + ID + idChild is item w/ desc change
  477. #define EVENT_OBJECT_VALUECHANGE 0x800E // hwnd + ID + idChild is item w/ value change
  478. #define EVENT_OBJECT_PARENTCHANGE 0x800F // hwnd + ID + idChild is item w/ new parent
  479. #define EVENT_OBJECT_HELPCHANGE 0x8010 // hwnd + ID + idChild is item w/ help change
  480. #define EVENT_OBJECT_DEFACTIONCHANGE 0x8011 // hwnd + ID + idChild is item w/ def action change
  481. #define EVENT_OBJECT_ACCELERATORCHANGE 0x8012 // hwnd + ID + idChild is item w/ keybd accel change
  482. #ifdef WIN32
  483. WINUSERAPI VOID WINAPI
  484. NotifyWinEvent(
  485. DWORD event,
  486. HWND hwnd,
  487. LONG idObject,
  488. LONG idChild);
  489. #endif
  490. #include <bfc/dispatch.h>
  491. struct IAccessible;
  492. class Accessible : public Dispatchable {
  493. public:
  494. IAccessible *getIAccessible();
  495. #ifdef _WIN32
  496. HRESULT getOSHandle(int p);
  497. #endif
  498. void release();
  499. void addRef();
  500. int getNumRefs();
  501. void onGetFocus(int idx=-1);
  502. void onStateChange(int idx=-1);
  503. void onSetName(const wchar_t *newname, int idx=-1);
  504. OSWINDOWHANDLE getOSWnd();
  505. int flattenContent(OSWINDOWHANDLE *w);
  506. enum {
  507. ACCESSIBLE_GETIACCESSIBLE=10,
  508. ACCESSIBLE_GETOSHANDLE=20,
  509. ACCESSIBLE_ADDREF=30,
  510. ACCESSIBLE_RELEASE=40,
  511. ACCESSIBLE_GETNUMREFS=50,
  512. ACCESSIBLE_ONGETFOCUS=60,
  513. ACCESSIBLE_ONSETNAME=70,
  514. ACCESSIBLE_GETOSWND=80,
  515. ACCESSIBLE_ONSTATECHANGE=90,
  516. ACCESSIBLE_FLATTENCONTENT=100,
  517. };
  518. };
  519. inline IAccessible *Accessible::getIAccessible() {
  520. return _call(ACCESSIBLE_GETIACCESSIBLE, (IAccessible *)NULL);
  521. }
  522. #ifdef _WIN32
  523. inline HRESULT Accessible::getOSHandle(int p) {
  524. return _call(ACCESSIBLE_GETOSHANDLE, (HRESULT)NULL, p);
  525. }
  526. #endif
  527. inline void Accessible::addRef() {
  528. _voidcall(ACCESSIBLE_ADDREF);
  529. }
  530. inline void Accessible::release() {
  531. _voidcall(ACCESSIBLE_RELEASE);
  532. }
  533. inline int Accessible::getNumRefs() {
  534. return _call(ACCESSIBLE_GETNUMREFS, 0);
  535. }
  536. inline void Accessible::onGetFocus(int idx/* =-1 */) {
  537. _voidcall(ACCESSIBLE_ONGETFOCUS, idx);
  538. }
  539. inline void Accessible::onSetName(const wchar_t *name, int idx) {
  540. _voidcall(ACCESSIBLE_ONSETNAME, name, idx);
  541. }
  542. inline OSWINDOWHANDLE Accessible::getOSWnd() {
  543. return _call(ACCESSIBLE_GETOSWND, (OSWINDOWHANDLE)NULL);
  544. }
  545. inline void Accessible::onStateChange(int idx/* =-1 */) {
  546. _voidcall(ACCESSIBLE_ONSTATECHANGE, idx);
  547. }
  548. inline int Accessible::flattenContent(OSWINDOWHANDLE *w) {
  549. return _call(ACCESSIBLE_FLATTENCONTENT, 0, w);
  550. }
  551. class AccessibleI : public Accessible {
  552. public:
  553. AccessibleI() {}
  554. virtual ~AccessibleI() {}
  555. virtual IAccessible *getIAccessible()=0;
  556. #ifdef _WIN32
  557. virtual HRESULT getOSHandle(int p)=0;
  558. #endif
  559. virtual void release()=0;
  560. virtual void addRef()=0;
  561. virtual int getNumRefs()=0;
  562. virtual void onGetFocus(int idx=-1)=0;
  563. virtual void onSetName(const wchar_t *name, int idx)=0;
  564. virtual OSWINDOWHANDLE getOSWnd()=0;
  565. virtual void onStateChange(int idx=-1)=0;
  566. virtual int flattenContent(OSWINDOWHANDLE *w)=0;
  567. protected:
  568. RECVS_DISPATCH;
  569. };
  570. #endif