[SHELL32]
[reactos.git] / reactos / dll / win32 / shell32 / folders / desktop.h
1 /*
2 * Virtual Desktop 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 _CDESKTOPFOLDER_H_
24 #define _CDESKTOPFOLDER_H_
25
26 class CDesktopFolder :
27 public CComCoClass<CDesktopFolder, &CLSID_ShellDesktop>,
28 public CComObjectRootEx<CComMultiThreadModelNoCS>,
29 public IShellFolder2,
30 public IPersistFolder2,
31 public IDropTarget,
32 public ISFHelper
33 {
34 private:
35 /* both paths are parsible from the desktop */
36 LPWSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */
37 LPITEMIDLIST pidlRoot; /* absolute pidl */
38
39 UINT cfShellIDList; /* clipboardformat for IDropTarget */
40 BOOL fAcceptFmt; /* flag for pending Drop */
41 BOOL QueryDrop (DWORD dwKeyState, LPDWORD pdwEffect);
42 void SF_RegisterClipFmt();
43
44 public:
45 CDesktopFolder();
46 ~CDesktopFolder();
47 HRESULT WINAPI FinalConstruct();
48
49 // *** IShellFolder methods ***
50 virtual HRESULT WINAPI ParseDisplayName (HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, LPITEMIDLIST *ppidl, DWORD *pdwAttributes);
51 virtual HRESULT WINAPI EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList);
52 virtual HRESULT WINAPI BindToObject(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
53 virtual HRESULT WINAPI BindToStorage(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
54 virtual HRESULT WINAPI CompareIDs(LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
55 virtual HRESULT WINAPI CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut);
56 virtual HRESULT WINAPI GetAttributesOf (UINT cidl, LPCITEMIDLIST *apidl, DWORD *rgfInOut);
57 virtual HRESULT WINAPI GetUIObjectOf(HWND hwndOwner, UINT cidl, LPCITEMIDLIST *apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut);
58 virtual HRESULT WINAPI GetDisplayNameOf(LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet);
59 virtual HRESULT WINAPI SetNameOf(HWND hwndOwner, LPCITEMIDLIST pidl, LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST *pPidlOut);
60
61 // *** IShellFolder2 methods ***
62 virtual HRESULT WINAPI GetDefaultSearchGUID(GUID *pguid);
63 virtual HRESULT WINAPI EnumSearches(IEnumExtraSearch **ppenum);
64 virtual HRESULT WINAPI GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay);
65 virtual HRESULT WINAPI GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags);
66 virtual HRESULT WINAPI GetDetailsEx(LPCITEMIDLIST pidl, const SHCOLUMNID *pscid, VARIANT *pv);
67 virtual HRESULT WINAPI GetDetailsOf(LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS *psd);
68 virtual HRESULT WINAPI MapColumnToSCID(UINT column, SHCOLUMNID *pscid);
69
70 // *** IPersist methods ***
71 virtual HRESULT WINAPI GetClassID(CLSID *lpClassId);
72
73 // *** IPersistFolder methods ***
74 virtual HRESULT WINAPI Initialize(LPCITEMIDLIST pidl);
75
76 // *** IPersistFolder2 methods ***
77 virtual HRESULT WINAPI GetCurFolder(LPITEMIDLIST * pidl);
78
79 // IDropTarget
80 virtual HRESULT WINAPI DragEnter(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
81 virtual HRESULT WINAPI DragOver(DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
82 virtual HRESULT WINAPI DragLeave();
83 virtual HRESULT WINAPI Drop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
84
85
86 // *** ISFHelper methods ***
87 virtual HRESULT WINAPI GetUniqueName(LPWSTR pwszName, UINT uLen);
88 virtual HRESULT WINAPI AddFolder(HWND hwnd, LPCWSTR pwszName, LPITEMIDLIST *ppidlOut);
89 virtual HRESULT WINAPI DeleteItems(UINT cidl, LPCITEMIDLIST *apidl);
90 virtual HRESULT WINAPI CopyItems(IShellFolder *pSFFrom, UINT cidl, LPCITEMIDLIST *apidl, bool bCopy);
91
92 DECLARE_REGISTRY_RESOURCEID(IDR_SHELLDESKTOP)
93 DECLARE_NOT_AGGREGATABLE(CDesktopFolder)
94
95 DECLARE_PROTECT_FINAL_CONSTRUCT()
96
97 BEGIN_COM_MAP(CDesktopFolder)
98 COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
99 COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
100 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
101 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
102 COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
103 COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
104 COM_INTERFACE_ENTRY_IID(IID_ISFHelper, ISFHelper)
105 END_COM_MAP()
106 };
107
108 #endif // _CDESKTOPFOLDER_H_