Commit 65b637be authored by Alex Priem's avatar Alex Priem Committed by Alexandre Julliard

* handle TVIF_TEXT by TREEVIEW_SetItem according to MS documentation.

* better handling of LPSTR_TEXTCALLBACK32A * TREEVIEW_GetNext|PrevListItem didn't descend into visible child items.
parent 658e35be
......@@ -81,8 +81,15 @@ static TREEVIEW_ITEM *TREEVIEW_GetPrevListItem (TREEVIEW_INFO *infoPtr,
{
TREEVIEW_ITEM *wineItem;
if (tvItem->upsibling)
return (& infoPtr->items[tvItem->upsibling]);
if (tvItem->upsibling) {
wineItem=& infoPtr->items[tvItem->upsibling];
if ((wineItem->firstChild) && (wineItem->state & TVIS_EXPANDED)) {
wineItem=& infoPtr->items[wineItem->firstChild];
while (wineItem->sibling)
wineItem= & infoPtr->items[wineItem->sibling];
}
return wineItem;
}
wineItem=tvItem;
while (wineItem->parent) {
......@@ -94,12 +101,16 @@ static TREEVIEW_ITEM *TREEVIEW_GetPrevListItem (TREEVIEW_INFO *infoPtr,
return NULL;
}
static TREEVIEW_ITEM *TREEVIEW_GetNextListItem (TREEVIEW_INFO *infoPtr,
TREEVIEW_ITEM *tvItem)
{
TREEVIEW_ITEM *wineItem;
if ((tvItem->firstChild) && (tvItem->state & TVIS_EXPANDED))
return (& infoPtr->items[tvItem->firstChild]);
if (tvItem->sibling)
return (& infoPtr->items[tvItem->sibling]);
......@@ -522,7 +533,7 @@ TREEVIEW_SetItem (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
}
if (tvItem->mask & TVIF_TEXT) {
len=tvItem->cchTextMax;
len=lstrlen32A (tvItem->pszText);
if (len>wineItem->cchTextMax) {
HeapFree (GetProcessHeap (), 0, wineItem->pszText);
wineItem->pszText= HeapAlloc (GetProcessHeap (),
......@@ -698,7 +709,7 @@ TREEVIEW_GetItem (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(wndPtr);
LPTVITEM tvItem;
TREEVIEW_ITEM *wineItem;
INT32 iItem,len;
INT32 iItem;
TRACE (treeview,"\n");
tvItem=(LPTVITEM) lParam;
......@@ -737,10 +748,12 @@ TREEVIEW_GetItem (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
}
if (tvItem->mask & TVIF_TEXT) {
len=wineItem->cchTextMax;
if (wineItem->cchTextMax>tvItem->cchTextMax)
len=tvItem->cchTextMax-1;
lstrcpyn32A (tvItem->pszText, tvItem->pszText,len);
if (wineItem->pszText == LPSTR_TEXTCALLBACK32A) {
tvItem->pszText = LPSTR_TEXTCALLBACK32A;
}
else if (wineItem->pszText) {
lstrcpyn32A (tvItem->pszText, wineItem->pszText, tvItem->cchTextMax);
}
}
return TRUE;
......@@ -974,6 +987,10 @@ TREEVIEW_InsertItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
lstrcpy32A (wineItem->pszText, tvItem->pszText);
wineItem->cchTextMax=len;
}
else {
wineItem->pszText = LPSTR_TEXTCALLBACK32A;
wineItem->cchTextMax = 0;
}
}
TREEVIEW_QueueRefresh (wndPtr);
......
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