[SHELLFIND] Set status bar text after opening search results folder
[reactos.git] / dll / win32 / browseui / shellfind / CSearchBar.h
1 /*
2 * ReactOS Explorer
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19 #pragma once
20
21 #include "shellfind.h"
22
23 class CSearchBar :
24 public CComCoClass<CSearchBar, &CLSID_FileSearchBand>,
25 public CComObjectRootEx<CComMultiThreadModelNoCS>,
26 public IDeskBand,
27 public IObjectWithSite,
28 public IInputObject,
29 public IPersistStream,
30 public IOleCommandTarget,
31 public IServiceProvider,
32 public IBandNavigate,
33 public IWinEventHandler,
34 public INamespaceProxy,
35 public IDispatch,
36 public CWindowImpl<CSearchBar>
37 {
38
39 private:
40 // *** BaseBarSite information ***
41 CComPtr<IUnknown> pSite;
42 BOOL fVisible;
43 BOOL bFocused;
44
45 void InitializeSearchBar();
46 HRESULT GetSearchResultsFolder(IShellBrowser **ppShellBrowser, HWND *pHwnd, IShellFolder **ppShellFolder);
47 HRESULT ExecuteCommand(CComPtr<IContextMenu>& menu, UINT nCmd);
48
49 // *** ATL event handlers ***
50 LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
51 LRESULT OnSearchButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
52 LRESULT OnClicked(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
53
54 public:
55 CSearchBar();
56 virtual ~CSearchBar();
57
58 // *** IOleWindow methods ***
59 virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
60 virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
61
62 // *** IDockingWindow methods ***
63 virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved);
64 virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved);
65 virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow);
66
67 // *** IDeskBand methods ***
68 virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi);
69
70 // *** IObjectWithSite methods ***
71 virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
72 virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite);
73
74 // *** IOleCommandTarget methods ***
75 virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText);
76 virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
77
78 // *** IServiceProvider methods ***
79 virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
80
81 // *** IInputObject methods ***
82 virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
83 virtual HRESULT STDMETHODCALLTYPE HasFocusIO();
84 virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
85
86 // *** IPersist methods ***
87 virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
88
89 // *** IPersistStream methods ***
90 virtual HRESULT STDMETHODCALLTYPE IsDirty();
91 virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
92 virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
93 virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
94
95 // *** IWinEventHandler methods ***
96 virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
97 virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd);
98
99 // *** IBandNavigate methods ***
100 virtual HRESULT STDMETHODCALLTYPE Select(long paramC);
101
102 // *** INamespaceProxy ***
103 virtual HRESULT STDMETHODCALLTYPE GetNavigateTarget(long paramC, long param10, long param14);
104 virtual HRESULT STDMETHODCALLTYPE Invoke(long paramC);
105 virtual HRESULT STDMETHODCALLTYPE OnSelectionChanged(long paramC);
106 virtual HRESULT STDMETHODCALLTYPE RefreshFlags(long paramC, long param10, long param14);
107 virtual HRESULT STDMETHODCALLTYPE CacheItem(long paramC);
108
109 // *** IDispatch methods ***
110 virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo);
111 virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
112 virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
113 virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
114
115 DECLARE_REGISTRY_RESOURCEID(IDR_EXPLORERBAND)
116 DECLARE_NOT_AGGREGATABLE(CSearchBar)
117
118 DECLARE_PROTECT_FINAL_CONSTRUCT()
119
120 BEGIN_COM_MAP(CSearchBar)
121 COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
122 COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
123 COM_INTERFACE_ENTRY_IID(IID_IBandNavigate, IBandNavigate)
124 COM_INTERFACE_ENTRY_IID(IID_INamespaceProxy, INamespaceProxy)
125 COM_INTERFACE_ENTRY2_IID(IID_IOleWindow, IOleWindow, IDeskBand)
126 COM_INTERFACE_ENTRY2_IID(IID_IDockingWindow, IDockingWindow, IDeskBand)
127 COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
128 COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
129 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
130 COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
131 COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
132 COM_INTERFACE_ENTRY2_IID(IID_IPersist, IPersist, IPersistStream)
133 COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
134 END_COM_MAP()
135
136 DECLARE_WND_CLASS_EX(_T("SrchCompExplorerBar"), 0, COLOR_WINDOW)
137
138 BEGIN_MSG_MAP(CSearchBar)
139 MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
140 COMMAND_CODE_HANDLER(BN_CLICKED, OnSearchButtonClicked)
141 MESSAGE_HANDLER(WM_LBUTTONDOWN, OnClicked)
142 END_MSG_MAP()
143 };