reactos/dll/win32/browseui/shellfind/CSearchBar.h
2019-09-15 19:46:36 +03:00

109 lines
4.5 KiB
C++

/*
* PROJECT: ReactOS Search Shell Extension
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Search UI
* COPYRIGHT: Copyright 2019 Brock Mammen
*/
#pragma once
#include "shellfind.h"
class CSearchBar :
public CComCoClass<CSearchBar, &CLSID_FileSearchBand>,
public CComObjectRootEx<CComMultiThreadModelNoCS>,
public IDeskBand,
public IObjectWithSite,
public IInputObject,
public IPersistStream,
public IDispatch,
public CDialogImpl<CSearchBar>
{
private:
// *** BaseBarSite information ***
CComPtr<IUnknown> m_pSite;
CComPtr<IAddressEditBox> m_AddressEditBox;
BOOL m_bVisible;
HRESULT GetSearchResultsFolder(IShellBrowser **ppShellBrowser, HWND *pHwnd, IShellFolder **ppShellFolder);
BOOL GetAddressEditBoxPath(WCHAR *szPath);
void SetSearchInProgress(BOOL bInProgress);
HRESULT TrySubscribeToSearchEvents();
// *** ATL event handlers ***
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
LRESULT OnSearchButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
LRESULT OnStopButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
public:
CSearchBar();
virtual ~CSearchBar();
// *** IOleWindow methods ***
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
// *** IDockingWindow methods ***
virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved);
virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved);
virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow);
// *** IDeskBand methods ***
virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi);
// *** IObjectWithSite methods ***
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite);
// *** IInputObject methods ***
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
virtual HRESULT STDMETHODCALLTYPE HasFocusIO();
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
// *** IPersist methods ***
virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
// *** IPersistStream methods ***
virtual HRESULT STDMETHODCALLTYPE IsDirty();
virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
// *** IDispatch methods ***
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo);
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
enum { IDD = IDD_SEARCH_DLG };
DECLARE_REGISTRY_RESOURCEID(IDR_EXPLORERBAND)
DECLARE_NOT_AGGREGATABLE(CSearchBar)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CSearchBar)
COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents, IDispatch)
COM_INTERFACE_ENTRY_IID(DIID_DSearchCommandEvents, IDispatch)
COM_INTERFACE_ENTRY2_IID(IID_IOleWindow, IOleWindow, IDeskBand)
COM_INTERFACE_ENTRY2_IID(IID_IDockingWindow, IDockingWindow, IDeskBand)
COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
COM_INTERFACE_ENTRY2_IID(IID_IPersist, IPersist, IPersistStream)
COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
END_COM_MAP()
BEGIN_MSG_MAP(CSearchBar)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
MESSAGE_HANDLER(WM_SIZE, OnSize)
COMMAND_HANDLER(IDC_SEARCH_BUTTON, BN_CLICKED, OnSearchButtonClicked)
COMMAND_HANDLER(IDC_SEARCH_STOP_BUTTON, BN_CLICKED, OnStopButtonClicked)
END_MSG_MAP()
};