David Hedberg : comctl32: Add support for expanded state image in treeview.

Alexandre Julliard julliard at winehq.org
Mon Jul 19 11:05:39 CDT 2010


Module: wine
Branch: master
Commit: e81d65f8d45abf2dc304d4f841a09537395a57f3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e81d65f8d45abf2dc304d4f841a09537395a57f3

Author: David Hedberg <david.hedberg at gmail.com>
Date:   Sat Jul 17 17:11:37 2010 +0200

comctl32: Add support for expanded state image in treeview.

---

 dlls/comctl32/treeview.c |   33 ++++++++++++++++++++++++++++++---
 1 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 860731e..9c95962 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -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;
 	}
 




More information about the wine-cvs mailing list