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.

110 lines
2.7 KiB

  1. #ifndef __MultiStateToolbar_h__
  2. #define __MultiStateToolbar_h__
  3. class CMultiStateToolbar
  4. : public CWindowImpl< CMultiStateToolbar >
  5. {
  6. public:
  7. // Datatypes
  8. struct ItemStateInfo
  9. {
  10. DWORD dwID;
  11. BYTE TbStyle;
  12. HBITMAP hItemBitmap;
  13. HBITMAP hItemHotBitmap;
  14. HBITMAP hItemDisabledBitmap;
  15. };
  16. struct BlockItemStateData
  17. {
  18. DWORD dwID;
  19. DWORD dwBitmapIndex;
  20. BYTE TbStyle;
  21. };
  22. struct BlockData
  23. {
  24. LPCTSTR szTitle;
  25. int cbStates;
  26. BlockItemStateData* pStateData;
  27. };
  28. struct TBItemStateData
  29. {
  30. DWORD BitmapId;
  31. DWORD CommandId;
  32. DWORD StringId;
  33. BYTE TbStyle;
  34. };
  35. struct TBItemData
  36. {
  37. int cStates;
  38. int CurrentState;
  39. TBItemStateData *pStateData;
  40. };
  41. public:
  42. // Construction and destruction
  43. CMultiStateToolbar( void );
  44. ~CMultiStateToolbar( void );
  45. // Methods
  46. HRESULT Create( HWND hWndParent,
  47. DWORD dwID,
  48. int cxButton,
  49. int cyButton,
  50. int cxBtnBitmaps,
  51. int cyBtnBitmaps
  52. );
  53. HRESULT Show( BOOL bShow );
  54. HRESULT InsertItem( int cStates, LPCTSTR szTitle, ItemStateInfo* pItemStates, int* pIndex );
  55. HRESULT InsertBlock( int nItems,
  56. BlockData* pItemData,
  57. HINSTANCE hInstance,
  58. int idTBBitmap,
  59. int idTBBitmapHot,
  60. int idTBBitmapDisabled,
  61. int* pIndexFirst
  62. );
  63. HRESULT EnableItem( DWORD dwCmd, BOOL bEnable = TRUE );
  64. HRESULT SetItemState( int iIndex, int NewState );
  65. HRESULT ShowLabels( BOOL bShowLabels );
  66. HRESULT Resize( RECT& rc );
  67. HRESULT GetWindow( HWND* phWnd );
  68. BEGIN_MSG_MAP(CMultiStateToolbar)
  69. MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
  70. MESSAGE_HANDLER(WM_NCDESTROY,OnNcDestroy)
  71. END_MSG_MAP()
  72. // Message handlers
  73. LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& lResult );
  74. LRESULT OnNcDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  75. private:
  76. // This is here in case we change the toolbar to be a CContainedWindow
  77. HWND _GetToolbarWindow( void ) { return m_hWnd; }
  78. HRESULT _CreateImageLists( void );
  79. void _KillAllButtons( void );
  80. // Data
  81. private:
  82. int m_cxButton;
  83. int m_cyButton;
  84. int m_cxBtnBitmaps;
  85. int m_cyBtnBitmaps;
  86. HIMAGELIST m_himlTB;
  87. HIMAGELIST m_himlTBHot;
  88. HIMAGELIST m_himlTBDisabled;
  89. };
  90. #endif // __MultiStateToolbar_h__