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.

140 lines
4.6 KiB

  1. //
  2. // utbdacc.h
  3. // = accessibility support in language bar
  4. //
  5. #ifndef UTBACC_H
  6. #define UTBACC_H
  7. #include "ptrary.h"
  8. class CTipbarAccessible;
  9. //////////////////////////////////////////////////////////////////////////////
  10. //
  11. // misc func
  12. //
  13. //////////////////////////////////////////////////////////////////////////////
  14. extern void InitTipbarAcc( void );
  15. extern void DoneTipbarAcc( void );
  16. //////////////////////////////////////////////////////////////////////////////
  17. //
  18. // CTipbarAccItem
  19. //
  20. //////////////////////////////////////////////////////////////////////////////
  21. class CTipbarAccItem
  22. {
  23. public:
  24. CTipbarAccItem( void ) {}
  25. virtual ~CTipbarAccItem( void ) {}
  26. virtual BSTR GetAccName( void ) {return SysAllocString( L"" );}
  27. virtual BSTR GetAccValue( void ) {return NULL;}
  28. virtual LONG GetAccRole( void ) {return ROLE_SYSTEM_CLIENT;}
  29. virtual LONG GetAccState( void ) {return STATE_SYSTEM_DEFAULT;}
  30. virtual void GetAccLocation( RECT *prc ) {SetRect( prc, 0, 0, 0, 0 );}
  31. virtual BSTR GetAccDefaultAction( void ) {return NULL;}
  32. virtual BOOL DoAccDefaultAction( void ) {return FALSE;}
  33. virtual BOOL DoAccDefaultActionReal( void ) {return FALSE;}
  34. };
  35. //////////////////////////////////////////////////////////////////////////////
  36. //
  37. // CTipbarAccessible
  38. //
  39. //////////////////////////////////////////////////////////////////////////////
  40. class CTipbarAccessible : public IAccessible
  41. {
  42. public:
  43. CTipbarAccessible( CTipbarAccItem *pAccItemSelf );
  44. virtual ~CTipbarAccessible( void );
  45. //
  46. // IUnknown methods
  47. //
  48. STDMETHODIMP QueryInterface( REFIID riid, void** ppv );
  49. STDMETHODIMP_(ULONG) AddRef( void );
  50. STDMETHODIMP_(ULONG) Release( void );
  51. //
  52. // IDispatch methods
  53. //
  54. STDMETHODIMP GetTypeInfoCount( UINT* pctinfo );
  55. STDMETHODIMP GetTypeInfo( UINT itinfo, LCID lcid, ITypeInfo** pptinfo );
  56. STDMETHODIMP GetIDsOfNames( REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid );
  57. STDMETHODIMP Invoke( DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr );
  58. //
  59. // IAccessible methods
  60. //
  61. STDMETHODIMP get_accParent( IDispatch ** ppdispParent );
  62. STDMETHODIMP get_accChildCount( long* pChildCount );
  63. STDMETHODIMP get_accChild( VARIANT varChild, IDispatch ** ppdispChild );
  64. STDMETHODIMP get_accName( VARIANT varChild, BSTR* pszName );
  65. STDMETHODIMP get_accValue( VARIANT varChild, BSTR* pszValue );
  66. STDMETHODIMP get_accDescription( VARIANT varChild, BSTR* pszDescription );
  67. STDMETHODIMP get_accRole( VARIANT varChild, VARIANT *pvarRole );
  68. STDMETHODIMP get_accState( VARIANT varChild, VARIANT *pvarState );
  69. STDMETHODIMP get_accHelp( VARIANT varChild, BSTR* pszHelp );
  70. STDMETHODIMP get_accHelpTopic( BSTR* pszHelpFile, VARIANT varChild, long* pidTopic );
  71. STDMETHODIMP get_accKeyboardShortcut( VARIANT varChild, BSTR* pszKeyboardShortcut );
  72. STDMETHODIMP get_accFocus( VARIANT * pvarFocusChild );
  73. STDMETHODIMP get_accSelection( VARIANT * pvarSelectedChildren );
  74. STDMETHODIMP get_accDefaultAction( VARIANT varChild, BSTR* pszDefaultAction );
  75. STDMETHODIMP accSelect( long flagsSel, VARIANT varChild );
  76. STDMETHODIMP accLocation( long* pxLt, long* pyTp, long* pcxWd, long* pcyHt, VARIANT varChild );
  77. STDMETHODIMP accNavigate( long navDir, VARIANT varStart, VARIANT * pVarEndUpAt );
  78. STDMETHODIMP accHitTest( long xLeft, long yTop, VARIANT * pvarChildAtPoint );
  79. STDMETHODIMP accDoDefaultAction( VARIANT varChild );
  80. STDMETHODIMP put_accName( VARIANT varChild, BSTR szName );
  81. STDMETHODIMP put_accValue( VARIANT varChild, BSTR pszValue );
  82. //
  83. //
  84. //
  85. void SetWindow( HWND hWnd );
  86. HRESULT Initialize( void );
  87. int GetIDOfItem( CTipbarAccItem *pAccItem );
  88. void NotifyWinEvent( DWORD dwEvent, CTipbarAccItem *pAccItem );
  89. LRESULT CreateRefToAccObj( WPARAM wParam );
  90. //
  91. //
  92. //
  93. void ClearAccItems( void );
  94. BOOL AddAccItem( CTipbarAccItem *pAccItem );
  95. BOOL RemoveAccItem( CTipbarAccItem *pAccItem );
  96. BOOL DoDefaultActionReal(int nItemId);
  97. //
  98. //
  99. //
  100. __inline BOOL IsInitialized( void )
  101. {
  102. return _fInitialized;
  103. }
  104. protected:
  105. LONG _cRef;
  106. HWND _hWnd;
  107. IAccessible *_pDefAccClient;
  108. ITypeInfo *_pTypeInfo;
  109. BOOL _fInitialized;
  110. CPtrArray<CTipbarAccItem> _rgAccItems;
  111. LONG _lSelection;
  112. CTipbarAccItem *AccItemFromID( int iID );
  113. };
  114. #endif /* UTBACC_H */