1 /* 2 * IShellItem implementation 3 * 4 * Copyright 2008 Vincent Povirk for CodeWeavers 5 * Copyright 2009 Andrew Hill 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 20 */ 21 22 #ifndef _SHELLITEM_H_ 23 #define _SHELLITEM_H_ 24 25 class CShellItem : 26 public CComCoClass<CShellItem, &CLSID_ShellItem>, 27 public CComObjectRootEx<CComMultiThreadModelNoCS>, 28 public IShellItem, 29 public IPersistIDList 30 { 31 private: 32 LPITEMIDLIST m_pidl; 33 34 public: 35 CShellItem(); 36 ~CShellItem(); 37 HRESULT get_parent_pidl(LPITEMIDLIST *parent_pidl); 38 HRESULT get_parent_shellfolder(IShellFolder **ppsf); 39 HRESULT get_shellfolder(IBindCtx *pbc, REFIID riid, void **ppvOut); 40 41 // IShellItem 42 STDMETHOD(BindToHandler)(IBindCtx *pbc, REFGUID rbhid, REFIID riid, void **ppvOut) override; 43 STDMETHOD(GetParent)(IShellItem **ppsi) override; 44 STDMETHOD(GetDisplayName)(SIGDN sigdnName, LPWSTR *ppszName) override; 45 STDMETHOD(GetAttributes)(SFGAOF sfgaoMask, SFGAOF *psfgaoAttribs) override; 46 STDMETHOD(Compare)(IShellItem *oth, SICHINTF hint, int *piOrder) override; 47 48 // IPersistIDList 49 STDMETHOD(GetClassID)(CLSID *pClassID) override; 50 STDMETHOD(SetIDList)(PCIDLIST_ABSOLUTE pidl) override; 51 STDMETHOD(GetIDList)(PIDLIST_ABSOLUTE *ppidl) override; 52 53 DECLARE_NO_REGISTRY() 54 DECLARE_NOT_AGGREGATABLE(CShellItem) 55 56 DECLARE_PROTECT_FINAL_CONSTRUCT() 57 58 BEGIN_COM_MAP(CShellItem) 59 COM_INTERFACE_ENTRY_IID(IID_IShellItem, IShellItem) 60 COM_INTERFACE_ENTRY_IID(IID_IPersistIDList, IPersistIDList) 61 END_COM_MAP() 62 }; 63 64 #endif /* _SHELLITEM_H_ */ 65