Leaked source code of windows server 2003
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.

142 lines
3.8 KiB

  1. //
  2. // candacc.h
  3. // = accessibility support in candidate ui =
  4. //
  5. #ifndef CANDACC_H
  6. #define CANDACC_H
  7. #include <windows.h>
  8. #include <winable.h>
  9. #include <ole2.h>
  10. #include <oleacc.h>
  11. #define CANDACCITEM_MAX 16 /* REVIEW: KOJIW: enough? */
  12. class CCandAccessible;
  13. //
  14. // CCandAccItem
  15. //
  16. class CCandAccItem
  17. {
  18. public:
  19. CCandAccItem( void );
  20. virtual ~CCandAccItem( void );
  21. void Init( CCandAccessible *pCandAcc, int iItemID );
  22. int GetID( void );
  23. virtual BSTR GetAccName( void );
  24. virtual BSTR GetAccValue( void );
  25. virtual LONG GetAccRole( void );
  26. virtual LONG GetAccState( void );
  27. virtual void GetAccLocation( RECT *prc );
  28. protected:
  29. void NotifyWinEvent( DWORD dwEvent );
  30. private:
  31. CCandAccessible *m_pCandAcc;
  32. int m_iItemID;
  33. };
  34. //
  35. // CCandAccessible
  36. //
  37. class CCandAccessible : public IAccessible
  38. {
  39. public:
  40. CCandAccessible( CCandAccItem *pAccItemSelf );
  41. virtual ~CCandAccessible( void );
  42. //
  43. // IUnknown methods
  44. //
  45. STDMETHODIMP QueryInterface( REFIID riid, void** ppv );
  46. STDMETHODIMP_(ULONG) AddRef( void );
  47. STDMETHODIMP_(ULONG) Release( void );
  48. //
  49. // IDispatch methods
  50. //
  51. STDMETHODIMP GetTypeInfoCount( UINT* pctinfo );
  52. STDMETHODIMP GetTypeInfo( UINT itinfo, LCID lcid, ITypeInfo** pptinfo );
  53. STDMETHODIMP GetIDsOfNames( REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid );
  54. STDMETHODIMP Invoke( DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr );
  55. //
  56. // IAccessible methods
  57. //
  58. STDMETHODIMP get_accParent( IDispatch ** ppdispParent );
  59. STDMETHODIMP get_accChildCount( long* pChildCount );
  60. STDMETHODIMP get_accChild( VARIANT varChild, IDispatch ** ppdispChild );
  61. STDMETHODIMP get_accName( VARIANT varChild, BSTR* pszName );
  62. STDMETHODIMP get_accValue( VARIANT varChild, BSTR* pszValue );
  63. STDMETHODIMP get_accDescription( VARIANT varChild, BSTR* pszDescription );
  64. STDMETHODIMP get_accRole( VARIANT varChild, VARIANT *pvarRole );
  65. STDMETHODIMP get_accState( VARIANT varChild, VARIANT *pvarState );
  66. STDMETHODIMP get_accHelp( VARIANT varChild, BSTR* pszHelp );
  67. STDMETHODIMP get_accHelpTopic( BSTR* pszHelpFile, VARIANT varChild, long* pidTopic );
  68. STDMETHODIMP get_accKeyboardShortcut( VARIANT varChild, BSTR* pszKeyboardShortcut );
  69. STDMETHODIMP get_accFocus( VARIANT * pvarFocusChild );
  70. STDMETHODIMP get_accSelection( VARIANT * pvarSelectedChildren );
  71. STDMETHODIMP get_accDefaultAction( VARIANT varChild, BSTR* pszDefaultAction );
  72. STDMETHODIMP accSelect( long flagsSel, VARIANT varChild );
  73. STDMETHODIMP accLocation( long* pxLt, long* pyTp, long* pcxWd, long* pcyHt, VARIANT varChild );
  74. STDMETHODIMP accNavigate( long navDir, VARIANT varStart, VARIANT * pVarEndUpAt );
  75. STDMETHODIMP accHitTest( long xLeft, long yTop, VARIANT * pvarChildAtPoint );
  76. STDMETHODIMP accDoDefaultAction( VARIANT varChild );
  77. STDMETHODIMP put_accName( VARIANT varChild, BSTR szName );
  78. STDMETHODIMP put_accValue( VARIANT varChild, BSTR pszValue );
  79. //
  80. //
  81. //
  82. void SetWindow( HWND hWnd );
  83. HRESULT Initialize( void );
  84. void NotifyWinEvent( DWORD dwEvent, CCandAccItem *pAccItem );
  85. LRESULT CreateRefToAccObj( WPARAM wParam );
  86. //
  87. //
  88. //
  89. void ClearAccItem( void );
  90. BOOL AddAccItem( CCandAccItem *pAccItem );
  91. //
  92. //
  93. //
  94. __inline BOOL FInitialized( void )
  95. {
  96. return m_fInitialized;
  97. }
  98. protected:
  99. LONG m_cRef;
  100. HWND m_hWnd;
  101. IAccessible *m_pDefAccClient;
  102. ITypeInfo *m_pTypeInfo;
  103. BOOL m_fInitialized;
  104. int m_nAccItem;
  105. CCandAccItem *m_rgAccItem[ CANDACCITEM_MAX ];
  106. BOOL IsValidChildVariant( VARIANT * pVar );
  107. CCandAccItem *AccItemFromID( int iID );
  108. };
  109. extern void InitCandAcc( void );
  110. extern void DoneCandAcc( void );
  111. #endif /* CANDACC_H */