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