Commit 95a15a34 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32: Make it possible to use TVM_GETITEM with item from another tree.

parent d7ccfef2
......@@ -746,8 +746,8 @@ static void test_get_set_item(void)
TVITEMA tviRoot = {0};
int nBufferSize = 80;
char szBuffer[80] = {0};
HWND hTree, hTree2;
DWORD ret;
HWND hTree;
hTree = create_treeview_control(0);
fill_tree(hTree);
......@@ -791,7 +791,18 @@ static void test_get_set_item(void)
ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_item_seq,
"test get set item", FALSE);
/* get item from a different tree */
hTree2 = create_treeview_control(0);
tviRoot.hItem = hRoot;
tviRoot.mask = TVIF_STATE;
tviRoot.state = 0;
ret = SendMessage( hTree2, TVM_GETITEMA, 0, (LPARAM)&tviRoot );
expect(TRUE, ret);
ok(tviRoot.state == TVIS_FOCUSED, "got state 0x%0x\n", tviRoot.state);
DestroyWindow(hTree);
DestroyWindow(hTree2);
}
static void test_get_set_itemheight(void)
......
......@@ -67,36 +67,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(treeview);
/* internal structures */
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;
LPWSTR pszText;
int cchTextMax;
int iImage;
int iSelectedImage;
int iExpandedImage;
int cChildren;
LPARAM lParam;
int iIntegral; /* item height multiplier (1 is normal) */
int iLevel; /* indentation level:0=root level */
HTREEITEM lastChild;
HTREEITEM prevSibling; /* handle to prev item in list, 0 if first */
RECT rect;
LONG linesOffset;
LONG stateOffset;
LONG imageOffset;
LONG textOffset;
LONG textWidth; /* horizontal text extent for pszText */
LONG visibleOrder; /* visible ordering, 0 is first visible item */
} TREEVIEW_ITEM;
typedef struct tagTREEVIEW_INFO
{
HWND hwnd;
......@@ -163,6 +133,35 @@ typedef struct tagTREEVIEW_INFO
WCHAR szSearchParam[ MAX_PATH ];
} TREEVIEW_INFO;
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;
LPWSTR pszText;
int cchTextMax;
int iImage;
int iSelectedImage;
int iExpandedImage;
int cChildren;
LPARAM lParam;
int iIntegral; /* item height multiplier (1 is normal) */
int iLevel; /* indentation level:0=root level */
HTREEITEM lastChild;
HTREEITEM prevSibling; /* handle to prev item in list, 0 if first */
RECT rect;
LONG linesOffset;
LONG stateOffset;
LONG imageOffset;
LONG textOffset;
LONG textWidth; /* horizontal text extent for pszText */
LONG visibleOrder; /* visible ordering, 0 is first visible item */
const TREEVIEW_INFO *infoPtr; /* tree data this item belongs to */
} TREEVIEW_ITEM;
/******** Defines that TREEVIEW_ProcessLetterKeys uses ****************/
#define KEY_DELAY 450
......@@ -1012,6 +1011,7 @@ TREEVIEW_AllocateItem(const TREEVIEW_INFO *infoPtr)
newItem->iImage = 0;
newItem->iSelectedImage = 0;
newItem->iExpandedImage = (WORD)I_IMAGENONE;
newItem->infoPtr = infoPtr;
if (DPA_InsertPtr(infoPtr->items, INT_MAX, newItem) == -1)
{
......@@ -2082,7 +2082,13 @@ TREEVIEW_GetItemT(const TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem, BOOL isW)
TREEVIEW_ITEM *item = tvItem->hItem;
if (!TREEVIEW_ValidItem(infoPtr, item))
return FALSE;
{
if (!item) return FALSE;
TRACE("got item from different tree %p, called from %p\n", item->infoPtr, infoPtr);
infoPtr = item->infoPtr;
if (!TREEVIEW_ValidItem(infoPtr, item)) return FALSE;
}
TREEVIEW_UpdateDispInfo(infoPtr, item, tvItem->mask);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment