explorerframe: Implement CollapseAll.

This commit is contained in:
David Hedberg 2010-08-18 07:08:10 +02:00 committed by Alexandre Julliard
parent 4a7628af8a
commit e7a3998c1f
2 changed files with 28 additions and 2 deletions

View File

@ -361,6 +361,20 @@ static IShellItem *get_selected_shellitem(NSTC2Impl *This)
return shellitem_from_treeitem(This, get_selected_treeitem(This));
}
static void collapse_all(NSTC2Impl *This, HTREEITEM node)
{
HTREEITEM next;
/* Collapse this node first, and then first child/next sibling. */
SendMessageW(This->hwnd_tv, TVM_EXPAND, TVE_COLLAPSE, (LPARAM)node);
next = (HTREEITEM)SendMessageW(This->hwnd_tv, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)node);
if(next) collapse_all(This, next);
next = (HTREEITEM)SendMessageW(This->hwnd_tv, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)node);
if(next) collapse_all(This, next);
}
/*************************************************************************
* NamespaceTree window functions
*/
@ -1143,8 +1157,13 @@ static HRESULT WINAPI NSTC2_fnGetItemRect(INameSpaceTreeControl2* iface,
static HRESULT WINAPI NSTC2_fnCollapseAll(INameSpaceTreeControl2* iface)
{
NSTC2Impl *This = (NSTC2Impl*)iface;
FIXME("stub, %p\n", This);
return E_NOTIMPL;
nstc_root *root;
TRACE("%p\n", This);
LIST_FOR_EACH_ENTRY(root, &This->roots, nstc_root, entry)
collapse_all(This, root->htreeitem);
return S_OK;
}
static HRESULT WINAPI NSTC2_fnSetControlStyle(INameSpaceTreeControl2* iface,

View File

@ -1077,9 +1077,16 @@ static void test_basics(void)
roots[9] = NULL;
verify_root_order(pnstc, roots);
/* CollapseAll */
hr = INameSpaceTreeControl_CollapseAll(pnstc);
ok(hr == S_OK, "Got 0x%08x\n", hr);
hr = INameSpaceTreeControl_RemoveAllRoots(pnstc);
ok(hr == S_OK, "Got (0x%08x)\n", hr);
hr = INameSpaceTreeControl_CollapseAll(pnstc);
ok(hr == S_OK, "Got 0x%08x\n", hr);
IShellItem_Release(psidesktop);
IShellItem_Release(psidesktop2);
IShellItem_Release(psitestdir);