Author: gadamopoulos
Date: Fri Jun 3 21:25:34 2016
New Revision: 71510
URL:
http://svn.reactos.org/svn/reactos?rev=71510&view=rev
Log:
[BROWSEUI]
- CExplorerBand: Navigate to the selected item when the selection changes.
- Part of the work submitted by Sylvain Deverre.
CORE-10838
Modified:
trunk/reactos/dll/win32/browseui/explorerband.cpp
trunk/reactos/dll/win32/browseui/explorerband.h
Modified: trunk/reactos/dll/win32/browseui/explorerband.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/explore…
==============================================================================
--- trunk/reactos/dll/win32/browseui/explorerband.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/explorerband.cpp [iso-8859-1] Fri Jun 3 21:25:34
2016
@@ -142,6 +142,22 @@
return reinterpret_cast<NodeInfo*>(tvItem.lParam);
}
+HRESULT CExplorerBand::UpdateBrowser(LPITEMIDLIST pidlGoto)
+{
+ CComPtr<IShellBrowser> pBrowserService;
+ HRESULT hr;
+
+ hr = IUnknown_QueryService(pSite, SID_STopLevelBrowser, IID_PPV_ARG(IShellBrowser,
&pBrowserService));
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ hr = pBrowserService->BrowseObject(pidlGoto, SBSP_SAMEBROWSER | SBSP_ABSOLUTE);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ return hr;
+}
+
// *** notifications handling ***
BOOL CExplorerBand::OnTreeItemExpanding(LPNMTREEVIEW pnmtv)
{
@@ -177,6 +193,16 @@
return FALSE;
}
+void CExplorerBand::OnSelectionChanged(LPNMTREEVIEW pnmtv)
+{
+ NodeInfo* pNodeInfo = GetNodeInfo(pnmtv->itemNew.hItem);
+
+ UpdateBrowser(pNodeInfo->absolutePidl);
+ SetFocus();
+ // Expand the node
+ //TreeView_Expand(m_hWnd, pnmtv->itemNew.hItem, TVE_EXPAND);
+}
+
// *** Helper functions ***
HTREEITEM CExplorerBand::InsertItem(HTREEITEM hParent, IShellFolder *psfParent,
LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort)
{
@@ -558,6 +584,9 @@
case TVN_ITEMEXPANDING:
*theResult = OnTreeItemExpanding((LPNMTREEVIEW)lParam);
break;
+ case TVN_SELCHANGED:
+ OnSelectionChanged((LPNMTREEVIEW)lParam);
+ break;
default:
break;
}
Modified: trunk/reactos/dll/win32/browseui/explorerband.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/explore…
==============================================================================
--- trunk/reactos/dll/win32/browseui/explorerband.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/explorerband.h [iso-8859-1] Fri Jun 3 21:25:34 2016
@@ -69,9 +69,11 @@
void DestroyExplorerBand();
BOOL OnTreeItemExpanding(LPNMTREEVIEW pnmtv);
+ void OnSelectionChanged(LPNMTREEVIEW pnmtv);
// *** Helper functions ***
NodeInfo* GetNodeInfo(HTREEITEM hItem);
+ HRESULT UpdateBrowser(LPITEMIDLIST pidlGoto);
HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt,
LPITEMIDLIST pEltRelative, BOOL bSort);
BOOL InsertSubitems(HTREEITEM hItem, NodeInfo *pNodeInfo);