Author: dquintana
Date: Tue May 13 08:53:26 2014
New Revision: 63270
URL:
http://svn.reactos.org/svn/reactos?rev=63270&view=rev
Log:
[BROWSEUI]
* AddressBand: Create a combobox item to hold the info of the current folder, and keep it
selected. This will in the future be improved to show a pseudo-tree including all the
parent folders up to the Desktop, with the Desktop and My Computer expanded.
CORE-8220
Modified:
branches/shell-experiments/dll/win32/browseui/addressband.cpp
branches/shell-experiments/dll/win32/browseui/addresseditbox.cpp
branches/shell-experiments/dll/win32/browseui/addresseditbox.h
Modified: branches/shell-experiments/dll/win32/browseui/addressband.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/addressband.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/addressband.cpp [iso-8859-1] Tue May 13
08:53:26 2014
@@ -23,8 +23,18 @@
*/
#include "precomp.h"
+#include <commoncontrols.h>
+#include <shlwapi_undoc.h>
+#include <shellapi.h>
HRESULT CreateAddressEditBox(REFIID riid, void **ppv);
+
+extern "C"
+HRESULT WINAPI SHGetImageList(
+ _In_ int iImageList,
+ _In_ REFIID riid,
+ _Out_ void **ppv
+ );
/*
TODO:
@@ -192,6 +202,17 @@
reinterpret_cast<WPARAM>(_AtlBaseModule.GetResourceInstance()),
IDS_GOBUTTONLABEL);
SendMessage(fGoButton, TB_ADDBUTTONSW, 1, (LPARAM)&buttonInfo);
+ IImageList * piml;
+ HRESULT hr = SHGetImageList(SHIL_SMALL, IID_PPV_ARG(IImageList, &piml));
+ if (FAILED_UNEXPECTEDLY(hr))
+ {
+ SendMessageW(combobox, CBEM_SETIMAGELIST, 0, 0);
+ }
+ else
+ {
+ SendMessageW(combobox, CBEM_SETIMAGELIST, 0,
reinterpret_cast<LPARAM>(piml));
+ }
+
// take advice to watch events
hResult = IUnknown_QueryService(pUnkSite, SID_SShellBrowser,
IID_PPV_ARG(IBrowserService, &browserService));
if (SUCCEEDED(hResult))
@@ -424,7 +445,16 @@
DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
CComPtr<IBrowserService> isb;
+ CComPtr<IShellFolder> sf;
HRESULT hr;
+ INT indexClosed, indexOpen, itemExists, oldIndex;
+ DWORD result;
+ COMBOBOXEXITEMW item;
+ PIDLIST_ABSOLUTE absolutePIDL;
+ LPCITEMIDLIST pidlChild;
+ LPITEMIDLIST pidlPrevious;
+ STRRET ret;
+ WCHAR buf[4096];
if (pDispParams == NULL)
return E_INVALIDARG;
@@ -433,23 +463,57 @@
{
case DISPID_NAVIGATECOMPLETE2:
case DISPID_DOCUMENTCOMPLETE:
+
+ oldIndex = SendMessage(m_hWnd, CB_GETCURSEL, 0, 0);
+
+ item.mask = CBEIF_LPARAM;
+ item.iItem = 0;
+ itemExists = SendMessage(m_hWnd, CBEM_GETITEM, 0,
reinterpret_cast<LPARAM>(&item));
+ if (itemExists)
+ {
+ pidlPrevious = reinterpret_cast<LPITEMIDLIST>(item.lParam);
+ }
+
hr = IUnknown_QueryService(fSite, SID_STopLevelBrowser,
IID_PPV_ARG(IBrowserService, &isb));
if (FAILED(hr))
return hr;
- PIDLIST_ABSOLUTE absolutePIDL;
- LPCITEMIDLIST pidlChild;
isb->GetPidl(&absolutePIDL);
- CComPtr<IShellFolder> sf;
SHBindToParent(absolutePIDL, IID_PPV_ARG(IShellFolder, &sf),
&pidlChild);
- STRRET ret;
sf->GetDisplayNameOf(pidlChild, SHGDN_FORADDRESSBAR | SHGDN_FORPARSING,
&ret);
- WCHAR buf[4096];
StrRetToBufW(&ret, pidlChild, buf, 4095);
- fAddressEditBox->SetCurrentDir(reinterpret_cast<long>(buf));
+ indexClosed = SHMapPIDLToSystemImageListIndex(sf, pidlChild, &indexOpen);
+
+ item.mask = CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | CBEIF_TEXT | CBEIF_LPARAM;
+ item.iItem = 0;
+ item.iImage = indexClosed;
+ item.iSelectedImage = indexOpen;
+ item.pszText = buf;
+ item.lParam = reinterpret_cast<LPARAM>(absolutePIDL);
+
+ if (itemExists)
+ {
+ result = SendMessage(m_hWnd, CBEM_SETITEM, 0,
reinterpret_cast<LPARAM>(&item));
+
+ if (result)
+ {
+ ILFree(pidlPrevious);
+ }
+ }
+ else
+ {
+ oldIndex = SendMessage(m_hWnd, CBEM_INSERTITEM, 0,
reinterpret_cast<LPARAM>(&item));
+
+ if (oldIndex < 0)
+ DbgPrint("ERROR %d\n", GetLastError());
+ }
+
+ SendMessage(m_hWnd, CB_SETCURSEL, oldIndex, 0);
+
+ //fAddressEditBox->SetCurrentDir(index);
break;
}
@@ -461,8 +525,6 @@
if (notifyHeader->hwndFrom == fGoButton)
{
fAddressEditBox->ParseNow(0);
- //SendMessage(fEditControl, WM_KEYDOWN, 13, 0);
- //SendMessage(fEditControl, WM_KEYUP, 13, 0);
}
return 0;
}
Modified: branches/shell-experiments/dll/win32/browseui/addresseditbox.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/addresseditbox.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/browseui/addresseditbox.cpp [iso-8859-1] Tue May
13 08:53:26 2014
@@ -76,6 +76,7 @@
{
LPWSTR strC = reinterpret_cast<LPWSTR>(paramC);
fEditWindow.SetWindowText(strC);
+
return E_NOTIMPL;
}
@@ -169,25 +170,6 @@
return E_NOTIMPL;
}
-LRESULT CAddressEditBox::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
&bHandled)
-{
- bHandled = FALSE;
-/*
- RECT rc;
- GetClientRect(&rc);
- rc.left += 24;
- rc.top += 4;
- rc.right -= 4;
- rc.bottom -= 4;
- fEditWindow.SetWindowPos(NULL,
- rc.left, rc.top,
- rc.right - rc.left,
- rc.bottom - rc.top,
- SWP_NOOWNERZORDER | SWP_NOZORDER);
-*/
- return 0;
-}
-
HRESULT CreateAddressEditBox(REFIID riid, void **ppv)
{
CComObject<CAddressEditBox> *theMenuBar;
Modified: branches/shell-experiments/dll/win32/browseui/addresseditbox.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/addresseditbox.h [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/browseui/addresseditbox.h [iso-8859-1] Tue May 13
08:53:26 2014
@@ -78,9 +78,6 @@
virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
// message handlers
-// LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
-// LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
- LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
DECLARE_REGISTRY_RESOURCEID(IDR_ADDRESSEDITBOX)
DECLARE_NOT_AGGREGATABLE(CAddressEditBox)
@@ -88,14 +85,6 @@
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_MSG_MAP(CAddressEditBox)
- // MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
- // MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
- // MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
- // ALT_MSG_MAP(1)
- // MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocusSaveButton)
- // ALT_MSG_MAP(2)
- // MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocusSelectButton)
- MESSAGE_HANDLER(WM_SIZE, OnSize)
END_MSG_MAP()
BEGIN_COM_MAP(CAddressEditBox)