- CExplorerBand: Navigate to the selected item when the selection changes.
- Part of the work submitted by Sylvain Deverre.
CORE-10838
svn path=/trunk/; revision=71510
return reinterpret_cast<NodeInfo*>(tvItem.lParam);
}
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)
{
// *** notifications handling ***
BOOL CExplorerBand::OnTreeItemExpanding(LPNMTREEVIEW pnmtv)
{
+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)
{
// *** Helper functions ***
HTREEITEM CExplorerBand::InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort)
{
case TVN_ITEMEXPANDING:
*theResult = OnTreeItemExpanding((LPNMTREEVIEW)lParam);
break;
case TVN_ITEMEXPANDING:
*theResult = OnTreeItemExpanding((LPNMTREEVIEW)lParam);
break;
+ case TVN_SELCHANGED:
+ OnSelectionChanged((LPNMTREEVIEW)lParam);
+ break;
void DestroyExplorerBand();
BOOL OnTreeItemExpanding(LPNMTREEVIEW pnmtv);
void DestroyExplorerBand();
BOOL OnTreeItemExpanding(LPNMTREEVIEW pnmtv);
+ void OnSelectionChanged(LPNMTREEVIEW pnmtv);
// *** Helper functions ***
NodeInfo* GetNodeInfo(HTREEITEM hItem);
// *** 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);
HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort);
BOOL InsertSubitems(HTREEITEM hItem, NodeInfo *pNodeInfo);