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