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