fc88e353ff23064483b3f1bf7a22885fae951d54
[reactos.git] / reactos / dll / win32 / shell32 / folders / fs.h
1 /*
2 * file system folder
3 *
4 * Copyright 1997 Marcus Meissner
5 * Copyright 1998, 1999, 2002 Juergen Schmied
6 * Copyright 2009 Andrew Hill
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23 #ifndef _CFSFOLDER_H_
24 #define _CFSFOLDER_H_
25
26 WCHAR *BuildPathsList(LPCWSTR wszBasePath, int cidl, LPCITEMIDLIST *pidls);
27
28 class CFSFolder :
29 public CComCoClass<CFSFolder, &CLSID_ShellFSFolder>,
30 public CComObjectRootEx<CComMultiThreadModelNoCS>,
31 public IShellFolder2,
32 public IPersistFolder3,
33 public IDropTarget,
34 public ISFHelper
35 {
36 private:
37 CLSID *pclsid;
38
39 /* both paths are parsible from the desktop */
40 LPWSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */
41
42 LPITEMIDLIST pidlRoot; /* absolute pidl */
43
44 UINT cfShellIDList; /* clipboardformat for IDropTarget */
45 BOOL fAcceptFmt; /* flag for pending Drop */
46 public:
47 CFSFolder();
48 ~CFSFolder();
49 void SF_RegisterClipFmt();
50 BOOL QueryDrop (DWORD dwKeyState, LPDWORD pdwEffect);
51
52 // IShellFolder
53 virtual HRESULT WINAPI ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, LPITEMIDLIST *ppidl, DWORD *pdwAttributes);
54 virtual HRESULT WINAPI EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList);
55 virtual HRESULT WINAPI BindToObject(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
56 virtual HRESULT WINAPI BindToStorage(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
57 virtual HRESULT WINAPI CompareIDs(LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
58 virtual HRESULT WINAPI CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut);
59 virtual HRESULT WINAPI GetAttributesOf(UINT cidl, LPCITEMIDLIST *apidl, DWORD *rgfInOut);
60 virtual HRESULT WINAPI GetUIObjectOf(HWND hwndOwner, UINT cidl, LPCITEMIDLIST *apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut);
61 virtual HRESULT WINAPI GetDisplayNameOf(LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet);
62 virtual HRESULT WINAPI SetNameOf(HWND hwndOwner, LPCITEMIDLIST pidl, LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST *pPidlOut);
63
64 /* ShellFolder2 */
65 virtual HRESULT WINAPI GetDefaultSearchGUID(GUID *pguid);
66 virtual HRESULT WINAPI EnumSearches(IEnumExtraSearch **ppenum);
67 virtual HRESULT WINAPI GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay);
68 virtual HRESULT WINAPI GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags);
69 virtual HRESULT WINAPI GetDetailsEx(LPCITEMIDLIST pidl, const SHCOLUMNID *pscid, VARIANT *pv);
70 virtual HRESULT WINAPI GetDetailsOf(LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS *psd);
71 virtual HRESULT WINAPI MapColumnToSCID(UINT column, SHCOLUMNID *pscid);
72
73 // IPersist
74 virtual HRESULT WINAPI GetClassID(CLSID *lpClassId);
75
76 // IPersistFolder
77 virtual HRESULT WINAPI Initialize(LPCITEMIDLIST pidl);
78
79 // IPersistFolder2
80 virtual HRESULT WINAPI GetCurFolder(LPITEMIDLIST * pidl);
81
82 // IPersistFolder3
83 virtual HRESULT WINAPI InitializeEx(IBindCtx *pbc, LPCITEMIDLIST pidlRoot, const PERSIST_FOLDER_TARGET_INFO *ppfti);
84 virtual HRESULT WINAPI GetFolderTargetInfo(PERSIST_FOLDER_TARGET_INFO *ppfti);
85
86 // IDropTarget
87 virtual HRESULT WINAPI DragEnter(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
88 virtual HRESULT WINAPI DragOver(DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
89 virtual HRESULT WINAPI DragLeave();
90 virtual HRESULT WINAPI Drop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
91
92 // ISFHelper
93 virtual HRESULT WINAPI GetUniqueName(LPWSTR pwszName, UINT uLen);
94 virtual HRESULT WINAPI AddFolder(HWND hwnd, LPCWSTR pwszName, LPITEMIDLIST *ppidlOut);
95 virtual HRESULT WINAPI DeleteItems(UINT cidl, LPCITEMIDLIST *apidl);
96 virtual HRESULT WINAPI CopyItems(IShellFolder *pSFFrom, UINT cidl, LPCITEMIDLIST *apidl, bool bCopy);
97
98 DECLARE_REGISTRY_RESOURCEID(IDR_SHELLFSFOLDER)
99 DECLARE_NOT_AGGREGATABLE(CFSFolder)
100
101 DECLARE_PROTECT_FINAL_CONSTRUCT()
102
103 BEGIN_COM_MAP(CFSFolder)
104 COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
105 COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
106 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
107 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
108 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder3, IPersistFolder3)
109 COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
110 COM_INTERFACE_ENTRY_IID(IID_ISFHelper, ISFHelper)
111 END_COM_MAP()
112 };
113
114 #endif // _CFSFOLDER_H_