[2/4] comctl32/listview: Introduce a way to update cached column rectangles from Header

Nikolay Sivov bunglehead at gmail.com
Mon Aug 3 15:55:27 CDT 2009


Changelog:
    - Introduce a way to update cached column rectangles from Header

>From 7199a10f066b4939ae986fede650ea81b1825dc1 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Tue, 4 Aug 2009 00:30:08 +0400
Subject: Introduce a way to update cached column rectangles from Header

---
 dlls/comctl32/listview.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 2d35992..0a862c8 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -290,6 +290,7 @@ typedef struct tagLISTVIEW_INFO
   HDPA hdpaPosX;		/* maintains the (X, Y) coordinates of the */
   HDPA hdpaPosY;		/* items in LVS_ICON, and LVS_SMALLICON modes */
   HDPA hdpaColumns;		/* array of COLUMN_INFO pointers */
+  BOOL colRectsDirty;		/* trigger column rectangles requery from header */
   POINT currIconPos;		/* this is the position next icon will be placed */
   PFNLVCOMPARE pfnCompare;
   LPARAM lParamSort;
@@ -1483,6 +1484,21 @@ static inline COLUMN_INFO * LISTVIEW_GetColumnInfo(const LISTVIEW_INFO *infoPtr,
 
     if (nSubItem == 0 && DPA_GetPtrCount(infoPtr->hdpaColumns) == 0) return &mainItem;
     assert (nSubItem >= 0 && nSubItem < DPA_GetPtrCount(infoPtr->hdpaColumns));
+
+    /* update cached column rectangles */
+    if (infoPtr->colRectsDirty)
+    {
+        COLUMN_INFO *info;
+        LISTVIEW_INFO *Ptr = (LISTVIEW_INFO*)infoPtr;
+        INT i;
+
+        for (i = 0; i < DPA_GetPtrCount(infoPtr->hdpaColumns); i++) {
+            info = DPA_GetPtr(infoPtr->hdpaColumns, i);
+            SendMessageW(infoPtr->hwndHeader, HDM_GETITEMRECT, i, (LPARAM)&info->rcHeader);
+        }
+        Ptr->colRectsDirty = FALSE;
+    }
+
     return DPA_GetPtr(infoPtr->hdpaColumns, nSubItem);
 }
 
@@ -8643,6 +8659,7 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs)
   infoPtr->xTrackLine = -1;  /* no track line */
   infoPtr->itemEdit.fEnabled = FALSE;
   infoPtr->iVersion = COMCTL32_VERSION;
+  infoPtr->colRectsDirty = FALSE;
 
   /* get default font (icon title) */
   SystemParametersInfoW(SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
-- 
1.5.6.5







More information about the wine-patches mailing list