David Hedberg : explorerframe: Implement CollapseAll.

Alexandre Julliard julliard at winehq.org
Wed Aug 18 12:09:57 CDT 2010


Module: wine
Branch: master
Commit: e7a3998c1f3eb351641ba615f6f041b7520712e5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e7a3998c1f3eb351641ba615f6f041b7520712e5

Author: David Hedberg <david.hedberg at gmail.com>
Date:   Wed Aug 18 07:08:10 2010 +0200

explorerframe: Implement CollapseAll.

---

 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);




More information about the wine-cvs mailing list