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