Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
4.8 KiB

  1. #ifndef _IAccessible_h
  2. #define _IAccessible_h
  3. #include "oleacc.h"
  4. #include "mnbase.h"
  5. #include "menuband.h"
  6. #define CHILDID_SELF 0
  7. #define MB_STATE_TRACK 1
  8. #define MB_STATE_MENU 2
  9. #define MB_STATE_ITEM 4
  10. #define TOOLBAR_MASK 0x80000000
  11. // BUGBUG (lamadio): The designers of the Accessibility interface did not know
  12. // the rule about COM identity. They allow a QI for the external object IEnumVariant
  13. class CAccessible : public IAccessible, public IEnumVARIANT, public IOleWindow
  14. {
  15. int _cRef;
  16. // IDispatch Support
  17. ITypeInfo* _pTypeInfo;
  18. BOOL _LoadTypeLib();
  19. // Track menu popup Support
  20. IAccessible* _pInnerAcc;
  21. HWND _hwndMenuWindow;
  22. HMENU _hMenu;
  23. WORD _wID;
  24. // Menuband Support
  25. CMenuToolbarBase* _pmtbBottom;
  26. CMenuToolbarBase* _pmtbTop;
  27. IShellMenuAcc* _psma;
  28. IMenuBand* _pmb;
  29. // Menuband Item Support
  30. CMenuToolbarBase* _pmtbItem;
  31. int _iAccIndex;
  32. int _iIndex;
  33. int _iEnumIndex;
  34. int _idCmd;
  35. // Object info
  36. BITBOOL _fInitialized: 1;
  37. BITBOOL _fState: 3;
  38. HRESULT _GetVariantFromChildIndex(HWND hwnd, int iIndex, VARIANT* pvarChild);
  39. HRESULT _GetChildFromVariant(VARIANT* pvarChild, CMenuToolbarBase** ppmtb, int* iIndex);
  40. HRESULT _GetAccessibleItem(int iIndex, IDispatch** ppdisp);
  41. HRESULT _GetAccName(BSTR* pbstr);
  42. HRESULT _Navigate(long navDir, VARIANT varStart, VARIANT * pvarEndUpAt);
  43. public:
  44. CAccessible(HMENU, WORD);
  45. CAccessible(IMenuBand*);
  46. CAccessible(IMenuBand*, int iIndex);
  47. virtual ~CAccessible();
  48. HRESULT InitAcc();
  49. // *** IUnknown methods ***
  50. virtual STDMETHODIMP_(ULONG) AddRef();
  51. virtual STDMETHODIMP_(ULONG) Release();
  52. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
  53. // *** IDispatch methods ***
  54. virtual STDMETHODIMP GetTypeInfoCount(UINT FAR* pctinfo);
  55. virtual STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo);
  56. virtual STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR FAR* FAR* rgszNames, UINT cNames,
  57. LCID lcid, DISPID FAR* rgdispid);
  58. virtual STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags,
  59. DISPPARAMS FAR* pdispparams, VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo,
  60. UINT FAR* puArgErr);
  61. // *** IOleWindow methods ***
  62. virtual STDMETHODIMP GetWindow(HWND * lphwnd);
  63. virtual STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
  64. // *** IAccessible methods ***
  65. virtual STDMETHODIMP get_accParent(IDispatch * FAR* ppdispParent);
  66. virtual STDMETHODIMP get_accChildCount(long FAR* pChildCount);
  67. virtual STDMETHODIMP get_accChild(VARIANT varChildIndex, IDispatch * FAR* ppdispChild);
  68. virtual STDMETHODIMP get_accName(VARIANT varChild, BSTR* pszName);
  69. virtual STDMETHODIMP get_accValue(VARIANT varChild, BSTR* pszValue);
  70. virtual STDMETHODIMP get_accDescription(VARIANT varChild, BSTR FAR* pszDescription);
  71. virtual STDMETHODIMP get_accRole(VARIANT varChild, VARIANT *pvarRole);
  72. virtual STDMETHODIMP get_accState(VARIANT varChild, VARIANT *pvarState);
  73. virtual STDMETHODIMP get_accHelp(VARIANT varChild, BSTR* pszHelp);
  74. virtual STDMETHODIMP get_accHelpTopic(BSTR* pszHelpFile, VARIANT varChild, long* pidTopic);
  75. virtual STDMETHODIMP get_accKeyboardShortcut(VARIANT varChild, BSTR* pszKeyboardShortcut);
  76. virtual STDMETHODIMP get_accFocus(VARIANT FAR * pvarFocusChild);
  77. virtual STDMETHODIMP get_accSelection(VARIANT FAR * pvarSelectedChildren);
  78. virtual STDMETHODIMP get_accDefaultAction(VARIANT varChild, BSTR* pszDefaultAction);
  79. virtual STDMETHODIMP accSelect(long flagsSelect, VARIANT varChild);
  80. virtual STDMETHODIMP accLocation(long* pxLeft, long* pyTop, long* pcxWidth, long* pcyHeight, VARIANT varChild);
  81. virtual STDMETHODIMP accNavigate(long navDir, VARIANT varStart, VARIANT * pvarEndUpAt);
  82. virtual STDMETHODIMP accHitTest(long xLeft, long yTop, VARIANT * pvarChildAtPoint);
  83. virtual STDMETHODIMP accDoDefaultAction(VARIANT varChild);
  84. virtual STDMETHODIMP put_accName(VARIANT varChild, BSTR szName);
  85. virtual STDMETHODIMP put_accValue(VARIANT varChild, BSTR pszValue);
  86. // *** IEnumVARIANT methods ***
  87. virtual STDMETHODIMP Next(unsigned long celt,
  88. VARIANT FAR* rgvar,
  89. unsigned long FAR* pceltFetched);
  90. virtual STDMETHODIMP Skip(unsigned long celt);
  91. virtual STDMETHODIMP Reset();
  92. virtual STDMETHODIMP Clone(IEnumVARIANT FAR* FAR* ppenum);
  93. };
  94. extern "C"
  95. {
  96. LRESULT LresultFromObject(REFIID riid, WPARAM wParam, IUnknown*);
  97. void WINAPI NotifyWinEvent(DWORD event, HWND hwnd,
  98. LONG idObject, LONG idChild);
  99. }
  100. #endif