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.

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