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.

117 lines
2.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: toolbar.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _TOOLBAR_H_
  11. #define _TOOLBAR_H_
  12. #include "toolbars.h"
  13. #ifdef DBG
  14. #include "ctrlbar.h" // Needed for GetSnapinName()
  15. #endif
  16. #define BUTTON_BITMAP_SIZE 16
  17. //forward prototypes
  18. class CControlbar;
  19. class CMMCToolbarIntf;
  20. class CToolbarNotify;
  21. //+-------------------------------------------------------------------
  22. //
  23. // class: CToolbar
  24. //
  25. // Purpose: The IToolbar implementation this is owned
  26. // by the CControlbar and talks to the toolbar UI
  27. // using the CMMCToolbarIntf interface to manipulate the toolbar.
  28. // This object lives as long as snapin holds the COM reference.
  29. //
  30. // History: 10-12-1999 AnandhaG Created
  31. //
  32. //--------------------------------------------------------------------
  33. class CToolbar : public IToolbar,
  34. public CComObjectRoot,
  35. public CToolbarNotify
  36. {
  37. public:
  38. CToolbar();
  39. ~CToolbar();
  40. private:
  41. CToolbar(const CToolbar& toolBar);
  42. BYTE GetTBStateFromMMCButtonState(MMC_BUTTON_STATE nState);
  43. public:
  44. // ATL COM map
  45. BEGIN_COM_MAP(CToolbar)
  46. COM_INTERFACE_ENTRY(IToolbar)
  47. END_COM_MAP()
  48. // IToolbar methods
  49. public:
  50. STDMETHOD(AddBitmap)(int nImages, HBITMAP hbmp, int cxSize, int cySize, COLORREF crMask );
  51. STDMETHOD(AddButtons)(int nButtons, LPMMCBUTTON lpButtons);
  52. STDMETHOD(InsertButton)(int nIndex, LPMMCBUTTON lpButton);
  53. STDMETHOD(DeleteButton)(int nIndex);
  54. STDMETHOD(GetButtonState)(int idCommand, MMC_BUTTON_STATE nState, BOOL* pState);
  55. STDMETHOD(SetButtonState)(int idCommand, MMC_BUTTON_STATE nState, BOOL bState);
  56. // Internal methods
  57. public:
  58. SC ScShow(BOOL bShow);
  59. SC ScAttach();
  60. SC ScDetach();
  61. void SetControlbar(CControlbar* pControlbar)
  62. {
  63. m_pControlbar = pControlbar;
  64. }
  65. CControlbar* GetControlbar(void)
  66. {
  67. return m_pControlbar;
  68. }
  69. CMMCToolbarIntf* GetMMCToolbarIntf()
  70. {
  71. return m_pToolbarIntf;
  72. }
  73. void SetMMCToolbarIntf(CMMCToolbarIntf* pToolbarIntf)
  74. {
  75. m_pToolbarIntf = pToolbarIntf;
  76. }
  77. #ifdef DBG // Debug information.
  78. public:
  79. LPCTSTR GetSnapinName ()
  80. {
  81. if (m_pControlbar)
  82. return m_pControlbar->GetSnapinName();
  83. return _T("Unknown");
  84. }
  85. #endif
  86. public:
  87. // CToolbarNotify methods.
  88. virtual SC ScNotifyToolBarClick(HNODE hNode, bool bScope,
  89. LPARAM lParam, UINT nID);
  90. virtual SC ScAMCViewToolbarsBeingDestroyed();
  91. private:
  92. CControlbar* m_pControlbar;
  93. CMMCToolbarIntf* m_pToolbarIntf;
  94. }; // class CToolbar
  95. #endif // _TOOLBAR_H_