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.

118 lines
4.2 KiB

  1. #ifndef _menubar_h
  2. #define _menubar_h
  3. #ifdef __cplusplus
  4. #include "basebar.h"
  5. IMenuPopup* CreateMenuPopup(IMenuPopup *pmpParent, IShellFolder* psf, LPCITEMIDLIST pidl, BANDINFOSFB * pbi, BOOL bMenuBand);
  6. IMenuPopup* CreateMenuPopup2(IMenuPopup *pmpParent, IMenuBand* pmb, IShellFolder* psf, LPCITEMIDLIST pidl, BANDINFOSFB * pbi, BOOL bMenuBand);
  7. HRESULT FindBandInBandSite(IMenuPopup* pmpParent, IBandSite** ppbs, LPCITEMIDLIST pidl, REFIID riid, void** ppvOut);
  8. HRESULT ShowBandInBandSite(IUnknown* punkBS, IUnknown* punkDB);
  9. class CMenuDeskBar :
  10. public CBaseBar
  11. ,public IMenuPopup
  12. ,public IObjectWithSite
  13. ,public IBanneredBar
  14. ,public IInitializeObject
  15. {
  16. public:
  17. // *** IUnknown ***
  18. virtual STDMETHODIMP_(ULONG) AddRef(void) { return CBaseBar::AddRef(); };
  19. virtual STDMETHODIMP_(ULONG) Release(void){ return CBaseBar::Release(); };
  20. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  21. // *** IServiceProvider methods ***
  22. virtual STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, LPVOID* ppvObj);
  23. // *** IOleWindow methods ***
  24. virtual STDMETHODIMP GetWindow(HWND * lphwnd) { return CBaseBar::GetWindow(lphwnd); };
  25. virtual STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode) { return CBaseBar::ContextSensitiveHelp(fEnterMode); };
  26. // *** IDeskBar methods ***
  27. STDMETHODIMP SetClient(IUnknown* punk) { return CBaseBar::SetClient(punk); };
  28. STDMETHODIMP GetClient(IUnknown** ppunkClient) { return CBaseBar::GetClient(ppunkClient); };
  29. STDMETHODIMP OnPosRectChangeDB (LPRECT prc) { return CBaseBar::OnPosRectChangeDB(prc); };
  30. // *** IInputObjectSite methods (override) ***
  31. virtual STDMETHODIMP OnFocusChangeIS(IUnknown *punk, BOOL fSetFocus);
  32. // *** IMenuPopup methods ***
  33. virtual STDMETHODIMP Popup(POINTL *ppt, RECTL *prcExclude, DWORD dwFlags);
  34. virtual STDMETHODIMP OnSelect(DWORD dwSelectType);
  35. virtual STDMETHODIMP SetSubMenu(IMenuPopup* pmp, BOOL fSet);
  36. // *** IObjectWithSite methods ***
  37. STDMETHODIMP SetSite(IUnknown * pUnkSite);
  38. STDMETHODIMP GetSite(REFIID riid, void ** ppvSite);
  39. // *** IOleCommandTarget methods ***
  40. virtual STDMETHODIMP Exec(const GUID *pguidCmdGroup,
  41. DWORD nCmdID, DWORD nCmdexecopt,
  42. VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
  43. // *** IBanneredBar methods ***
  44. virtual STDMETHODIMP SetIconSize(DWORD iIcon);
  45. virtual STDMETHODIMP GetIconSize(DWORD* piIcon)
  46. { ASSERT(piIcon); *piIcon = _iIconSize; return NOERROR;};
  47. virtual STDMETHODIMP SetBitmap(HBITMAP hBitmap);
  48. virtual STDMETHODIMP GetBitmap(HBITMAP* phBitmap)
  49. { ASSERT(phBitmap); *phBitmap = _hbmp; return NOERROR;};
  50. // *** IInitializeObject methods ***
  51. // This is for Backwards compatility with Start Menu.
  52. STDMETHODIMP Initialize() { return NOERROR; }
  53. CMenuDeskBar();
  54. protected:
  55. virtual LRESULT v_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  56. virtual void _OnCreate();
  57. virtual void _OnSize();
  58. virtual DWORD _GetExStyle();
  59. virtual DWORD _GetClassStyle();
  60. void _AllowMessageThrough(UINT uMsg, WPARAM wParam, LPARAM lParam);
  61. virtual void _GetPopupWindowPosition(RECT* rcDesired, RECT* rcExclude, RECT *prcResult, SIZE * psizeEdge, UINT uside);
  62. void _PopDown();
  63. BOOL _IsMyParent(HWND hwnd);
  64. IMenuPopup* _GetMenuBarParent(IUnknown* punk);
  65. UINT _GetSide() { return _uSide;};
  66. HRESULT _PositionWindow(POINTL *ppt, RECTL* prcExclude, DWORD dwFlags);
  67. LRESULT _DoPaint(HWND hwnd, HDC hdc, DWORD dwFlags);
  68. void _DoNCPaint(HWND hwnd, HDC hdc);
  69. void _SelectItem(BOOL bFirst);
  70. void AdjustForTheme();
  71. virtual ~CMenuDeskBar();
  72. POINT _pt;
  73. IMenuPopup* _pmpParent;
  74. IMenuPopup* _pmpChild;
  75. IUnknown* _punkSite;
  76. UINT _uSide;
  77. HBITMAP _hbmp;
  78. DWORD _iIconSize;
  79. SIZE _sizeBmp;
  80. COLORREF _rgb;
  81. BITBOOL _fActive: 1;
  82. RECT _rcExclude;
  83. BITBOOL _fExcludeRect: 1; // TRUE: _rcExclude contains valid
  84. BITBOOL _fExpanded: 1;
  85. BITBOOL _fFlatMenuMode: 1;
  86. BOOL _fNoBorder;
  87. };
  88. HRESULT TrackShellMenu(HWND hwnd, LPRECT prc, IShellMenu* psm, DWORD dwFlags);
  89. #endif // __cplusplus
  90. #endif // _menubar_h