[SHELLFIND] Add search functionality
[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 IContextMenuCB
16 {
17 // *** IShellFolder2 methods ***
18 STDMETHODIMP GetDefaultSearchGUID(GUID *pguid);
19
20 STDMETHODIMP EnumSearches(IEnumExtraSearch **ppenum);
21
22 STDMETHODIMP GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay);
23
24 STDMETHODIMP GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags);
25
26 STDMETHODIMP GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv);
27
28 STDMETHODIMP GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *pDetails);
29
30 STDMETHODIMP MapColumnToSCID(UINT iColumn, SHCOLUMNID *pscid);
31
32
33 // *** IShellFolder methods ***
34 STDMETHODIMP ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, ULONG *pchEaten,
35 PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes);
36
37 STDMETHODIMP EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList);
38
39 STDMETHODIMP BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
40
41 STDMETHODIMP BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
42
43 STDMETHODIMP CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2);
44
45 STDMETHODIMP CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut);
46
47 STDMETHODIMP GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut);
48
49 STDMETHODIMP GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut,
50 LPVOID *ppvOut);
51
52
53 STDMETHODIMP GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET pName);
54 STDMETHODIMP SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags,
55 PITEMID_CHILD *pPidlOut);
56
57 //// *** IShellFolderViewCB methods ***
58 STDMETHODIMP MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam);
59
60 //// *** IContextMenuCB method ***
61 STDMETHODIMP CallBack(IShellFolder *psf, HWND hwndOwner, IDataObject *pdtobj, UINT uMsg, WPARAM wParam,
62 LPARAM lParam);
63
64 private:
65 LPITEMIDLIST m_pidl;
66 CComPtr<IShellFolder2> m_pisfInner;
67 CComPtr<IShellFolderView> m_shellFolderView;
68 CComPtr<IShellBrowser> m_shellBrowser;
69 HANDLE m_hStopEvent;
70
71 //// *** IPersistFolder2 methods ***
72 STDMETHODIMP GetCurFolder(LPITEMIDLIST *pidl);
73
74
75 // *** IPersistFolder methods ***
76 STDMETHODIMP Initialize(LPCITEMIDLIST pidl);
77
78
79 // *** IPersist methods ***
80 STDMETHODIMP GetClassID(CLSID *pClassId);
81
82 // *** Message handlers ***
83 LRESULT StartSearch(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
84
85 LRESULT AddResult(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
86
87 LRESULT UpdateStatus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
88
89 public:
90 CFindFolder();
91
92 DECLARE_REGISTRY_RESOURCEID(IDR_FINDFOLDER)
93
94 DECLARE_NOT_AGGREGATABLE(CFindFolder)
95
96 DECLARE_PROTECT_FINAL_CONSTRUCT()
97
98 BEGIN_MSG_MAP(CFindFolder)
99 MESSAGE_HANDLER(WM_SEARCH_START, StartSearch)
100 MESSAGE_HANDLER(WM_SEARCH_ADD_RESULT, AddResult)
101 MESSAGE_HANDLER(WM_SEARCH_UPDATE_STATUS, UpdateStatus)
102 END_MSG_MAP()
103
104 BEGIN_COM_MAP(CFindFolder)
105 COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
106 COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
107 COM_INTERFACE_ENTRY_IID(IID_IShellFolderViewCB, IShellFolderViewCB)
108 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
109 COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
110 COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
111 COM_INTERFACE_ENTRY_IID(IID_IContextMenuCB, IContextMenuCB)
112 END_COM_MAP()
113 };
114