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.

181 lines
7.2 KiB

  1. #ifndef MENUSF
  2. #define MENUSF
  3. #include "mnbase.h"
  4. #include "sftbar.h"
  5. class CMenuData : public IBDATA
  6. {
  7. protected:
  8. IUnknown* _punkSubmenu;
  9. public:
  10. CMenuData(PORDERITEM poi) : IBDATA(poi) {};
  11. virtual ~CMenuData();
  12. void SetSubMenu(IUnknown* pmb2);
  13. HRESULT GetSubMenu(const GUID* pguidService, REFIID riid, void**);
  14. };
  15. class CMenuBand;
  16. class CMenuSFToolbar : public CSFToolbar,
  17. public CMenuToolbarBase
  18. {
  19. public:
  20. // *** IUnknown (override) ***
  21. // This deliberately forwards AddRef and Release to CMenuToolbarBase, and
  22. // forwards QI separately to CSFToolbar.
  23. virtual STDMETHODIMP_(ULONG) AddRef(void) { return CMenuToolbarBase::AddRef(); };
  24. virtual STDMETHODIMP_(ULONG) Release(void) { return CMenuToolbarBase::Release(); };
  25. virtual STDMETHODIMP QueryInterface(REFIID riid, void** ppvObj);
  26. // *** IObjectWithSite methods ***
  27. virtual STDMETHODIMP SetSite(IUnknown* punkSite);
  28. // *** IShellChangeNotify methods ***
  29. virtual STDMETHODIMP OnChange(LONG lEvent, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
  30. // *** IWinEventHandler methods (override) ***
  31. virtual STDMETHODIMP IsWindowOwner(HWND hwnd);
  32. virtual STDMETHODIMP OnWinEvent(HWND hwnd, UINT dwMsg, WPARAM wParam, LPARAM lParam, LRESULT *plres);
  33. // *** CDelegateDropTarget methods ***
  34. virtual STDMETHODIMP DragEnter(IDataObject *pdtobj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  35. virtual STDMETHODIMP DragLeave(void);
  36. virtual HRESULT HitTestDDT (UINT nEvent, LPPOINT ppt, DWORD_PTR * pdwId, DWORD *pdwEffect);
  37. virtual HRESULT GetObjectDDT (DWORD_PTR dwId, REFIID riid, LPVOID * ppvObj);
  38. virtual HRESULT OnDropDDT (IDropTarget *pdt, IDataObject *pdtobj, DWORD * pgrfKeyState, POINTL pt, DWORD *pdwEffect);
  39. // Other public methods
  40. virtual HWND v_GetHWND()
  41. { return _hwndTB; };
  42. virtual void v_ForwardMouseMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
  43. virtual void v_SendMenuNotification(UINT idCmd, BOOL fClear);
  44. virtual BOOL v_TrackingSubContextMenu() { return (BOOL) ( _pcm2 ? 1 : 0 );}; // Win64: should be ok since _pcm2 used as boolean in all contexts
  45. virtual BOOL v_UpdateIconSize(UINT uIconSize, BOOL fUpdateButtons);
  46. virtual void v_Close();
  47. virtual void v_Show(BOOL fShow, BOOL fForceUpdate);
  48. virtual void v_UpdateButtons(BOOL fNegotiateSize);
  49. virtual void NegotiateSize();
  50. virtual void Expand(BOOL fExpand);
  51. virtual void GetSize(SIZE* size);
  52. virtual void SetWindowPos(LPSIZE psize, LPRECT prc, DWORD dwFlags);
  53. virtual void CreateToolbar(HWND hwndParent);
  54. virtual void SetParent(HWND hwndParent);
  55. virtual HRESULT GetShellFolder(LPITEMIDLIST* ppidl, REFIID riid, void** ppvObj);
  56. virtual void v_OnEmptyToolbar(); // override
  57. virtual void v_OnDeleteButton(LPVOID pData);
  58. virtual HRESULT v_InvalidateItem(LPSMDATA psmd, DWORD dwFlags);
  59. virtual HRESULT SetShellFolder(IShellFolder* psf, LPCITEMIDLIST pidl);
  60. inline virtual BOOL ShowAmpersand() { return TRUE; }
  61. // Change HKEY to IStream*
  62. CMenuSFToolbar(CMenuBand* pmb, IShellFolder* psf, LPCITEMIDLIST pidl, HKEY hKey, DWORD dwFlags);
  63. protected:
  64. ~CMenuSFToolbar();
  65. // Window Proc Overrides
  66. virtual LRESULT _DefWindowProc(HWND hwnd, UINT uMessage, WPARAM wParam, LPARAM lParam);
  67. virtual LRESULT _OnContextMenu(WPARAM wParam, LPARAM lParam);
  68. virtual void _OnDragBegin(int iItem, DWORD dwPreferedEffect);
  69. virtual void _OnFSNotifyAdd(LPCITEMIDLIST pidl);
  70. virtual void _OnFSNotifyRemove(LPCITEMIDLIST pidl);
  71. virtual HRESULT OnTranslatedChange(LONG lEvent, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
  72. virtual void _FillToolbar();
  73. virtual LRESULT _OnNotify(LPNMHDR pnm);
  74. virtual LRESULT _OnTimer(WPARAM wParam);
  75. virtual LRESULT _OnCustomDraw(NMCUSTOMDRAW * pnmcd)
  76. { return CMenuToolbarBase::_OnCustomDraw(pnmcd); };
  77. virtual void _SetToolbarState()
  78. { CMenuToolbarBase::_SetToolbarState(); };
  79. virtual void EmptyToolbar()
  80. { CMenuToolbarBase::EmptyToolbar(); };
  81. virtual int v_GetDragOverButton()
  82. { return _tbim.iButton; };
  83. virtual HRESULT v_GetSubMenu(int iCmd, const GUID* pguidService, REFIID riid, void** pObj);
  84. virtual HRESULT v_GetInfoTip(int iCmd, LPTSTR psz, UINT cch);
  85. virtual HRESULT v_CallCBItem(int idtCmd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  86. virtual HRESULT v_GetState(int idtCmd, LPSMDATA psmd);
  87. virtual HRESULT v_ExecItem(int iCmd);
  88. virtual DWORD v_GetFlags(int iCmd);
  89. virtual void v_Refresh()
  90. { _Refresh(); };
  91. virtual void v_CalcWidth(int* pcxMin, int* pcxMax)
  92. { CMenuToolbarBase::v_CalcWidth(pcxMin, pcxMax); };
  93. // Utility Functions
  94. virtual BOOL _AddPidl(LPITEMIDLIST pidl, int index);
  95. virtual PIBDATA _AddOrderItemTB(PORDERITEM poi, int index, TBBUTTON* ptbb);
  96. virtual void _Dropped(int nIndex, BOOL fDroppedOnSource);
  97. virtual HRESULT _TBStyleForPidl(LPCITEMIDLIST pidl, DWORD * pdwStyle,
  98. DWORD* pdwState, DWORD * pdwFlags,int* piIcon);
  99. virtual void _ToolbarChanged();
  100. virtual void _FillDPA(HDPA hdpa, HDPA hdpaSort, DWORD dwEnumFlags);
  101. virtual BOOL _FilterPidl(LPCITEMIDLIST pidl);
  102. virtual void _ObtainPIDLName(LPCITEMIDLIST pidl, LPTSTR psz, int cchMax);
  103. virtual HMENU _GetContextMenu(IContextMenu* pcm, int* pid);
  104. virtual void _OnDefaultContextCommand(int idCmd);
  105. virtual void v_NewItem(LPCITEMIDLIST pidl);
  106. virtual void _SetDirty(BOOL fDirty);
  107. virtual void _SetFontMetrics();
  108. virtual int _GetBitmap(int iCommandID, PIBDATA pibdata, BOOL fUseCache);
  109. virtual HWND GetHWNDForUIObject();
  110. virtual HWND CreateWorkerWindow();
  111. static void s_IconCallback(LPVOID pvData, UINT uId, UINT iIconIndex);
  112. void _AddChevron();
  113. void _RemoveChevron();
  114. void _RefreshInfo();
  115. void BroadcastIntelliMenuState(LPCITEMIDLIST pidlItem, BOOL fPromoted);
  116. BOOL _ReBindToFolder(LPCITEMIDLIST pidl);
  117. virtual HRESULT _LoadOrderStream();
  118. virtual HRESULT _SaveOrderStream();
  119. virtual HRESULT _AfterLoad();
  120. HRESULT _GetInfo(LPCITEMIDLIST pidl, SMINFO* pmbiinfo);
  121. HRESULT CallCB(LPCITEMIDLIST pidl, DWORD dwMsg, WPARAM wParam, LPARAM lParam);
  122. HKEY _GetKey(LPCITEMIDLIST pidl);
  123. void _MarkItem(int idCmd);
  124. LRESULT _OnGetObject(NMOBJECTNOTIFY*);
  125. void _FindMinPromotedItems(BOOL fSetOrderStream);
  126. virtual LRESULT _OnDropDown(LPNMTOOLBAR pnmtb);
  127. virtual HRESULT v_CreateTrackPopup(int, REFIID, void**)
  128. { AssertMsg(0, TEXT("MenuSF trying to get a TrackPopup")); return E_FAIL; };
  129. virtual PIBDATA _CreateItemData(PORDERITEM poi);
  130. // Member Variables
  131. HKEY _hKey;
  132. BITBOOL _fPreventToolbarChange: 1;
  133. IAugmentedShellFolder2* _pasf2;
  134. int _iDefaultIconIndex;
  135. int _cMinPromotedItems;
  136. };
  137. #define MNFOLDER_NORODER -5 // Some random negative number to denote there is no order
  138. #define MNFOLDER_IS_PARENT -1 // -1 is passed to the child as uIdParent so that
  139. // it knows it's not rooted at a static menu
  140. #endif // MENUSF