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.

114 lines
4.1 KiB

  1. #ifndef MENUST
  2. #define MENUST
  3. #include "mnbase.h"
  4. #include "cwndproc.h"
  5. #include "droptgt.h"
  6. class CMenuBand;
  7. class CMenuStaticToolbar : public CMenuToolbarBase,
  8. public CDelegateDropTarget,
  9. public CNotifySubclassWndProc
  10. {
  11. public:
  12. // *** IUnknown (override) ***
  13. virtual STDMETHODIMP_(ULONG) AddRef(void) { return CMenuToolbarBase::AddRef(); };
  14. virtual STDMETHODIMP_(ULONG) Release(void) { return CMenuToolbarBase::Release(); };
  15. virtual STDMETHODIMP QueryInterface(REFIID riid, void** ppvObj);
  16. // *** CDelegateDropTarget Methods ***
  17. virtual HRESULT GetWindowsDDT (HWND * phwndLock, HWND * phwndScroll);
  18. virtual HRESULT HitTestDDT (UINT nEvent, LPPOINT ppt, DWORD_PTR * pdwId, DWORD *pdwEffect);
  19. virtual HRESULT GetObjectDDT (DWORD_PTR dwId, REFIID riid, LPVOID * ppvObj);
  20. virtual HRESULT OnDropDDT (IDropTarget *pdt, IDataObject *pdtobj,
  21. DWORD * pgrfKeyState, POINTL pt, DWORD *pdwEffect);
  22. //*** IWinEventHandler (override) ***
  23. virtual STDMETHODIMP IsWindowOwner(HWND hwnd);
  24. virtual STDMETHODIMP OnWinEvent(HWND hwnd, UINT dwMsg, WPARAM wParam, LPARAM lParam, LRESULT *plres);
  25. // Other public methods
  26. virtual void GetSize(SIZE* psize);
  27. virtual void v_SendMenuNotification(UINT idCmd, BOOL fClear);
  28. virtual BOOL v_TrackingSubContextMenu();
  29. virtual BOOL v_UpdateIconSize(UINT uIconSize, BOOL fUpdateButtons);
  30. virtual void v_Show(BOOL fShow, BOOL fForceUpdate);
  31. virtual void v_UpdateButtons(BOOL fNegotiateSize);
  32. virtual STDMETHODIMP OnChange(LONG lEvent, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
  33. virtual void CreateToolbar(HWND hwndParent);
  34. virtual void v_Close(); // override
  35. virtual void v_OnEmptyToolbar(); // override
  36. virtual void v_OnDeleteButton(LPVOID pData);
  37. virtual HRESULT v_InvalidateItem(LPSMDATA psmd, DWORD dwFlags);
  38. virtual HRESULT GetMenu(HMENU* phmenu, HWND* phwnd, DWORD* pdwFlags);
  39. virtual HRESULT SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags);
  40. inline virtual BOOL ShowAmpersand() { return FALSE; }
  41. CMenuStaticToolbar(CMenuBand* pmb, HMENU hmenu, HWND hwnd, UINT idCmd, DWORD dwFlags);
  42. protected:
  43. class CMenuStaticData
  44. {
  45. public:
  46. ~CMenuStaticData();
  47. void SetSubMenu(IUnknown* punk);
  48. HRESULT GetSubMenu(const GUID* pguidService, REFIID riid, void** ppvObj);
  49. IUnknown* _punkSubMenu;
  50. DWORD _dwFlags;
  51. };
  52. HWND _hwndMenuOwner;
  53. HWND _hwndDD;
  54. HMENU _hmenu;
  55. UINT _idCmd;
  56. int _iDragOverButton;
  57. IContextMenu* _pcm;
  58. BITBOOL _fHasTopSep: 1;
  59. BITBOOL _fHasBottomSep: 1;
  60. BITBOOL _fTopSepRemoved: 1;
  61. BITBOOL _fBottomSepRemoved: 1;
  62. BITBOOL _fDirty: 1;
  63. LRESULT _OnAccelerator(NMCHAR* pnmChar);
  64. LRESULT (*_lpfnWndProc)(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  65. CMenuStaticData* _IDToData(int idCmd);
  66. HRESULT CallCB(UINT idCmd, DWORD dwMsg, WPARAM wParam, LPARAM lParam);
  67. protected:
  68. virtual ~CMenuStaticToolbar();
  69. // Window Proc and message handlers
  70. virtual LRESULT _DefWindowProc(HWND hwnd, UINT uMessage, WPARAM wParam, LPARAM lParam);
  71. virtual LRESULT _OnNotify(LPNMHDR pnm);
  72. virtual int v_GetDragOverButton()
  73. { return _iDragOverButton; };
  74. virtual HRESULT v_GetInfoTip(int iCmd, LPTSTR psz, UINT cch);
  75. virtual HRESULT v_CallCBItem(int idtCmd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  76. virtual HRESULT v_GetState(int idtCmd, LPSMDATA psmd);
  77. virtual HRESULT v_ExecItem(int iCmd);
  78. virtual DWORD v_GetFlags(int iCmd);
  79. virtual void v_Refresh();
  80. virtual HRESULT v_GetSubMenu(int iCmd, const GUID* pguidService, REFIID riid, void** ppvObj);
  81. virtual HRESULT v_CreateTrackPopup(int idCmd, REFIID riid, void** ppvObj);
  82. LRESULT _OnGetObject(NMOBJECTNOTIFY*);
  83. LRESULT _OnContextMenu(WPARAM wParam, LPARAM lParam);
  84. void _FillToolbar();
  85. void _OnGetDispInfo(LPNMHDR pnm, BOOL fUnicode);
  86. void _Insert(int iIndex, MENUITEMINFO* pmii);
  87. void _CheckSeparators();
  88. };
  89. #endif // MENUST