Piotr Caban : comctl32: Initialize treeview checkboxes in WM_PAINT when TVS_CHECKBOXES was passed during control creation .

Alexandre Julliard julliard at winehq.org
Thu Oct 31 16:12:40 CDT 2013


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Oct 31 17:27:51 2013 +0100

comctl32: Initialize treeview checkboxes in WM_PAINT when TVS_CHECKBOXES was passed during control creation.

---

 dlls/comctl32/tests/treeview.c |   36 +++++++++++++++++++++++++++++++++++-
 dlls/comctl32/treeview.c       |    3 ---
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index d523c23..998cc83 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -1771,6 +1771,7 @@ static void test_TVS_CHECKBOXES(void)
     HWND hTree, hTree2;
     TVITEMA item;
     DWORD ret;
+    MSG msg;
 
     hTree = create_treeview_control(0);
     fill_tree(hTree);
@@ -1850,7 +1851,7 @@ static void test_TVS_CHECKBOXES(void)
     hTree = create_treeview_control(TVS_CHECKBOXES);
     fill_tree(hTree);
     himl = (HIMAGELIST)SendMessageA(hTree, TVM_GETIMAGELIST, TVSIL_STATE, 0);
-    todo_wine ok(himl == NULL, "got %p\n", himl);
+    ok(himl == NULL, "got %p\n", himl);
 
     item.hItem = hRoot;
     item.mask = TVIF_STATE;
@@ -1868,6 +1869,39 @@ static void test_TVS_CHECKBOXES(void)
     expect(TRUE, ret);
     ok(item.state == INDEXTOSTATEIMAGEMASK(1), "got 0x%x\n", item.state);
 
+    item.hItem = hChild;
+    item.mask = TVIF_STATE;
+    item.state = INDEXTOSTATEIMAGEMASK(2);
+    item.stateMask = TVIS_STATEIMAGEMASK;
+    ret = SendMessageA(hTree, TVM_SETITEMA, 0, (LPARAM)&item);
+    expect(TRUE, ret);
+
+    item.hItem = hChild;
+    item.mask = TVIF_STATE;
+    item.state = 0;
+    ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
+    expect(TRUE, ret);
+    ok(item.state == INDEXTOSTATEIMAGEMASK(2), "got 0x%x\n", item.state);
+
+    while(GetMessageA(&msg, 0, 0, 0))
+    {
+        TranslateMessage(&msg);
+        DispatchMessageA(&msg);
+
+        if((msg.hwnd == hTree) && (msg.message == WM_PAINT))
+            break;
+    }
+
+    item.hItem = hChild;
+    item.mask = TVIF_STATE;
+    item.state = 0;
+    ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
+    expect(TRUE, ret);
+    ok(item.state == INDEXTOSTATEIMAGEMASK(1), "got 0x%x\n", item.state);
+
+    himl = (HIMAGELIST)SendMessageA(hTree, TVM_GETIMAGELIST, TVSIL_STATE, 0);
+    ok(himl != NULL, "got %p\n", himl);
+
     DestroyWindow(hTree);
 }
 
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index ae69623..a885543 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -5137,9 +5137,6 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
             hwnd, 0, 0, 0);
 
-    if (infoPtr->dwStyle & TVS_CHECKBOXES)
-        TREEVIEW_InitCheckboxes(infoPtr);
-
     /* Make sure actual scrollbar state is consistent with uInternalStatus */
     ShowScrollBar(hwnd, SB_VERT, FALSE);
     ShowScrollBar(hwnd, SB_HORZ, FALSE);




More information about the wine-cvs mailing list