1 /* 2 * Trash virtual folder support. The trashing engine is implemented in trash.c 3 * 4 * Copyright (C) 2006 Mikolaj Zalewski 5 * Copyright (C) 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 _SHFLDR_RECYCLEBIN_H_ 23 #define _SHFLDR_RECYCLEBIN_H_ 24 25 BOOL TRASH_CanTrashFile(LPCWSTR wszPath); 26 BOOL TRASH_TrashFile(LPCWSTR wszPath); 27 HRESULT CRecyclerDropTarget_CreateInstance(REFIID riid, LPVOID * ppvOut); 28 29 class CRecycleBin : 30 public CComCoClass<CRecycleBin, &CLSID_RecycleBin>, 31 public CComObjectRootEx<CComMultiThreadModelNoCS>, 32 public IShellFolder2, 33 public IPersistFolder2, 34 public IContextMenu, 35 public IShellPropSheetExt, 36 public IShellExtInit 37 { 38 private: 39 LPITEMIDLIST pidl; 40 INT iIdEmpty; 41 BOOL RecycleBinIsEmpty(); 42 43 public: 44 CRecycleBin(); 45 ~CRecycleBin(); 46 47 // IPersistFolder 48 STDMETHOD(GetClassID)(CLSID *pClassID) override; 49 STDMETHOD(Initialize)(PCIDLIST_ABSOLUTE pidl) override; 50 51 // IPersistFolder2 52 STDMETHOD(GetCurFolder)(PIDLIST_ABSOLUTE * pidl) override; 53 54 // IShellFolder 55 STDMETHOD(ParseDisplayName)(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes) override; 56 STDMETHOD(EnumObjects)(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override; 57 STDMETHOD(BindToObject)(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override; 58 STDMETHOD(BindToStorage)(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override; 59 STDMETHOD(CompareIDs)(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) override; 60 STDMETHOD(CreateViewObject)(HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override; 61 STDMETHOD(GetAttributesOf)(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override; 62 STDMETHOD(GetUIObjectOf)(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut) override; 63 STDMETHOD(GetDisplayNameOf)(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override; 64 STDMETHOD(SetNameOf)(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) override; 65 66 // IShellFolder2 67 STDMETHOD(GetDefaultSearchGUID)(GUID *pguid) override; 68 STDMETHOD(EnumSearches)(IEnumExtraSearch **ppenum) override; 69 STDMETHOD(GetDefaultColumn)(DWORD dwRes, ULONG *pSort, ULONG *pDisplay) override; 70 STDMETHOD(GetDefaultColumnState)(UINT iColumn, DWORD *pcsFlags) override; 71 STDMETHOD(GetDetailsEx)(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override; 72 STDMETHOD(GetDetailsOf)(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override; 73 STDMETHOD(MapColumnToSCID)(UINT column, SHCOLUMNID *pscid) override; 74 75 // IContextMenu 76 STDMETHOD(QueryContextMenu)(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override; 77 STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpcmi) override; 78 STDMETHOD(GetCommandString)(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override; 79 80 // IShellPropSheetExt 81 STDMETHOD(AddPages)(LPFNSVADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) override; 82 STDMETHOD(ReplacePage)(EXPPS uPageID, LPFNSVADDPROPSHEETPAGE pfnReplaceWith, LPARAM lParam) override; 83 84 // IShellExtInit 85 STDMETHOD(Initialize)(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) override; 86 87 DECLARE_REGISTRY_RESOURCEID(IDR_RECYCLEBIN) 88 DECLARE_NOT_AGGREGATABLE(CRecycleBin) 89 90 DECLARE_PROTECT_FINAL_CONSTRUCT() 91 92 BEGIN_COM_MAP(CRecycleBin) 93 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder) 94 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2) 95 COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder) 96 COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2) 97 COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) 98 COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt, IShellPropSheetExt) 99 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit) 100 END_COM_MAP() 101 }; 102 103 #endif /* _SHFLDR_RECYCLEBIN_H_ */ 104