b4d8cc7b5f3e5dc6b2e15b0e373c0180f461d856
[reactos.git] / dll / win32 / shell32 / folders / cpanel.h
1 /*
2 * Control panel folder
3 *
4 * Copyright 2003 Martin Fuchs
5 * Copyright 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_CPANEL_H_
23 #define _SHFLDR_CPANEL_H_
24
25 class CControlPanelFolder :
26 public CComCoClass<CControlPanelFolder, &CLSID_ControlPanel>,
27 public CComObjectRootEx<CComMultiThreadModelNoCS>,
28 public IShellFolder2,
29 public IPersistFolder2,
30 public IShellExecuteHookA,
31 public IShellExecuteHookW,
32 public IContextMenu2
33 {
34 private:
35 /* both paths are parsible from the desktop */
36 LPITEMIDLIST pidlRoot; /* absolute pidl */
37 int dwAttributes; /* attributes returned by GetAttributesOf FIXME: use it */
38 LPCITEMIDLIST *apidl;
39 UINT cidl;
40
41 HRESULT WINAPI ExecuteFromIdList(LPCITEMIDLIST pidl);
42
43 public:
44 CControlPanelFolder();
45 ~CControlPanelFolder();
46 HRESULT WINAPI FinalConstruct();
47
48 // IShellFolder
49 virtual HRESULT WINAPI ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes);
50 virtual HRESULT WINAPI EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList);
51 virtual HRESULT WINAPI BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
52 virtual HRESULT WINAPI BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
53 virtual HRESULT WINAPI CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2);
54 virtual HRESULT WINAPI CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut);
55 virtual HRESULT WINAPI GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut);
56 virtual HRESULT WINAPI GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut);
57 virtual HRESULT WINAPI GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet);
58 virtual HRESULT WINAPI SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut);
59
60 /* ShellFolder2 */
61 virtual HRESULT WINAPI GetDefaultSearchGUID(GUID *pguid);
62 virtual HRESULT WINAPI EnumSearches(IEnumExtraSearch **ppenum);
63 virtual HRESULT WINAPI GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay);
64 virtual HRESULT WINAPI GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags);
65 virtual HRESULT WINAPI GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv);
66 virtual HRESULT WINAPI GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd);
67 virtual HRESULT WINAPI MapColumnToSCID(UINT column, SHCOLUMNID *pscid);
68
69 // IPersist
70 virtual HRESULT WINAPI GetClassID(CLSID *lpClassId);
71
72 // IPersistFolder
73 virtual HRESULT WINAPI Initialize(LPCITEMIDLIST pidl);
74
75 // IPersistFolder2
76 virtual HRESULT WINAPI GetCurFolder(LPITEMIDLIST * pidl);
77
78 // IShellExecuteHookW
79 virtual HRESULT WINAPI Execute(LPSHELLEXECUTEINFOW psei);
80
81 // IShellExecuteHookA
82 virtual HRESULT WINAPI Execute(LPSHELLEXECUTEINFOA psei);
83
84 // IContextMenu
85 virtual HRESULT WINAPI QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
86 virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi);
87 virtual HRESULT WINAPI GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen);
88
89 // IContextMenu2
90 virtual HRESULT WINAPI HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam);
91
92 DECLARE_REGISTRY_RESOURCEID(IDR_CONTROLPANEL)
93 DECLARE_NOT_AGGREGATABLE(CControlPanelFolder)
94
95 DECLARE_PROTECT_FINAL_CONSTRUCT()
96
97 BEGIN_COM_MAP(CControlPanelFolder)
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_IShellExecuteHookA, IShellExecuteHookA)
104 COM_INTERFACE_ENTRY_IID(IID_IShellExecuteHookW, IShellExecuteHookW)
105 COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
106 COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2)
107 END_COM_MAP()
108 };
109
110 #endif /* _SHFLDR_CPANEL_H_ */