Nikolay Sivov : comctl32/treeview: Make item data layout partially compatible with native one.
Alexandre Julliard
julliard at winehq.org
Mon Nov 1 11:54:40 CDT 2010
Module: wine
Branch: master
Commit: 6ec621e835e03f715d5fee27c5de5b0d361814de
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6ec621e835e03f715d5fee27c5de5b0d361814de
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun Oct 31 01:32:36 2010 +0400
comctl32/treeview: Make item data layout partially compatible with native one.
---
dlls/comctl32/tests/treeview.c | 53 ++++++++++++++++++++++++++++++++++++++++
dlls/comctl32/treeview.c | 7 +++--
2 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index 5088d91..dddaa9d 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -1369,6 +1369,57 @@ static void test_delete_items(void)
DestroyWindow(hTree);
}
+struct _ITEM_DATA
+{
+ HTREEITEM parent; /* for root value of parent field is unidetified */
+ HTREEITEM nextsibling;
+ HTREEITEM firstchild;
+};
+
+static void _check_item(HTREEITEM item, HTREEITEM parent, HTREEITEM nextsibling, HTREEITEM firstchild, int line)
+{
+ struct _ITEM_DATA *data = (struct _ITEM_DATA*)item;
+
+ ok_(__FILE__, line)(data->parent == parent, "parent %p, got %p\n", parent, data->parent);
+ ok_(__FILE__, line)(data->nextsibling == nextsibling, "sibling %p, got %p\n", nextsibling, data->nextsibling);
+ ok_(__FILE__, line)(data->firstchild == firstchild, "firstchild %p, got %p\n", firstchild, data->firstchild);
+}
+
+#define check_item(a, b, c, d) _check_item(a, b, c, d, __LINE__)
+
+static void test_htreeitem_layout(void)
+{
+ TVINSERTSTRUCTA ins;
+ HTREEITEM item1, item2;
+ HWND hTree;
+
+ hTree = create_treeview_control();
+ fill_tree(hTree);
+
+ /* root has some special pointer in parent field */
+ check_item(hRoot, ((struct _ITEM_DATA*)hRoot)->parent, 0, hChild);
+ check_item(hChild, hRoot, 0, 0);
+
+ ins.hParent = hChild;
+ ins.hInsertAfter = TVI_FIRST;
+ item1 = TreeView_InsertItem(hTree, &ins);
+
+ check_item(item1, hChild, 0, 0);
+
+ ins.hParent = hRoot;
+ ins.hInsertAfter = TVI_FIRST;
+ item2 = TreeView_InsertItem(hTree, &ins);
+
+ check_item(item2, hRoot, hChild, 0);
+
+ SendMessage(hTree, TVM_DELETEITEM, 0, (LPARAM)hChild);
+
+ /* without children now */
+ check_item(hRoot, ((struct _ITEM_DATA*)hRoot)->parent, 0, item2);
+
+ DestroyWindow(hTree);
+}
+
START_TEST(treeview)
{
HMODULE hComctl32;
@@ -1437,6 +1488,7 @@ START_TEST(treeview)
test_TVS_SINGLEEXPAND();
test_WM_PAINT();
test_delete_items();
+ test_htreeitem_layout();
if (!load_v6_module(&ctx_cookie, &hCtx))
{
@@ -1461,6 +1513,7 @@ START_TEST(treeview)
/* comctl32 version 6 tests start here */
test_expandedimage();
+ test_htreeitem_layout();
unload_v6_module(ctx_cookie, hCtx);
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index f8c28de..1e80c19 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -70,6 +70,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(treeview);
typedef struct _TREEITEM /* HTREEITEM is a _TREEINFO *. */
{
+ HTREEITEM parent; /* handle to parent or 0 if at root */
+ HTREEITEM nextSibling; /* handle to next item in list, 0 if last */
+ HTREEITEM firstChild; /* handle to first child or 0 if no child */
+
UINT callbackMask;
UINT state;
UINT stateMask;
@@ -82,11 +86,8 @@ typedef struct _TREEITEM /* HTREEITEM is a _TREEINFO *. */
LPARAM lParam;
int iIntegral; /* item height multiplier (1 is normal) */
int iLevel; /* indentation level:0=root level */
- HTREEITEM parent; /* handle to parent or 0 if at root */
- HTREEITEM firstChild; /* handle to first child or 0 if no child */
HTREEITEM lastChild;
HTREEITEM prevSibling; /* handle to prev item in list, 0 if first */
- HTREEITEM nextSibling; /* handle to next item in list, 0 if last */
RECT rect;
LONG linesOffset;
LONG stateOffset;
More information about the wine-cvs
mailing list