Sync to trunk r65566.
[reactos.git] / dll / win32 / shell32 / folders / CRecycleBin.h
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 DWORD WINAPI DoDeleteThreadProc(LPVOID lpParameter);
26 HRESULT WINAPI DoDeleteDataObject(IDataObject *pda);
27
28 BOOL TRASH_CanTrashFile(LPCWSTR wszPath);
29 BOOL TRASH_TrashFile(LPCWSTR wszPath);
30
31 class CRecycleBin :
32 public CComCoClass<CRecycleBin, &CLSID_RecycleBin>,
33 public CComObjectRootEx<CComMultiThreadModelNoCS>,
34 public IShellFolder2,
35 public IPersistFolder2,
36 public IContextMenu,
37 public IShellPropSheetExt,
38 public IDropTarget,
39 public IShellExtInit
40 {
41 private:
42 LPITEMIDLIST pidl;
43 INT iIdEmpty;
44 UINT cfShellIDList;
45 void SF_RegisterClipFmt();
46 BOOL fAcceptFmt; /* flag for pending Drop */
47 BOOL QueryDrop (DWORD dwKeyState, LPDWORD pdwEffect);
48
49 public:
50 CRecycleBin();
51 ~CRecycleBin();
52
53 // IPersistFolder
54 virtual HRESULT WINAPI GetClassID(CLSID *pClassID);
55 virtual HRESULT WINAPI Initialize(LPCITEMIDLIST pidl);
56
57 // IPersistFolder2
58 virtual HRESULT WINAPI GetCurFolder(LPITEMIDLIST * pidl);
59
60 // IShellFolder
61 virtual HRESULT WINAPI ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes);
62 virtual HRESULT WINAPI EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList);
63 virtual HRESULT WINAPI BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
64 virtual HRESULT WINAPI BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
65 virtual HRESULT WINAPI CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2);
66 virtual HRESULT WINAPI CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut);
67 virtual HRESULT WINAPI GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut);
68 virtual HRESULT WINAPI GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut);
69 virtual HRESULT WINAPI GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet);
70 virtual HRESULT WINAPI SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut);
71
72 // IShellFolder2
73 virtual HRESULT WINAPI GetDefaultSearchGUID(GUID *pguid);
74 virtual HRESULT WINAPI EnumSearches(IEnumExtraSearch **ppenum);
75 virtual HRESULT WINAPI GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay);
76 virtual HRESULT WINAPI GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags);
77 virtual HRESULT WINAPI GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv);
78 virtual HRESULT WINAPI GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd);
79 virtual HRESULT WINAPI MapColumnToSCID(UINT column, SHCOLUMNID *pscid);
80
81 // IContextMenu
82 virtual HRESULT WINAPI QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
83 virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi);
84 virtual HRESULT WINAPI GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen);
85
86 // IShellPropSheetExt
87 virtual HRESULT WINAPI AddPages(LPFNSVADDPROPSHEETPAGE pfnAddPage, LPARAM lParam);
88 virtual HRESULT WINAPI ReplacePage(EXPPS uPageID, LPFNSVADDPROPSHEETPAGE pfnReplaceWith, LPARAM lParam);
89
90 // IDropTarget
91 virtual HRESULT WINAPI DragEnter(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
92 virtual HRESULT WINAPI DragOver(DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
93 virtual HRESULT WINAPI DragLeave();
94 virtual HRESULT WINAPI Drop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
95
96 // IShellExtInit
97 virtual HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID);
98
99 DECLARE_REGISTRY_RESOURCEID(IDR_RECYCLEBIN)
100 DECLARE_NOT_AGGREGATABLE(CRecycleBin)
101
102 DECLARE_PROTECT_FINAL_CONSTRUCT()
103
104 BEGIN_COM_MAP(CRecycleBin)
105 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
106 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
107 COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
108 COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
109 COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
110 COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt, IShellPropSheetExt)
111 COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
112 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit)
113 END_COM_MAP()
114 };
115
116 #endif /* _SHFLDR_RECYCLEBIN_H_ */