ReactOS  0.4.15-dev-425-gc40b086
CSearchBar.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Search Shell Extension
3  * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE: Search UI
5  * COPYRIGHT: Copyright 2019 Brock Mammen
6  */
7 
8 #pragma once
9 
10 #include "shellfind.h"
11 
12 class CSearchBar :
13  public CComCoClass<CSearchBar, &CLSID_FileSearchBand>,
14  public CComObjectRootEx<CComMultiThreadModelNoCS>,
15  public IDeskBand,
16  public IObjectWithSite,
17  public IInputObject,
18  public IPersistStream,
19  public IDispatch,
20  public CDialogImpl<CSearchBar>
21 {
22 
23 private:
24  // *** BaseBarSite information ***
28 
29  HRESULT GetSearchResultsFolder(IShellBrowser **ppShellBrowser, HWND *pHwnd, IShellFolder **ppShellFolder);
31  void SetSearchInProgress(BOOL bInProgress);
33 
34  // *** ATL event handlers ***
36  LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
37  LRESULT OnSearchButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
38  LRESULT OnStopButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
39  LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
40 
41 public:
42  CSearchBar();
43  virtual ~CSearchBar();
44 
45  // *** IOleWindow methods ***
46  virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
48 
49  // *** IDockingWindow methods ***
51  virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved);
52  virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow);
53 
54  // *** IDeskBand methods ***
55  virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi);
56 
57  // *** IObjectWithSite methods ***
58  virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
59  virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite);
60 
61  // *** IInputObject methods ***
62  virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
65 
66  // *** IPersist methods ***
67  virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
68 
69  // *** IPersistStream methods ***
71  virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
72  virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
74 
75  // *** IDispatch methods ***
77  virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
78  virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
79  virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
80 
81  enum { IDD = IDD_SEARCH_DLG };
82 
85 
87 
90  COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents, IDispatch)
91  COM_INTERFACE_ENTRY_IID(DIID_DSearchCommandEvents, IDispatch)
94  COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
96  COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
99  END_COM_MAP()
100 
107  END_MSG_MAP()
108 };
DBIM_BKCOLOR struct tagDESKBANDINFO DESKBANDINFO
virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: CSearchBar.cpp:557
virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID)
Definition: CSearchBar.cpp:478
#define REFIID
Definition: guiddef.h:118
virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty)
Definition: CSearchBar.cpp:500
BOOL m_bVisible
Definition: CSearchBar.h:27
CComPtr< IAddressEditBox > m_AddressEditBox
Definition: CSearchBar.h:26
#define COMMAND_HANDLER(id, code, func)
Definition: atlwin.h:1826
REFIID riid
Definition: precomp.h:44
const GUID IID_IPersist
Definition: proxy.cpp:14
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CSearchBar.cpp:275
virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved)
Definition: CSearchBar.cpp:322
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:611
DWORD LCID
Definition: nls.h:13
UINT_PTR WPARAM
Definition: windef.h:207
static LPOLESTR
Definition: stg_prop.c:27
#define IDD_SEARCH_DLG
Definition: resource.h:160
WPARAM wParam
Definition: combotst.c:138
BOOL GetAddressEditBoxPath(WCHAR *szPath)
Definition: CSearchBar.cpp:248
#define IDR_EXPLORERBAND
Definition: resource.h:101
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDC_SEARCH_BUTTON
Definition: resource.h:164
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite)
Definition: CSearchBar.cpp:393
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT GetSearchResultsFolder(IShellBrowser **ppShellBrowser, HWND *pHwnd, IShellFolder **ppShellFolder)
Definition: CSearchBar.cpp:111
virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow)
Definition: CSearchBar.cpp:335
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg)
Definition: CSearchBar.cpp:462
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: CSearchBar.cpp:527
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_SIZE
Definition: winuser.h:1593
LONG HRESULT
Definition: typedefs.h:78
#define END_MSG_MAP()
Definition: atlwin.h:1799
CComPtr< IUnknown > m_pSite
Definition: CSearchBar.h:25
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
const IID IID_IObjectWithSite
unsigned short WORD
Definition: ntddk_ex.h:93
#define BN_CLICKED
Definition: winuser.h:1907
unsigned long DWORD
Definition: ntddk_ex.h:95
virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize)
Definition: CSearchBar.cpp:506
#define COM_INTERFACE_ENTRY2_IID(iid, x, x2)
Definition: atlcom.h:569
const GUID IID_IPersistStream
Definition: proxy.cpp:13
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd)
Definition: CSearchBar.cpp:306
const GUID IID_IDispatch
LRESULT OnSearchButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CSearchBar.cpp:158
#define DECLARE_REGISTRY_RESOURCEID(x)
Definition: atlcom.h:605
CSearchBar()
Definition: gui.cpp:724
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: CSearchBar.cpp:521
virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi)
Definition: CSearchBar.cpp:344
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:534
struct stdole::EXCEPINFO EXCEPINFO
static VARIANTARG static DISPID
Definition: ordinal.c:49
LPCWSTR szPath
Definition: env.c:35
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:561
virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm)
Definition: CSearchBar.cpp:494
LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CSearchBar.cpp:104
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg)
Definition: CSearchBar.cpp:441
void SetSearchInProgress(BOOL bInProgress)
Definition: CSearchBar.cpp:533
unsigned int UINT
Definition: ndis.h:50
HRESULT TrySubscribeToSearchEvents()
Definition: CSearchBar.cpp:542
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1780
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:639
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1808
struct stdole::DISPPARAMS DISPPARAMS
const GUID IID_IOleWindow
#define IDC_SEARCH_STOP_BUTTON
Definition: resource.h:165
#define END_COM_MAP()
Definition: atlcom.h:552
#define WM_SETFOCUS
Definition: winuser.h:1595
LONG_PTR LRESULT
Definition: windef.h:209
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode)
Definition: CSearchBar.cpp:314
virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
Definition: CSearchBar.cpp:329
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
virtual HRESULT STDMETHODCALLTYPE IsDirty()
Definition: CSearchBar.cpp:488
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CSearchBar.cpp:33
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo)
Definition: CSearchBar.cpp:515
virtual HRESULT STDMETHODCALLTYPE HasFocusIO()
Definition: CSearchBar.cpp:457
virtual ~CSearchBar()
Definition: CSearchBar.cpp:29
LRESULT OnStopButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CSearchBar.cpp:238
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite)
Definition: CSearchBar.cpp:431