[SHELLFIND] Add CSearchBar
authorBrock Mammen <brockmammen@gmail.com>
Fri, 19 Jul 2019 02:15:01 +0000 (21:15 -0500)
committerGiannis Adamopoulos <gadamopoulos@reactos.org>
Sun, 15 Sep 2019 16:46:36 +0000 (19:46 +0300)
12 files changed:
dll/win32/browseui/CMakeLists.txt
dll/win32/browseui/browseui.cpp
dll/win32/browseui/browseui.h
dll/win32/browseui/browseui.rc
dll/win32/browseui/precomp.h
dll/win32/browseui/res/filesearchband.rgs [new file with mode: 0644]
dll/win32/browseui/resource.h
dll/win32/browseui/shellbrowser.cpp
dll/win32/browseui/shellfind/CMakeLists.txt [new file with mode: 0644]
dll/win32/browseui/shellfind/CSearchBar.cpp [new file with mode: 0644]
dll/win32/browseui/shellfind/CSearchBar.h [new file with mode: 0644]
dll/win32/browseui/shellfind/shellfind.h [new file with mode: 0644]

index 8b97950..d3787d2 100644 (file)
@@ -1,6 +1,7 @@
 PROJECT(SHELL)
 
 add_subdirectory(shellbars)
+add_subdirectory(shellfind)
 
 set_cpp(WITH_RUNTIME)
 
@@ -46,7 +47,7 @@ add_library(browseui MODULE
     ${CMAKE_CURRENT_BINARY_DIR}/browseui.def)
 
 set_module_type(browseui win32dll UNICODE)
-target_link_libraries(browseui shellbars uuid wine)
+target_link_libraries(browseui shellbars shellfind uuid wine)
 add_importlibs(browseui uxtheme shlwapi shell32 comctl32 gdi32 ole32 oleaut32 user32 advapi32 mpr msvcrt kernel32 ntdll)
 add_pch(browseui precomp.h SOURCE)
 add_cd_file(TARGET browseui DESTINATION reactos/system32 FOR all)
index 46272d4..d7aed77 100644 (file)
@@ -57,6 +57,15 @@ HRESULT CBrandBand_CreateInstance(REFIID riid, void **ppv)
 #endif
 }
 
+HRESULT CSearchBar_CreateInstance(REFIID riid, LPVOID *ppv)
+{
+#if USE_CUSTOM_SEARCHBAND
+    return ShellObjectCreator<CSearchBar>(riid, ppv);
+#else
+    return CoCreateInstance(CLSID_FileSearchBand, NULL, CLSCTX_INPROC_SERVER, riid, ppv);
+#endif
+}
+
 HRESULT CExplorerBand_CreateInstance(REFIID riid, LPVOID *ppv)
 {
 #if USE_CUSTOM_EXPLORERBAND
@@ -143,6 +152,7 @@ OBJECT_ENTRY(CLSID_InternetToolbar, CInternetToolbar)
 OBJECT_ENTRY(CLSID_CRegTreeOptions, CRegTreeOptions)
 OBJECT_ENTRY(CLSID_TaskbarList, CTaskbarList)
 OBJECT_ENTRY(CLSID_ExplorerBand, CExplorerBand)
+OBJECT_ENTRY(CLSID_FileSearchBand, CSearchBar)
 OBJECT_ENTRY(CLSID_ProgressDialog, CProgressDialog)
 OBJECT_ENTRY(CLSID_ISFBand, CISFBand)
 END_OBJECT_MAP()
index 5635b8f..02d75a2 100644 (file)
@@ -7,6 +7,7 @@
 #define USE_CUSTOM_BANDPROXY 1
 #define USE_CUSTOM_BRANDBAND 1
 #define USE_CUSTOM_EXPLORERBAND 1
+#define USE_CUSTOM_SEARCHBAND 1
 #define USE_CUSTOM_INTERNETTOOLBAR 1
 
 HRESULT CAddressBand_CreateInstance(REFIID riid, void **ppv);
@@ -14,6 +15,7 @@ HRESULT CAddressEditBox_CreateInstance(REFIID riid, void **ppv);
 HRESULT CBandProxy_CreateInstance(REFIID riid, void **ppv);
 HRESULT CBrandBand_CreateInstance(REFIID riid, void **ppv);
 HRESULT CExplorerBand_CreateInstance(REFIID riid, LPVOID *ppv);
+HRESULT CSearchBar_CreateInstance(REFIID riid, LPVOID *ppv);
 HRESULT CInternetToolbar_CreateInstance(REFIID riid, void **ppv);
 HRESULT CMergedFolder_CreateInstance(REFIID riid, void **ppv);
 HRESULT CMenuBand_CreateInstance(REFIID iid, LPVOID *ppv);
index 1e118e9..f22d17e 100644 (file)
@@ -48,6 +48,7 @@ IDR_ACLISTISF REGISTRY "res/shellautocomplete.rgs"
 IDR_ISFBAND REGISTRY "res/isfband.rgs"
 IDR_ACLCUSTOMMRU REGISTRY "res/custommru.rgs"
 IDR_TASKBARLIST REGISTRY "res/taskbarlist.rgs"
+IDR_FILESEARCHBAND REGISTRY "res/filesearchband.rgs"
 
 #include <reactos/manifest_dll.rc>
 
index 69d1cb9..b6c464d 100644 (file)
@@ -47,6 +47,7 @@
 #include "shellbars/CBandSite.h"
 #include "shellbars/CBandSiteMenu.h"
 #include "shellbars/CISFBand.h"
+#include "shellfind/CSearchBar.h"
 #include "brandband.h"
 #include "internettoolbar.h"
 #include "commonbrowser.h"
diff --git a/dll/win32/browseui/res/filesearchband.rgs b/dll/win32/browseui/res/filesearchband.rgs
new file mode 100644 (file)
index 0000000..f98e6a4
--- /dev/null
@@ -0,0 +1,14 @@
+HKCR
+{
+       NoRemove CLSID
+       {
+               ForceRemove {C4EE31F3-4768-11D2-BE5C-00A0C9A83DA1} = s 'File Search Explorer Band'
+               {
+                       DefaultIcon = e '%%SystemRoot%%\System32\shell32.dll,-135'
+                       InprocServer32 = s '%MODULE%'
+                       {
+                               val ThreadingModel = s 'Apartment'
+                       }
+               }
+       }
+}
index 1d9f96a..3dbe833 100644 (file)
 #define IDR_ISFBAND              143
 #define IDR_ACLCUSTOMMRU         144
 #define IDR_TASKBARLIST          145
+#define IDR_FILESEARCHBAND       146
 
 #define IDS_SMALLICONS           12301
 #define IDS_LARGEICONS           12302
 #define IDB_SHELL_BRANDBAND_SM_LO   245
 #define IDB_SHELL_BRANDBAND_MD_LO   246
 #define IDB_SHELL_BRANDBAND_LG_LO   247*/
+
+#define IDD_SEARCH_DLG          1000
+#define IDC_SEARCH_LABEL        1001
+#define IDC_SEARCH_FILENAME     1002
+#define IDC_SEARCH_QUERY        1003
+#define IDC_SEARCH_BUTTON       1004
+#define IDC_SEARCH_STOP_BUTTON  1005
+#define IDC_SEARCH_COMBOBOX     1006
+#define IDS_SEARCHINVALID       4518
+#define IDS_COL_NAME            8976
+#define IDS_COL_LOCATION        8977
+#define IDS_COL_RELEVANCE       8989
+#define IDS_SEARCH_FILES_FOUND  9232
+#define IDS_SEARCH_FOLDER       9234
+#define IDS_SEARCH_OPEN_FOLDER  40960
index 2f30312..04d9b58 100644 (file)
@@ -1234,6 +1234,13 @@ HRESULT CShellBrowser::ShowBand(const CLSID &classID, bool vertical)
             if (FAILED_UNEXPECTEDLY(hResult))
                 return hResult;
         }
+        else if (IsEqualCLSID(classID, CLSID_FileSearchBand))
+        {
+            TRACE("CLSID_FileSearchBand requested, building internal band.\n");
+            hResult = CSearchBar_CreateInstance(IID_PPV_ARG(IUnknown, &newBand));
+            if (FAILED_UNEXPECTEDLY(hResult))
+                return hResult;
+        }
         else
         {
             TRACE("A different CLSID requested, using CoCreateInstance.\n");
@@ -2010,25 +2017,12 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::Exec(const GUID *pguidCmdGroup, DWORD n
         switch (nCmdID)
         {
             case 0x1c: //Toggle Search
-                if (IsEqualCLSID(CLSID_SH_SearchBand, fCurrentVertBar) ||
-                    IsEqualCLSID(CLSID_SearchBand, fCurrentVertBar) ||
-                    IsEqualCLSID(CLSID_IE_SearchBand, fCurrentVertBar) ||
-                    IsEqualCLSID(CLSID_FileSearchBand, fCurrentVertBar))
-                {
-                    hResult = IUnknown_ShowDW(fClientBars[BIVerticalBaseBar].clientBar.p, FALSE);
-                    memset(&fCurrentVertBar, 0, sizeof(fCurrentVertBar));
-                    FireCommandStateChangeAll();
-                }
-                else
-                {
-                    OnSearch();
-                }
-                return S_OK;
             case 0x1d: //Toggle History
             case 0x1e: //Toggle Favorites
             case 0x23: //Toggle Folders
                 const GUID* pclsid;
-                if (nCmdID == 0x1d) pclsid = &CLSID_SH_HistBand;
+                if (nCmdID == 0x1c) pclsid = &CLSID_FileSearchBand;
+                else if (nCmdID == 0x1d) pclsid = &CLSID_SH_HistBand;
                 else if (nCmdID == 0x1e) pclsid = &CLSID_SH_FavBand;
                 else pclsid = &CLSID_ExplorerBand;
 
@@ -3756,7 +3750,7 @@ LRESULT CShellBrowser::OnExplorerBar(WORD wNotifyCode, WORD wID, HWND hWndCtl, B
     switch (wID)
     {
     case IDM_EXPLORERBAR_SEARCH:
-        Exec(&CLSID_CommonButtons, 0x123, 1, NULL, NULL);
+        ShowBand(CLSID_FileSearchBand, true);
         break;
     case IDM_EXPLORERBAR_FOLDERS:
         ShowBand(CLSID_ExplorerBand, true);
diff --git a/dll/win32/browseui/shellfind/CMakeLists.txt b/dll/win32/browseui/shellfind/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4f031b4
--- /dev/null
@@ -0,0 +1,21 @@
+
+PROJECT(SHELL)
+
+set_cpp(WITH_RUNTIME)
+
+add_definitions(-DUNICODE -D_UNICODE)
+add_definitions(-D_ATL_NO_EXCEPTIONS)
+
+include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
+
+list(APPEND SOURCE
+    CSearchBar.cpp
+    shellfind.h)
+
+add_library(shellfind ${SOURCE})
+
+if(NOT MSVC)
+    add_target_compile_flags(shellfind "-Wno-unused-but-set-variable")
+endif()
+
+add_pch(shellfind shellfind.h SOURCE)
diff --git a/dll/win32/browseui/shellfind/CSearchBar.cpp b/dll/win32/browseui/shellfind/CSearchBar.cpp
new file mode 100644 (file)
index 0000000..b07b5ac
--- /dev/null
@@ -0,0 +1,433 @@
+/*
+ * ReactOS Explorer
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "CSearchBar.h"
+#include <psdk/wingdi.h>
+
+WINE_DEFAULT_DEBUG_CHANNEL(shellfind);
+
+#if 1
+#undef UNIMPLEMENTED
+
+#define UNIMPLEMENTED DbgPrint("%s is UNIMPLEMENTED!\n", __FUNCTION__)
+#endif
+
+CSearchBar::CSearchBar() :
+    pSite(NULL),
+    fVisible(FALSE),
+    bFocused(FALSE)
+{
+}
+
+CSearchBar::~CSearchBar()
+{
+}
+
+void CSearchBar::InitializeSearchBar()
+{
+    CreateWindowExW(0, WC_STATIC, L"Search by any or all of the criteria below.",
+        WS_CHILD | WS_VISIBLE,
+        10, 10, 200, 40,
+        m_hWnd, NULL,
+        _AtlBaseModule.GetModuleInstance(), NULL);
+
+    CreateWindowExW(0, WC_STATIC, L"A &word or phrase in the file:",
+        WS_CHILD | WS_VISIBLE,
+        10, 50, 500, 20,
+        m_hWnd, NULL,
+        _AtlBaseModule.GetModuleInstance(), NULL);
+    CreateWindowExW(WS_EX_CLIENTEDGE, WC_EDITW, NULL,
+        WS_BORDER | WS_CHILD | WS_VISIBLE,
+        10, 70, 100, 20,
+        m_hWnd, NULL,
+        _AtlBaseModule.GetModuleInstance(), NULL);
+
+    CreateWindowExW(0, WC_STATIC, L"&Look in:",
+        WS_CHILD | WS_VISIBLE,
+        10, 100, 500, 20,
+        m_hWnd, NULL,
+        _AtlBaseModule.GetModuleInstance(), NULL);
+    CreateWindowExW(WS_EX_CLIENTEDGE, WC_EDITW, NULL,
+        WS_BORDER | WS_CHILD | WS_VISIBLE,
+        10, 120, 100, 20,
+        m_hWnd, NULL,
+        _AtlBaseModule.GetModuleInstance(), NULL);
+
+    CreateWindowExW(0, WC_BUTTON, L"Sea&rch",
+        WS_BORDER | WS_CHILD | WS_VISIBLE,
+        10, 150, 100, 20,
+        m_hWnd, NULL,
+        _AtlBaseModule.GetModuleInstance(), NULL);
+}
+
+HRESULT CSearchBar::ExecuteCommand(CComPtr<IContextMenu>& menu, UINT nCmd)
+{
+    CComPtr<IOleWindow>                 pBrowserOleWnd;
+    CMINVOKECOMMANDINFO                 cmi;
+    HWND                                browserWnd;
+    HRESULT                             hr;
+
+    hr = IUnknown_QueryService(pSite, SID_SShellBrowser, IID_PPV_ARG(IOleWindow, &pBrowserOleWnd));
+    if (FAILED_UNEXPECTEDLY(hr))
+        return hr;
+
+    hr = pBrowserOleWnd->GetWindow(&browserWnd);
+    if (FAILED_UNEXPECTEDLY(hr))
+        return hr;
+
+    ZeroMemory(&cmi, sizeof(cmi));
+    cmi.cbSize = sizeof(cmi);
+    cmi.lpVerb = MAKEINTRESOURCEA(nCmd);
+    cmi.hwnd = browserWnd;
+    if (GetKeyState(VK_SHIFT) & 0x8000)
+        cmi.fMask |= CMIC_MASK_SHIFT_DOWN;
+    if (GetKeyState(VK_CONTROL) & 0x8000)
+        cmi.fMask |= CMIC_MASK_CONTROL_DOWN;
+
+    return menu->InvokeCommand(&cmi);
+}
+
+
+// *** ATL event handlers ***
+LRESULT CSearchBar::OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+    bFocused = TRUE;
+    IUnknown_OnFocusChangeIS(pSite, reinterpret_cast<IUnknown*>(this), TRUE);
+    bHandled = FALSE;
+    return TRUE;
+}
+
+
+// *** IOleWindow methods ***
+HRESULT STDMETHODCALLTYPE CSearchBar::GetWindow(HWND *lphwnd)
+{
+    if (!lphwnd)
+        return E_INVALIDARG;
+    *lphwnd = m_hWnd;
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::ContextSensitiveHelp(BOOL fEnterMode)
+{
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+
+// *** IDockingWindow methods ***
+HRESULT STDMETHODCALLTYPE CSearchBar::CloseDW(DWORD dwReserved)
+{
+    // We do nothing, we don't have anything to save yet
+    TRACE("CloseDW called\n");
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
+{
+    /* Must return E_NOTIMPL according to MSDN */
+    return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::ShowDW(BOOL fShow)
+{
+    fVisible = fShow;
+    ShowWindow(fShow);
+    return S_OK;
+}
+
+
+// *** IDeskBand methods ***
+HRESULT STDMETHODCALLTYPE CSearchBar::GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi)
+{
+    if (!pdbi)
+    {
+        return E_INVALIDARG;
+    }
+
+    if (pdbi->dwMask & DBIM_MINSIZE)
+    {
+        pdbi->ptMinSize.x = 200;
+        pdbi->ptMinSize.y = 30;
+    }
+
+    if (pdbi->dwMask & DBIM_MAXSIZE)
+    {
+        pdbi->ptMaxSize.y = -1;
+    }
+
+    if (pdbi->dwMask & DBIM_INTEGRAL)
+    {
+        pdbi->ptIntegral.y = 1;
+    }
+
+    if (pdbi->dwMask & DBIM_ACTUAL)
+    {
+        pdbi->ptActual.x = 200;
+        pdbi->ptActual.y = 30;
+    }
+
+    if (pdbi->dwMask & DBIM_TITLE)
+    {
+        if (!LoadStringW(_AtlBaseModule.GetResourceInstance(), IDS_SEARCHLABEL, pdbi->wszTitle, _countof(pdbi->wszTitle)))
+            return HRESULT_FROM_WIN32(GetLastError());
+    }
+
+    if (pdbi->dwMask & DBIM_MODEFLAGS)
+    {
+        pdbi->dwModeFlags = DBIMF_NORMAL | DBIMF_VARIABLEHEIGHT;
+    }
+
+    if (pdbi->dwMask & DBIM_BKCOLOR)
+    {
+        pdbi->dwMask &= ~DBIM_BKCOLOR;
+    }
+    return S_OK;
+}
+
+LRESULT CALLBACK MyWindowProc(
+    _In_ HWND   hwnd,
+    _In_ UINT   uMsg,
+    _In_ WPARAM wParam,
+    _In_ LPARAM lParam
+)
+{
+    return 0;
+}
+
+// *** IObjectWithSite methods ***
+HRESULT STDMETHODCALLTYPE CSearchBar::SetSite(IUnknown *pUnkSite)
+{
+    HRESULT hr;
+    HWND parentWnd;
+
+    if (pUnkSite == pSite)
+        return S_OK;
+
+    TRACE("SetSite called \n");
+    if (!pUnkSite)
+    {
+        DestroyWindow();
+        m_hWnd = NULL;
+    }
+
+    if (pUnkSite != pSite)
+    {
+        pSite = NULL;
+    }
+
+    if(!pUnkSite)
+        return S_OK;
+
+    hr = IUnknown_GetWindow(pUnkSite, &parentWnd);
+    if (!SUCCEEDED(hr))
+    {
+        ERR("Could not get parent's window ! Status: %08lx\n", hr);
+        return E_INVALIDARG;
+    }
+
+    pSite = pUnkSite;
+
+    if (m_hWnd)
+    {
+        // Change its parent
+        SetParent(parentWnd);
+    }
+    else
+    {
+        CWindowImpl::Create(parentWnd);
+
+        InitializeSearchBar();
+    }
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::GetSite(REFIID riid, void **ppvSite)
+{
+    if (!ppvSite)
+        return E_POINTER;
+    *ppvSite = pSite;
+    return S_OK;
+}
+
+
+// *** IOleCommandTarget methods ***
+HRESULT STDMETHODCALLTYPE CSearchBar::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText)
+{
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
+{
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+
+// *** IServiceProvider methods ***
+HRESULT STDMETHODCALLTYPE CSearchBar::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
+{
+    /* FIXME: we probably want to handle more services here */
+    return IUnknown_QueryService(pSite, SID_SShellBrowser, riid, ppvObject);
+}
+
+
+// *** IInputObject methods ***
+HRESULT STDMETHODCALLTYPE CSearchBar::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
+{
+    if (fActivate)
+    {
+        //SetFocus();
+        SetActiveWindow();
+    }
+    // TODO: handle message
+    if(lpMsg)
+    {
+        TranslateMessage(lpMsg);
+        DispatchMessage(lpMsg);
+    }
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::HasFocusIO()
+{
+    return bFocused ? S_OK : S_FALSE;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::TranslateAcceleratorIO(LPMSG lpMsg)
+{
+    if (lpMsg->hwnd == m_hWnd)
+    {
+        TranslateMessage(lpMsg);
+        DispatchMessage(lpMsg);
+        return S_OK;
+    }
+
+    return S_FALSE;
+}
+
+// *** IPersist methods ***
+HRESULT STDMETHODCALLTYPE CSearchBar::GetClassID(CLSID *pClassID)
+{
+    if (!pClassID)
+        return E_POINTER;
+    memcpy(pClassID, &CLSID_FileSearchBand, sizeof(CLSID));
+    return S_OK;
+}
+
+
+// *** IPersistStream methods ***
+HRESULT STDMETHODCALLTYPE CSearchBar::IsDirty()
+{
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::Load(IStream *pStm)
+{
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::Save(IStream *pStm, BOOL fClearDirty)
+{
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::GetSizeMax(ULARGE_INTEGER *pcbSize)
+{
+    // TODO: calculate max size
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+
+// *** IWinEventHandler methods ***
+HRESULT STDMETHODCALLTYPE CSearchBar::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
+{
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::IsWindowOwner(HWND hWnd)
+{
+    return (hWnd == m_hWnd) ? S_OK : S_FALSE;
+}
+
+// *** IBandNavigate methods ***
+HRESULT STDMETHODCALLTYPE CSearchBar::Select(long paramC)
+{
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+// *** INamespaceProxy ***
+HRESULT STDMETHODCALLTYPE CSearchBar::GetNavigateTarget(long paramC, long param10, long param14)
+{
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::Invoke(long paramC)
+{
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::OnSelectionChanged(long paramC)
+{
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::RefreshFlags(long paramC, long param10, long param14)
+{
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::CacheItem(long paramC)
+{
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+// *** IDispatch methods ***
+HRESULT STDMETHODCALLTYPE CSearchBar::GetTypeInfoCount(UINT *pctinfo)
+{
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
+{
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
+{
+    UNIMPLEMENTED;
+    return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CSearchBar::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+    TRACE("Unknown dispid requested: %08x\n", dispIdMember);
+    return E_INVALIDARG;
+}
diff --git a/dll/win32/browseui/shellfind/CSearchBar.h b/dll/win32/browseui/shellfind/CSearchBar.h
new file mode 100644 (file)
index 0000000..5ab67b4
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * ReactOS Explorer
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#pragma once
+
+#include "shellfind.h"
+
+class CSearchBar :
+    public CComCoClass<CSearchBar, &CLSID_FileSearchBand>,
+    public CComObjectRootEx<CComMultiThreadModelNoCS>,
+    public IDeskBand,
+    public IObjectWithSite,
+    public IInputObject,
+    public IPersistStream,
+    public IOleCommandTarget,
+    public IServiceProvider,
+    public IBandNavigate,
+    public IWinEventHandler,
+    public INamespaceProxy,
+    public IDispatch,
+    public CWindowImpl<CSearchBar>
+{
+
+private:
+    // *** BaseBarSite information ***
+    CComPtr<IUnknown> pSite;
+    BOOL fVisible;
+    BOOL bFocused;
+
+    void InitializeSearchBar();
+    HRESULT ExecuteCommand(CComPtr<IContextMenu>& menu, UINT nCmd);
+
+    // *** ATL event handlers ***
+    LRESULT OnSetFocus(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);
+
+    // *** IOleCommandTarget methods ***
+    virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText);
+    virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
+
+    // *** IServiceProvider methods ***
+    virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
+
+    // *** 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);
+
+    // *** IWinEventHandler methods ***
+    virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
+    virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd);
+
+    // *** IBandNavigate methods ***
+    virtual HRESULT STDMETHODCALLTYPE Select(long paramC);
+
+    // *** INamespaceProxy ***
+    virtual HRESULT STDMETHODCALLTYPE GetNavigateTarget(long paramC, long param10, long param14);
+    virtual HRESULT STDMETHODCALLTYPE Invoke(long paramC);
+    virtual HRESULT STDMETHODCALLTYPE OnSelectionChanged(long paramC);
+    virtual HRESULT STDMETHODCALLTYPE RefreshFlags(long paramC, long param10, long param14);
+    virtual HRESULT STDMETHODCALLTYPE CacheItem(long paramC);
+
+    // *** 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);
+
+    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(IID_IWinEventHandler, IWinEventHandler)
+        COM_INTERFACE_ENTRY_IID(IID_IBandNavigate, IBandNavigate)
+        COM_INTERFACE_ENTRY_IID(IID_INamespaceProxy, INamespaceProxy)
+        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_IOleCommandTarget, IOleCommandTarget)
+        COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
+        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()
+
+    DECLARE_WND_CLASS_EX(_T("SrchCompExplorerBar"), 0, COLOR_WINDOW)
+
+    BEGIN_MSG_MAP(CSearchBar)
+        MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
+    END_MSG_MAP()
+};
diff --git a/dll/win32/browseui/shellfind/shellfind.h b/dll/win32/browseui/shellfind/shellfind.h
new file mode 100644 (file)
index 0000000..9133bdf
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef _SHELLFIND_PCH_
+#define _SHELLFIND_PCH_
+
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
+#include <windef.h>
+#include <winbase.h>
+#include <shlobj.h>
+#include <shlobj_undoc.h>
+#include <shlguid_undoc.h>
+#include <shdeprecated.h>
+#include <tchar.h>
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlwin.h>
+#include <atlsimpcoll.h>
+#include <atlstr.h>
+#include <shlwapi.h>
+#include <shlwapi_undoc.h>
+#include <undocshell.h>
+#include <shellutils.h>
+#include <strsafe.h>
+#include <wine/debug.h>
+
+#include "../resource.h"
+
+#endif /* _SHELLFIND_PCH_ */