1 /* 2 * PROJECT: shell32 3 * LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+) 4 * PURPOSE: FolderItem(s) implementation 5 * COPYRIGHT: Copyright 2015-2018 Mark Jansen (mark.jansen@reactos.org) 6 */ 7 8 #ifndef _FOLDERITEM_H_ 9 #define _FOLDERITEM_H_ 10 11 12 class CFolderItem: 13 public CComCoClass<CFolderItem>, 14 public CComObjectRootEx<CComMultiThreadModelNoCS>, 15 public IDispatchImpl<FolderItem, &IID_FolderItem> 16 { 17 private: 18 CComHeapPtr<ITEMIDLIST> m_idlist; 19 CComPtr<Folder> m_Folder; 20 21 public: 22 CFolderItem(); 23 ~CFolderItem(); 24 25 HRESULT Initialize(Folder* folder, LPITEMIDLIST idlist); 26 27 // *** FolderItem methods *** 28 STDMETHOD(get_Application)(IDispatch **ppid) override; 29 STDMETHOD(get_Parent)(IDispatch **ppid) override; 30 STDMETHOD(get_Name)(BSTR *pbs) override; 31 STDMETHOD(put_Name)(BSTR bs) override; 32 STDMETHOD(get_Path)(BSTR *pbs) override; 33 STDMETHOD(get_GetLink)(IDispatch **ppid) override; 34 STDMETHOD(get_GetFolder)(IDispatch **ppid) override; 35 STDMETHOD(get_IsLink)(VARIANT_BOOL *pb) override; 36 STDMETHOD(get_IsFolder)(VARIANT_BOOL *pb) override; 37 STDMETHOD(get_IsFileSystem)(VARIANT_BOOL *pb) override; 38 STDMETHOD(get_IsBrowsable)(VARIANT_BOOL *pb) override; 39 STDMETHOD(get_ModifyDate)(DATE *pdt) override; 40 STDMETHOD(put_ModifyDate)(DATE dt) override; 41 STDMETHOD(get_Size)(LONG *pul) override; 42 STDMETHOD(get_Type)(BSTR *pbs) override; 43 STDMETHOD(Verbs)(FolderItemVerbs **ppfic) override; 44 STDMETHOD(InvokeVerb)(VARIANT vVerb) override; 45 46 47 DECLARE_NOT_AGGREGATABLE(CFolderItem) 48 DECLARE_PROTECT_FINAL_CONSTRUCT() 49 50 BEGIN_COM_MAP(CFolderItem) 51 COM_INTERFACE_ENTRY_IID(IID_FolderItem, FolderItem) 52 COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch) 53 END_COM_MAP() 54 }; 55 56 class CFolderItems: 57 public CComCoClass<CFolderItems>, 58 public CComObjectRootEx<CComMultiThreadModelNoCS>, 59 public IDispatchImpl<FolderItems, &IID_FolderItems> 60 { 61 private: 62 CComHeapPtr<ITEMIDLIST> m_idlist; 63 CComPtr<IEnumIDList> m_EnumIDList; 64 CComPtr<Folder> m_Folder; 65 long m_Count; 66 67 public: 68 CFolderItems(); 69 ~CFolderItems(); 70 71 // Please note: CFolderItems takes ownership of idlist. 72 HRESULT Initialize(LPITEMIDLIST idlist, Folder* parent); 73 74 // *** FolderItems methods *** 75 STDMETHOD(get_Count)(long *plCount) override; 76 STDMETHOD(get_Application)(IDispatch **ppid) override; 77 STDMETHOD(get_Parent)(IDispatch **ppid) override; 78 STDMETHOD(Item)(VARIANT index, FolderItem **ppid) override; 79 STDMETHOD(_NewEnum)(IUnknown **ppunk) override; 80 81 DECLARE_NOT_AGGREGATABLE(CFolderItems) 82 DECLARE_PROTECT_FINAL_CONSTRUCT() 83 84 BEGIN_COM_MAP(CFolderItems) 85 COM_INTERFACE_ENTRY_IID(IID_FolderItems, FolderItems) 86 COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch) 87 END_COM_MAP() 88 }; 89 90 #endif 91