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.

126 lines
4.6 KiB

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