[SHELL32]
[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 BOOL QueryDrop (DWORD dwKeyState, LPDWORD pdwEffect);
47 void SF_RegisterClipFmt();
48 BOOL GetUniqueFileName(LPWSTR pwszBasePath, LPCWSTR pwszExt, LPWSTR pwszTarget, BOOL bShortcut);
49 static DWORD WINAPI _DoDropThreadProc(LPVOID lpParameter);
50 virtual HRESULT WINAPI _DoDrop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
51
52 public:
53 CFSFolder();
54 ~CFSFolder();
55
56
57 // IShellFolder
58 virtual HRESULT WINAPI ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, LPITEMIDLIST *ppidl, DWORD *pdwAttributes);
59 virtual HRESULT WINAPI EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList);
60 virtual HRESULT WINAPI BindToObject(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
61 virtual HRESULT WINAPI BindToStorage(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
62 virtual HRESULT WINAPI CompareIDs(LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
63 virtual HRESULT WINAPI CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut);
64 virtual HRESULT WINAPI GetAttributesOf(UINT cidl, LPCITEMIDLIST *apidl, DWORD *rgfInOut);
65 virtual HRESULT WINAPI GetUIObjectOf(HWND hwndOwner, UINT cidl, LPCITEMIDLIST *apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut);
66 virtual HRESULT WINAPI GetDisplayNameOf(LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet);
67 virtual HRESULT WINAPI SetNameOf(HWND hwndOwner, LPCITEMIDLIST pidl, LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST *pPidlOut);
68
69 /* ShellFolder2 */
70 virtual HRESULT WINAPI GetDefaultSearchGUID(GUID *pguid);
71 virtual HRESULT WINAPI EnumSearches(IEnumExtraSearch **ppenum);
72 virtual HRESULT WINAPI GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay);
73 virtual HRESULT WINAPI GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags);
74 virtual HRESULT WINAPI GetDetailsEx(LPCITEMIDLIST pidl, const SHCOLUMNID *pscid, VARIANT *pv);
75 virtual HRESULT WINAPI GetDetailsOf(LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS *psd);
76 virtual HRESULT WINAPI MapColumnToSCID(UINT column, SHCOLUMNID *pscid);
77
78 // IPersist
79 virtual HRESULT WINAPI GetClassID(CLSID *lpClassId);
80
81 // IPersistFolder
82 virtual HRESULT WINAPI Initialize(LPCITEMIDLIST pidl);
83
84 // IPersistFolder2
85 virtual HRESULT WINAPI GetCurFolder(LPITEMIDLIST * pidl);
86
87 // IPersistFolder3
88 virtual HRESULT WINAPI InitializeEx(IBindCtx *pbc, LPCITEMIDLIST pidlRoot, const PERSIST_FOLDER_TARGET_INFO *ppfti);
89 virtual HRESULT WINAPI GetFolderTargetInfo(PERSIST_FOLDER_TARGET_INFO *ppfti);
90
91 // IDropTarget
92 virtual HRESULT WINAPI DragEnter(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
93 virtual HRESULT WINAPI DragOver(DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
94 virtual HRESULT WINAPI DragLeave();
95 virtual HRESULT WINAPI Drop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
96
97 // ISFHelper
98 virtual HRESULT WINAPI GetUniqueName(LPWSTR pwszName, UINT uLen);
99 virtual HRESULT WINAPI AddFolder(HWND hwnd, LPCWSTR pwszName, LPITEMIDLIST *ppidlOut);
100 virtual HRESULT WINAPI DeleteItems(UINT cidl, LPCITEMIDLIST *apidl);
101 virtual HRESULT WINAPI CopyItems(IShellFolder *pSFFrom, UINT cidl, LPCITEMIDLIST *apidl, bool bCopy);
102
103 DECLARE_REGISTRY_RESOURCEID(IDR_SHELLFSFOLDER)
104 DECLARE_NOT_AGGREGATABLE(CFSFolder)
105
106 DECLARE_PROTECT_FINAL_CONSTRUCT()
107
108 BEGIN_COM_MAP(CFSFolder)
109 COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
110 COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
111 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
112 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
113 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder3, IPersistFolder3)
114 COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
115 COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
116 COM_INTERFACE_ENTRY_IID(IID_ISFHelper, ISFHelper)
117 END_COM_MAP()
118 };
119
120 struct _DoDropData {
121 CFSFolder *This;
122 IDataObject *pDataObject;
123 IAsyncOperation *pAsyncOperation;
124 DWORD dwKeyState;
125 POINTL pt;
126 DWORD pdwEffect;
127 };
128
129 #endif /* _CFSFOLDER_H_ */