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.

92 lines
2.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: menubtn.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _MENUBTN_H_
  11. #define _MENUBTN_H_
  12. #include "toolbars.h" // for CMenuButtonNotify
  13. #ifdef DBG
  14. #include "ctrlbar.h" // Needed for GetSnapinName()
  15. #endif
  16. //forward prototypes
  17. class CControlbar;
  18. class CMenuButton;
  19. class CMenuButtonsMgr;
  20. //+-------------------------------------------------------------------
  21. //
  22. // class: CMenuButton
  23. //
  24. // Purpose: The IMenuButton implementation this is owned
  25. // by the CControlbar and talks to the CMenuButtonsMgr
  26. // to create/manipulate the menus.
  27. // The CMenuButtonNotify interface receives the menubutton
  28. // click notification.
  29. //
  30. // History: 10-12-1999 AnandhaG Created
  31. //
  32. //--------------------------------------------------------------------
  33. class CMenuButton : public IMenuButton,
  34. public CMenuButtonNotify,
  35. public CComObjectRoot
  36. {
  37. public:
  38. CMenuButton();
  39. ~CMenuButton();
  40. public:
  41. // ATL COM map
  42. BEGIN_COM_MAP(CMenuButton)
  43. COM_INTERFACE_ENTRY(IMenuButton)
  44. END_COM_MAP()
  45. // CMenuButton methods
  46. public:
  47. STDMETHOD(AddButton)(int idCommand, LPOLESTR lpButtonText, LPOLESTR lpTooltipText);
  48. STDMETHOD(SetButton)(int idCommand, LPOLESTR lpButtonText, LPOLESTR lpTooltipText);
  49. STDMETHOD(SetButtonState)(int idCommand, MMC_BUTTON_STATE nState, BOOL bState);
  50. public:
  51. // Helpers
  52. void SetControlbar(CControlbar* pControlbar);
  53. CControlbar* GetControlbar(void);
  54. CMenuButtonsMgr* GetMenuButtonsMgr(void);
  55. SC ScAttach(void);
  56. SC ScDetach(void);
  57. public:
  58. // CMenuButtonsMgr methods.
  59. virtual SC ScNotifyMenuBtnClick(HNODE hNode, bool bScope, LPARAM lParam,
  60. MENUBUTTONDATA& menuButtonData);
  61. #ifdef DBG // Debug information.
  62. public:
  63. LPCTSTR GetSnapinName ()
  64. {
  65. if (m_pControlbar)
  66. return m_pControlbar->GetSnapinName();
  67. return _T("Unknown");
  68. }
  69. #endif
  70. // Attributes
  71. private:
  72. CControlbar* m_pControlbar; // pointer to IControlbar (1 IControlbar to 1 IMenuButton)
  73. CMenuButtonsMgr* m_pMenuButtonsMgr; // The Menu buttons mgr that manages the UI.
  74. }; // class CMenuButton
  75. #endif // _MENUBTN_H_