885e49b590d8235b6aa884992d0d525d66d31634
[reactos.git] / dll / win32 / browseui / shellfind / CFindFolder.h
1 #pragma once
2
3 #include "shellfind.h"
4
5 #define SWM_ADD_ITEM (WM_USER + 0)
6 #define SWM_UPDATE_STATUS (WM_USER + 1)
7
8 class CFindFolder :
9 public CWindowImpl<CFindFolder>,
10 public CComCoClass<CFindFolder, &CLSID_FindFolder>,
11 public CComObjectRootEx<CComMultiThreadModelNoCS>,
12 public IShellFolder2,
13 public IPersistFolder2,
14 public IShellFolderViewCB,
15 public IConnectionPointContainerImpl<CFindFolder>,
16 public IConnectionPointImpl<CFindFolder, &DIID_DSearchCommandEvents>,
17 public IContextMenuCB
18 {
19 // *** IShellFolder2 methods ***
20 STDMETHODIMP GetDefaultSearchGUID(GUID *pguid);
21
22 STDMETHODIMP EnumSearches(IEnumExtraSearch **ppenum);
23
24 STDMETHODIMP GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay);
25
26 STDMETHODIMP GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags);
27
28 STDMETHODIMP GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv);
29
30 STDMETHODIMP GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *pDetails);
31
32 STDMETHODIMP MapColumnToSCID(UINT iColumn, SHCOLUMNID *pscid);
33
34
35 // *** IShellFolder methods ***
36 STDMETHODIMP ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, ULONG *pchEaten,
37 PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes);
38
39 STDMETHODIMP EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList);
40
41 STDMETHODIMP BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
42
43 STDMETHODIMP BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
44
45 STDMETHODIMP CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2);
46
47 STDMETHODIMP CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut);
48
49 STDMETHODIMP GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut);
50
51 STDMETHODIMP GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut,
52 LPVOID *ppvOut);
53
54
55 STDMETHODIMP GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET pName);
56 STDMETHODIMP SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags,
57 PITEMID_CHILD *pPidlOut);
58
59 //// *** IShellFolderViewCB methods ***
60 STDMETHODIMP MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam);
61
62 //// *** IContextMenuCB method ***
63 STDMETHODIMP CallBack(IShellFolder *psf, HWND hwndOwner, IDataObject *pdtobj, UINT uMsg, WPARAM wParam,
64 LPARAM lParam);
65
66 private:
67 LPITEMIDLIST m_pidl;
68 CComPtr<IShellFolder2> m_pisfInner;
69 CComPtr<IShellFolderView> m_shellFolderView;
70 CComPtr<IShellBrowser> m_shellBrowser;
71 HANDLE m_hStopEvent;
72
73 void NotifyConnections(DISPID id);
74 static DWORD WINAPI SearchThreadProc(LPVOID lpParameter);
75
76 //// *** IPersistFolder2 methods ***
77 STDMETHODIMP GetCurFolder(LPITEMIDLIST *pidl);
78
79
80 // *** IPersistFolder methods ***
81 STDMETHODIMP Initialize(LPCITEMIDLIST pidl);
82
83
84 // *** IPersist methods ***
85 STDMETHODIMP GetClassID(CLSID *pClassId);
86
87 // *** Message handlers ***
88 LRESULT StartSearch(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
89
90 LRESULT AddResult(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
91
92 LRESULT UpdateStatus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
93
94 public:
95 CFindFolder();
96
97 DECLARE_REGISTRY_RESOURCEID(IDR_FINDFOLDER)
98
99 DECLARE_NOT_AGGREGATABLE(CFindFolder)
100
101 DECLARE_PROTECT_FINAL_CONSTRUCT()
102
103 BEGIN_CONNECTION_POINT_MAP(CFindFolder)
104 CONNECTION_POINT_ENTRY(DIID_DSearchCommandEvents)
105 END_CONNECTION_POINT_MAP()
106
107 BEGIN_MSG_MAP(CFindFolder)
108 MESSAGE_HANDLER(WM_SEARCH_START, StartSearch)
109 MESSAGE_HANDLER(WM_SEARCH_ADD_RESULT, AddResult)
110 MESSAGE_HANDLER(WM_SEARCH_UPDATE_STATUS, UpdateStatus)
111 END_MSG_MAP()
112
113 BEGIN_COM_MAP(CFindFolder)
114 COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
115 COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
116 COM_INTERFACE_ENTRY_IID(IID_IShellFolderViewCB, IShellFolderViewCB)
117 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
118 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
119 COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
120 COM_INTERFACE_ENTRY_IID(IID_IConnectionPointContainer, IConnectionPointContainer)
121 COM_INTERFACE_ENTRY_IID(IID_IContextMenuCB, IContextMenuCB)
122 END_COM_MAP()
123 };
124