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.

106 lines
3.7 KiB

  1. #ifndef __CONTROL_ITEM__
  2. #define __CONTROL_ITEM__
  3. #include "folder.h"
  4. #include "cdlbsc.hpp"
  5. class CControlItem : public IDataObject,
  6. public IExtractIcon,
  7. public IContextMenu
  8. {
  9. // CControlItem interfaces
  10. friend HRESULT ControlFolderView_DidDragDrop(
  11. HWND hwnd,
  12. IDataObject *pdo,
  13. DWORD dwEffect);
  14. public:
  15. CControlItem();
  16. HRESULT Initialize(
  17. CControlFolder *pCFolder,
  18. UINT cidl,
  19. LPCITEMIDLIST *ppidl);
  20. // IUnknown Methods
  21. STDMETHODIMP QueryInterface(REFIID,void **);
  22. STDMETHODIMP_(ULONG) AddRef(void);
  23. STDMETHODIMP_(ULONG) Release(void);
  24. // IContextMenu Methods
  25. STDMETHODIMP QueryContextMenu(
  26. HMENU hmenu,
  27. UINT indexMenu,
  28. UINT idCmdFirst,
  29. UINT idCmdLast,
  30. UINT uFlags);
  31. STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpici);
  32. STDMETHODIMP GetCommandString(
  33. UINT_PTR idCmd,
  34. UINT uType,
  35. UINT *pwReserved,
  36. LPTSTR pszName,
  37. UINT cchMax);
  38. // IDataObject Methods...
  39. STDMETHODIMP GetData(LPFORMATETC pFEIn, LPSTGMEDIUM pSTM);
  40. STDMETHODIMP GetDataHere(LPFORMATETC pFE, LPSTGMEDIUM pSTM);
  41. STDMETHODIMP QueryGetData(LPFORMATETC pFE);
  42. STDMETHODIMP GetCanonicalFormatEtc(LPFORMATETC pFEIn, LPFORMATETC pFEOut);
  43. STDMETHODIMP SetData(LPFORMATETC pFE, LPSTGMEDIUM pSTM, BOOL fRelease);
  44. STDMETHODIMP EnumFormatEtc(DWORD dwDirection, LPENUMFORMATETC *ppEnum);
  45. STDMETHODIMP DAdvise(LPFORMATETC pFE, DWORD grfAdv, LPADVISESINK pAdvSink,
  46. LPDWORD pdwConnection);
  47. STDMETHODIMP DUnadvise(DWORD dwConnection);
  48. STDMETHODIMP EnumDAdvise(LPENUMSTATDATA *ppEnum);
  49. // IDataObject helper functions
  50. HRESULT CreatePrefDropEffect(STGMEDIUM *pSTM);
  51. HRESULT Remove(HWND hwnd);
  52. /*
  53. HRESULT _CreateHDROP(STGMEDIUM *pmedium);
  54. HRESULT _CreateNameMap(STGMEDIUM *pmedium);
  55. HRESULT _CreateFileDescriptor(STGMEDIUM *pSTM);
  56. HRESULT _CreateFileContents(STGMEDIUM *pSTM, LONG lindex);
  57. HRESULT _CreateURL(STGMEDIUM *pSTM);
  58. HRESULT _CreatePrefDropEffect(STGMEDIUM *pSTM);
  59. */
  60. // IExtractIcon Methods
  61. STDMETHODIMP GetIconLocation(
  62. UINT uFlags,
  63. LPSTR szIconFile,
  64. UINT cchMax,
  65. int *piIndex,
  66. UINT *pwFlags);
  67. STDMETHODIMP Extract(
  68. LPCSTR pszFile,
  69. UINT nIconIndex,
  70. HICON *phiconLarge,
  71. HICON *phiconSmall,
  72. UINT nIconSize);
  73. // Support for our progress UI
  74. static INT_PTR DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  75. // Misc helper function
  76. static BOOL IsGlobalOffline();
  77. protected:
  78. ~CControlItem();
  79. HRESULT Update(LPCMINVOKECOMMANDINFO pici, LPCONTROLPIDL pcpidl);
  80. UINT m_cRef; // reference count
  81. UINT m_cItems; // number of items we represent
  82. CControlFolder* m_pCFolder; // back pointer to our shell folder
  83. LPCONTROLPIDL* m_ppcei; // variable size array of items
  84. LPCMINVOKECOMMANDINFO m_piciUpdate;
  85. LPCONTROLPIDL m_pcpidlUpdate;
  86. CodeDownloadBSC *m_pcdlbsc;
  87. };
  88. #endif