Commit e81d65f8 authored by David Hedberg's avatar David Hedberg Committed by Alexandre Julliard

comctl32: Add support for expanded state image in treeview.

parent e4cf1466
......@@ -76,6 +76,7 @@ typedef struct _TREEITEM /* HTREEITEM is a _TREEINFO *. */
int cchTextMax;
int iImage;
int iSelectedImage;
int iExpandedImage;
int cChildren;
LPARAM lParam;
int iIntegral; /* item height multiplier (1 is normal) */
......@@ -248,6 +249,10 @@ static inline BOOL item_changed (const TREEVIEW_ITEM *tiOld, const TREEVIEW_ITEM
tiNew->iSelectedImage != I_IMAGECALLBACK)
return TRUE;
if ((tvChange->mask & TVIF_EXPANDEDIMAGE) && (tiOld->iExpandedImage != tiNew->iExpandedImage) &&
tiNew->iExpandedImage != I_IMAGECALLBACK)
return TRUE;
/* Text has changed and it's not a callback */
if ((tvChange->mask & TVIF_TEXT) && (tiOld->pszText != tiNew->pszText) &&
tiNew->pszText != LPSTR_TEXTCALLBACKW)
......@@ -801,6 +806,9 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
if (mask & TVIF_SELECTEDIMAGE)
wineItem->iSelectedImage = callback.item.iSelectedImage;
if (mask & TVIF_EXPANDEDIMAGE)
wineItem->iExpandedImage = callback.item.iExpandedImage;
if (mask & TVIF_CHILDREN)
wineItem->cChildren = callback.item.cChildren;
......@@ -997,6 +1005,7 @@ TREEVIEW_AllocateItem(const TREEVIEW_INFO *infoPtr)
* inc/dec to toggle the images. */
newItem->iImage = 0;
newItem->iSelectedImage = 0;
newItem->iExpandedImage = 0;
if (DPA_InsertPtr(infoPtr->items, INT_MAX, newItem) == -1)
{
......@@ -1173,6 +1182,16 @@ TREEVIEW_DoSetItemT(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
callbackClear |= TVIF_SELECTEDIMAGE;
}
if (tvItem->mask & TVIF_EXPANDEDIMAGE)
{
wineItem->iExpandedImage = tvItem->iExpandedImage;
if (wineItem->iExpandedImage == I_IMAGECALLBACK)
callbackSet |= TVIF_EXPANDEDIMAGE;
else
callbackClear |= TVIF_EXPANDEDIMAGE;
}
if (tvItem->mask & TVIF_PARAM)
wineItem->lParam = tvItem->lParam;
......@@ -2076,6 +2095,9 @@ TREEVIEW_GetItemT(const TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem, BOOL isW)
if (tvItem->mask & TVIF_SELECTEDIMAGE)
tvItem->iSelectedImage = wineItem->iSelectedImage;
if (tvItem->mask & TVIF_EXPANDEDIMAGE)
tvItem->iExpandedImage = wineItem->iExpandedImage;
if (tvItem->mask & TVIF_STATE)
/* Careful here - Windows ignores the stateMask when you get the state
That contradicts the documentation, but makes more common sense, masking
......@@ -2539,8 +2561,8 @@ TREEVIEW_DrawItem(const TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem
ILD_NORMAL);
}
/* Now, draw the normal image; can be either selected or
* non-selected image.
/* Now, draw the normal image; can be either selected,
* non-selected or expanded image.
*/
if ((wineItem->state & TVIS_SELECTED) && (wineItem->iSelectedImage >= 0))
......@@ -2548,9 +2570,14 @@ TREEVIEW_DrawItem(const TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem
/* The item is currently selected */
imageIndex = wineItem->iSelectedImage;
}
else if ((wineItem->state & TVIS_EXPANDED) && (wineItem->iExpandedImage >= 0))
{
/* The item is currently not selected but expanded */
imageIndex = wineItem->iExpandedImage;
}
else
{
/* The item is not selected */
/* The item is not selected and not expanded */
imageIndex = wineItem->iImage;
}
......
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