[PATCH 1/6] explorerframe: Implement CollapseAll.
David Hedberg
david.hedberg at gmail.com
Wed Aug 18 00:08:10 CDT 2010
---
dlls/explorerframe/nstc.c | 23 +++++++++++++++++++++--
dlls/explorerframe/tests/nstc.c | 7 +++++++
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/dlls/explorerframe/nstc.c b/dlls/explorerframe/nstc.c
index b2d780f..ca10493 100644
--- a/dlls/explorerframe/nstc.c
+++ b/dlls/explorerframe/nstc.c
@@ -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,
diff --git a/dlls/explorerframe/tests/nstc.c b/dlls/explorerframe/tests/nstc.c
index 170f189..4ca4320 100644
--- a/dlls/explorerframe/tests/nstc.c
+++ b/dlls/explorerframe/tests/nstc.c
@@ -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);
--
1.7.2
More information about the wine-patches
mailing list