0613a317ab849e550facf4b3c4b775f5c05f0e40
[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 HWND m_fileName;
45 HWND m_query;
46 HWND m_path;
47
48 void InitializeSearchBar();
49 HRESULT GetSearchResultsFolder(IShellBrowser **ppShellBrowser, HWND *pHwnd, IShellFolder **ppShellFolder);
50 HRESULT ExecuteCommand(CComPtr<IContextMenu>& menu, UINT nCmd);
51
52 // *** ATL event handlers ***
53 LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
54 LRESULT OnSearchButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
55 LRESULT OnClicked(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
56
57 public:
58 CSearchBar();
59 virtual ~CSearchBar();
60
61 // *** IOleWindow methods ***
62 virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
63 virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
64
65 // *** IDockingWindow methods ***
66 virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved);
67 virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved);
68 virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow);
69
70 // *** IDeskBand methods ***
71 virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi);
72
73 // *** IObjectWithSite methods ***
74 virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
75 virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite);
76
77 // *** IOleCommandTarget methods ***
78 virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText);
79 virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
80
81 // *** IServiceProvider methods ***
82 virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
83
84 // *** IInputObject methods ***
85 virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
86 virtual HRESULT STDMETHODCALLTYPE HasFocusIO();
87 virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
88
89 // *** IPersist methods ***
90 virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
91
92 // *** IPersistStream methods ***
93 virtual HRESULT STDMETHODCALLTYPE IsDirty();
94 virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
95 virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
96 virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
97
98 // *** IWinEventHandler methods ***
99 virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
100 virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd);
101
102 // *** IBandNavigate methods ***
103 virtual HRESULT STDMETHODCALLTYPE Select(long paramC);
104
105 // *** INamespaceProxy ***
106 virtual HRESULT STDMETHODCALLTYPE GetNavigateTarget(long paramC, long param10, long param14);
107 virtual HRESULT STDMETHODCALLTYPE Invoke(long paramC);
108 virtual HRESULT STDMETHODCALLTYPE OnSelectionChanged(long paramC);
109 virtual HRESULT STDMETHODCALLTYPE RefreshFlags(long paramC, long param10, long param14);
110 virtual HRESULT STDMETHODCALLTYPE CacheItem(long paramC);
111
112 // *** IDispatch methods ***
113 virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo);
114 virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
115 virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
116 virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
117
118 DECLARE_REGISTRY_RESOURCEID(IDR_EXPLORERBAND)
119 DECLARE_NOT_AGGREGATABLE(CSearchBar)
120
121 DECLARE_PROTECT_FINAL_CONSTRUCT()
122
123 BEGIN_COM_MAP(CSearchBar)
124 COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
125 COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
126 COM_INTERFACE_ENTRY_IID(IID_IBandNavigate, IBandNavigate)
127 COM_INTERFACE_ENTRY_IID(IID_INamespaceProxy, INamespaceProxy)
128 COM_INTERFACE_ENTRY2_IID(IID_IOleWindow, IOleWindow, IDeskBand)
129 COM_INTERFACE_ENTRY2_IID(IID_IDockingWindow, IDockingWindow, IDeskBand)
130 COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
131 COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
132 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
133 COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
134 COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
135 COM_INTERFACE_ENTRY2_IID(IID_IPersist, IPersist, IPersistStream)
136 COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
137 END_COM_MAP()
138
139 DECLARE_WND_CLASS_EX(_T("SrchCompExplorerBar"), 0, COLOR_WINDOW)
140
141 BEGIN_MSG_MAP(CSearchBar)
142 MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
143 COMMAND_CODE_HANDLER(BN_CLICKED, OnSearchButtonClicked)
144 MESSAGE_HANDLER(WM_LBUTTONDOWN, OnClicked)
145 END_MSG_MAP()
146 };