[PATCH 2/2] comctl32: Fix expanding of invisble sub trees.
Florian Köberle
florian at fkoeberle.de
Wed Apr 15 05:04:02 CDT 2009
---
dlls/comctl32/tests/treeview.c | 3 -
dlls/comctl32/treeview.c | 83 ++++++++++++++++++++-------------------
2 files changed, 43 insertions(+), 43 deletions(-)
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index 7d9fcfa..b75b91a 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -815,13 +815,10 @@ static void TestExpandInvisible(void)
nodeIVisible = TreeView_GetItemRect(tree, nodeI, &dummyRect, FALSE);
ok(!nodeIVisible, "Node I should not be visible.\n");
node1Visible = TreeView_GetItemRect(tree, node1, &dummyRect, FALSE);
-todo_wine
ok(!node1Visible, "Node 1 should not be visible.\n");
node2Visible = TreeView_GetItemRect(tree, node2, &dummyRect, FALSE);
-todo_wine
ok(!node2Visible, "Node 2 should not be visible.\n");
nodeIIVisible = TreeView_GetItemRect(tree, nodeII, &dummyRect, FALSE);
-todo_wine
ok(!nodeIIVisible, "Node II should not be visible.\n");
}
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 43ae7b6..4aa5725 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -3292,56 +3292,59 @@ TREEVIEW_Expand(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
if (bExpandPartial)
FIXME("TVE_EXPANDPARTIAL not implemented\n");
- TREEVIEW_RecalculateVisibleOrder(infoPtr, wineItem);
- TREEVIEW_UpdateSubTree(infoPtr, wineItem);
- TREEVIEW_UpdateScrollBars(infoPtr);
-
- scrollRect.left = 0;
- scrollRect.bottom = infoPtr->treeHeight;
- scrollRect.right = infoPtr->clientWidth;
- if (nextItem)
+ if (ISVISIBLE(wineItem))
{
- scrollDist = nextItem->rect.top - orgNextTop;
- scrollRect.top = orgNextTop;
+ TREEVIEW_RecalculateVisibleOrder(infoPtr, wineItem);
+ TREEVIEW_UpdateSubTree(infoPtr, wineItem);
+ TREEVIEW_UpdateScrollBars(infoPtr);
- ScrollWindowEx (infoPtr->hwnd, 0, scrollDist, &scrollRect, NULL,
- NULL, NULL, SW_ERASE | SW_INVALIDATE);
- TREEVIEW_Invalidate (infoPtr, wineItem);
- } else {
- scrollRect.top = wineItem->rect.top;
- InvalidateRect(infoPtr->hwnd, &scrollRect, FALSE);
- }
+ scrollRect.left = 0;
+ scrollRect.bottom = infoPtr->treeHeight;
+ scrollRect.right = infoPtr->clientWidth;
+ if (nextItem)
+ {
+ scrollDist = nextItem->rect.top - orgNextTop;
+ scrollRect.top = orgNextTop;
+
+ ScrollWindowEx (infoPtr->hwnd, 0, scrollDist, &scrollRect, NULL,
+ NULL, NULL, SW_ERASE | SW_INVALIDATE);
+ TREEVIEW_Invalidate (infoPtr, wineItem);
+ } else {
+ scrollRect.top = wineItem->rect.top;
+ InvalidateRect(infoPtr->hwnd, &scrollRect, FALSE);
+ }
- /* Scroll up so that as many children as possible are visible.
- * This fails when expanding causes an HScroll bar to appear, but we
- * don't know that yet, so the last item is obscured. */
- if (wineItem->firstChild != NULL)
- {
- int nChildren = wineItem->lastChild->visibleOrder
- - wineItem->firstChild->visibleOrder + 1;
+ /* Scroll up so that as many children as possible are visible.
+ * This fails when expanding causes an HScroll bar to appear, but we
+ * don't know that yet, so the last item is obscured. */
+ if (wineItem->firstChild != NULL)
+ {
+ int nChildren = wineItem->lastChild->visibleOrder
+ - wineItem->firstChild->visibleOrder + 1;
- int visible_pos = wineItem->visibleOrder
- - infoPtr->firstVisible->visibleOrder;
+ int visible_pos = wineItem->visibleOrder
+ - infoPtr->firstVisible->visibleOrder;
- int rows_below = TREEVIEW_GetVisibleCount(infoPtr) - visible_pos - 1;
+ int rows_below = TREEVIEW_GetVisibleCount(infoPtr) - visible_pos - 1;
- if (visible_pos > 0 && nChildren > rows_below)
- {
- int scroll = nChildren - rows_below;
+ if (visible_pos > 0 && nChildren > rows_below)
+ {
+ int scroll = nChildren - rows_below;
- if (scroll > visible_pos)
- scroll = visible_pos;
+ if (scroll > visible_pos)
+ scroll = visible_pos;
- if (scroll > 0)
- {
- TREEVIEW_ITEM *newFirstVisible
- = TREEVIEW_GetListItem(infoPtr, infoPtr->firstVisible,
- scroll);
+ if (scroll > 0)
+ {
+ TREEVIEW_ITEM *newFirstVisible
+ = TREEVIEW_GetListItem(infoPtr, infoPtr->firstVisible,
+ scroll);
- TREEVIEW_SetFirstVisible(infoPtr, newFirstVisible, TRUE);
- }
- }
+ TREEVIEW_SetFirstVisible(infoPtr, newFirstVisible, TRUE);
+ }
+ }
+ }
}
return TRUE;
--
1.5.4.3
More information about the wine-patches
mailing list