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.

105 lines
4.5 KiB

  1. /*****************************************************************************
  2. * ftpcm.h
  3. *****************************************************************************/
  4. #ifndef _FTPCONTEXTMENU_H
  5. #define _FTPCONTEXTMENU_H
  6. #include "ftpdrop.h"
  7. typedef HRESULT (*INVOKEPROC)(CFtpMenu * pfcm, LPCMINVOKECOMMANDINFO pici, LPCTSTR pszCmd, LPCITEMIDLIST pidl);
  8. typedef struct { /* enum invoke info */
  9. CFtpMenu * pfcm;
  10. LPCMINVOKECOMMANDINFO pici;
  11. HRESULT hres;
  12. INVOKEPROC pfn;
  13. LPCTSTR ptszCmd;
  14. } EII, *PEII;
  15. /*****************************************************************************
  16. *
  17. * CFtpMenu
  18. *
  19. *
  20. *****************************************************************************/
  21. class CFtpMenu : public IContextMenu
  22. , public CObjectWithSite
  23. {
  24. public:
  25. //////////////////////////////////////////////////////
  26. // Public Interfaces
  27. //////////////////////////////////////////////////////
  28. // *** IUnknown ***
  29. virtual STDMETHODIMP_(ULONG) AddRef(void);
  30. virtual STDMETHODIMP_(ULONG) Release(void);
  31. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  32. // *** IContextMenu ***
  33. virtual STDMETHODIMP QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
  34. virtual STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpici);
  35. virtual STDMETHODIMP GetCommandString(UINT_PTR idCmd, UINT uType, UINT * pwReserved, LPSTR pszName, UINT cchMax);
  36. public:
  37. CFtpMenu();
  38. ~CFtpMenu(void);
  39. // Public Member Variables
  40. DWORD m_sfgao; // Shell attributes of objects
  41. CFtpPidlList * m_pflHfpl; // The list of items (pidls) that the context menu represents.
  42. CFtpFolder * m_pff; // CFtpFolder in which our pidls live
  43. CFtpDir * m_pfd; // FtpDir in which our pidls live
  44. HWND m_hwnd; // Owner window for UI
  45. POINT m_ptNewItem; // Points where the context menu was invoked. Used to later position a new folder.
  46. DWORD m_uFlags; // Flags used in ::QueryContextMenu() to determine if the menu was invoked by the file menu.
  47. BOOL m_fBackground; // Is this a forground or background context menu?
  48. // Friend Functions
  49. friend HRESULT CFtpMenu_Create(CFtpFolder * pff, CFtpPidlList * pflHfpl, HWND hwnd, REFIID riid, LPVOID * ppvObj);
  50. friend HRESULT CFtpMenu_Create(CFtpFolder * pff, CFtpPidlList * pflHfpl, HWND hwnd, CFtpMenu ** ppfm);
  51. static DWORD CALLBACK _DownloadDialogThreadProc(LPVOID pvThis) { return ((CFtpMenu *) pvThis)->_DownloadDialogThreadProc(); };
  52. protected:
  53. int m_cRef;
  54. LPTSTR m_pszDownloadDir; // Download Directory
  55. DWORD m_dwDownloadType; // Download Directory
  56. // Private Member Functions
  57. int _RemoveContextMenuItems(HMENU hmenu, UINT idCmdFirst, DWORD sfgao);
  58. int _InvokeOne(LPCITEMIDLIST pidl, PEII peii);
  59. HRESULT _InvokeDelete(LPCMINVOKECOMMANDINFO pici);
  60. HRESULT _InvokeRename(LPCMINVOKECOMMANDINFO pici);
  61. HRESULT _InvokeCutCopy(UINT_PTR id, LPCMINVOKECOMMANDINFO pici);
  62. HRESULT _DoDrop(IDropTarget * pdt, IDataObject * pdto);
  63. HRESULT _InvokePaste(LPCMINVOKECOMMANDINFO pici);
  64. HRESULT _InvokeDownloadVerb(LPCMINVOKECOMMANDINFO pici);
  65. HRESULT _InvokeDeleteVerb(LPCMINVOKECOMMANDINFO pici);
  66. HRESULT _InvokeLoginAsVerb(LPCMINVOKECOMMANDINFO pici);
  67. HRESULT _InvokeNewFolderVerb(LPCMINVOKECOMMANDINFO pici);
  68. HRESULT _AddToRecentDocs(LPCITEMIDLIST pidl);
  69. CStatusBar * _GetStatusBar(void);
  70. DWORD _DownloadDialogThreadProc(void);
  71. DWORD _DownloadThreadProc(void);
  72. BOOL _AreAllFolders(CFtpPidlList * pflHfpl);
  73. LPITEMIDLIST GetSoftLinkDestination(LPCITEMIDLIST pidlToSoftLink);
  74. static HRESULT _SoftLinkDestCB(HINTERNET hint, HINTPROCINFO * phpi, LPVOID pvsldcbs, BOOL * pfReleaseHint);
  75. static int _InvokeOneCB(LPVOID pvPidl, LPVOID pv);
  76. static HRESULT _ApplyOne(CFtpMenu * pfcm, LPCMINVOKECOMMANDINFO pici, LPCTSTR ptszCmd, LPCITEMIDLIST pidl);
  77. static DWORD CALLBACK DownloadThreadProc(LPVOID pvThis) { return ((CFtpMenu *) pvThis)->_DownloadThreadProc(); };
  78. STDMETHODIMP _EnumInvoke(LPCMINVOKECOMMANDINFO pici, INVOKEPROC pfn, LPCTSTR ptszCmd);
  79. private:
  80. BOOL _ContainsForgroundItems(void);
  81. BOOL _IsCallerCaptionBar(UINT indexMenu, UINT uFlags);
  82. };
  83. #endif // _FTPCONTEXTMENU_H