* 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.
This commit is contained in:
Alex Priem 1998-12-10 09:54:17 +00:00 committed by Alexandre Julliard
parent 658e35be81
commit 65b637bec4
1 changed files with 25 additions and 8 deletions

View File

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