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.

156 lines
5.4 KiB

  1. #ifndef _DUIINFO_
  2. #define _DUIINFO_
  3. #include "defviewp.h"
  4. #include "duiview.h"
  5. #include "prop.h"
  6. class CNameSpaceItemUIProperty
  7. {
  8. public:
  9. virtual ~CNameSpaceItemUIProperty();
  10. STDMETHODIMP GetPropertyDisplayName(SHCOLUMNID scid, WCHAR* pwszPropDisplayName, int cchPropDisplayName);
  11. STDMETHODIMP GetPropertyDisplayValue(SHCOLUMNID scid, WCHAR* pwszPropDisplayValue, int cchPropDisplayValue, PROPERTYUI_FORMAT_FLAGS flagsFormat);
  12. protected:
  13. HRESULT _GetPropertyUI(IPropertyUI** ppPropertyUI);
  14. void _SetParentAndItem(IShellFolder2 *psf, LPCITEMIDLIST pidl);
  15. private:
  16. CComPtr<IPropertyUI> m_spPropertyUI;
  17. IShellFolder2 *m_psf; // alias to current psf
  18. LPCITEMIDLIST m_pidl; // alias to current relative pidl
  19. };
  20. class CNameSpaceItemInfoList : public Element, public CNameSpaceItemUIProperty
  21. {
  22. public:
  23. // ClassInfo accessors (static and virtual instance-based)
  24. static IClassInfo* Class;
  25. virtual IClassInfo* GetClassInfo() { return Class; }
  26. static HRESULT Register();
  27. static STDMETHODIMP Create(Element** ppElement) { return Create(NULL, NULL, NULL, ppElement); }
  28. static STDMETHODIMP Create(CDUIView* pDUIView, Value* pvDetailsSheet,IShellItemArray *psiItemArray,
  29. Element** ppElement);
  30. STDMETHODIMP Initialize(CDUIView* pDUIView, Value* pvDetailsSheet,IShellItemArray *psiItemArray);
  31. // Window procedure for catching the "info-extraction-done" message
  32. // from CDetailsSectionInfoTask::RunInitRT
  33. static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
  34. LPARAM lParam);
  35. private:
  36. HRESULT _AddMiniPreviewerToList(IShellFolder2 *psf, LPCITEMIDLIST pidl);
  37. HRESULT _OnMultiSelect(IShellFolder2 *psfRoot, LPIDA pida);
  38. CDUIView* m_pDUIView;
  39. };
  40. class CNameSpaceItemInfo : public Element
  41. {
  42. public:
  43. // ClassInfo accessors (static and virtual instance-based)
  44. static IClassInfo* Class;
  45. virtual IClassInfo* GetClassInfo() { return Class; }
  46. static HRESULT Register();
  47. static STDMETHODIMP Create(Element** ppElement) { return Create(L"", ppElement); }
  48. static STDMETHODIMP Create(WCHAR* pwszInfoString, Element** ppElement);
  49. STDMETHODIMP Initialize(WCHAR* pwszInfoString);
  50. };
  51. class CMiniPreviewer : public Element
  52. {
  53. public:
  54. ~CMiniPreviewer();
  55. // ClassInfo accessors (static and virtual instance-based)
  56. static IClassInfo* Class;
  57. virtual IClassInfo* GetClassInfo() { return Class; }
  58. static HRESULT Register();
  59. static STDMETHODIMP Create(Element** ppElement) { return Create(NULL, NULL, NULL, ppElement); }
  60. static STDMETHODIMP Create(CDUIView* pDUIView, IShellFolder2 *psf, LPCITEMIDLIST pidl, Element** ppElement);
  61. STDMETHODIMP Initialize(CDUIView* pDUIView, IShellFolder2 *psf, LPCITEMIDLIST pidl);
  62. // Window procedure for catching the "image-extraction-done" message
  63. // from m_pDUIView->m_spThumbnailExtractor2
  64. static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  65. protected:
  66. CDUIView* m_pDUIView;
  67. };
  68. class CBitmapElement : public Element
  69. {
  70. public:
  71. // ClassInfo accessors (static and virtual instance-based)
  72. static IClassInfo* Class;
  73. virtual IClassInfo* GetClassInfo() { return Class; }
  74. static HRESULT Register();
  75. static STDMETHODIMP Create(Element** ppElement) { return Create(NULL, ppElement); }
  76. static STDMETHODIMP Create(HBITMAP hBitmap, Element** ppElement);
  77. STDMETHODIMP Initialize(HBITMAP hBitmap);
  78. };
  79. typedef struct
  80. {
  81. SHCOLUMNID scid;
  82. BSTR bstrValue;
  83. BSTR bstrDisplayName;
  84. } DetailsInfo;
  85. // A wrapper class around a DetailsInfo array. See CDetailsSectionInfoTask for its use.
  86. class CDetailsInfoList
  87. {
  88. public:
  89. CDetailsInfoList();
  90. ~CDetailsInfoList();
  91. DetailsInfo _diProperty[20]; // A max of 20 properties allowed
  92. int _nProperties; // The count of properties
  93. };
  94. // Task used to extract the Details Section info in the background:
  95. // Given a pidl, this task extracts the display names and display values
  96. // of properties mentioned by SCID_WebViewDisplayProperties.
  97. // Once the extraction is done, it posts uMsg to hwndMsg
  98. // with lParam == pointer to an object of CDetailsInfoList
  99. // wParam == the ID of the info extraction, the results of which are in lParam
  100. class CDetailsSectionInfoTask : public CRunnableTask, public CNameSpaceItemUIProperty
  101. {
  102. public:
  103. CDetailsSectionInfoTask(HRESULT *phr, IShellFolder *psfContaining, LPCITEMIDLIST pidlAbsolute, HWND hwndMsg, UINT uMsg, DWORD dwDetailsInfoID);
  104. STDMETHODIMP RunInitRT();
  105. protected:
  106. ~CDetailsSectionInfoTask();
  107. // Helper functions
  108. HRESULT _GetDisplayedDetailsProperties(IShellFolder2 *psf, LPCITEMIDLIST pidl, WCHAR* pwszProperties, int cch);
  109. void _AugmentDisplayedDetailsProperties(LPWSTR pszDetailsProperties, size_t lenDetailsProperties);
  110. LPWSTR _SearchDisplayedDetailsProperties(LPWSTR pszDetailsProperties, size_t lenDetailsProperties, LPWSTR pszProperty, size_t lenProperty);
  111. IShellFolder * _psfContaining; // AddRef()'d
  112. LPITEMIDLIST _pidlAbsolute; // SHILClone()'d
  113. HWND _hwndMsg; // the window to post _uMsg to
  114. UINT _uMsg;
  115. DWORD _dwDetailsInfoID; // an ID to the current info extraction
  116. };
  117. #endif _DUIINFO_