]> git.saurik.com Git - wxWidgets.git/commitdiff
fix custom draw bug for controls with only one column (patch 1731024)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 9 Jun 2007 10:57:25 +0000 (10:57 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 9 Jun 2007 10:57:25 +0000 (10:57 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46382 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/listctrl.cpp

index db616b8940ab35ac3126ff028e46c4486c6bed26..f61b3fd9ca4354fdd4f26bc183f56f13f893ce89 100644 (file)
@@ -2417,7 +2417,8 @@ static RECT GetCustomDrawnItemRect(const NMCUSTOMDRAW& nmcd)
     return rc;
 }
 
-static bool HandleSubItemPrepaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont)
+static
+bool HandleSubItemPrepaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont, int colCount)
 {
     NMCUSTOMDRAW& nmcd = pLVCD->nmcd;
 
@@ -2432,7 +2433,7 @@ static bool HandleSubItemPrepaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont)
     // get the rectangle to paint
     RECT rc;
     ListView_GetSubItemRect(hwndList, item, col, LVIR_BOUNDS, &rc);
-    if ( !col )
+    if ( !col && colCount > 1 )
     {
         // broken ListView_GetSubItemRect() returns the entire item rect for
         // 0th subitem while we really need just the part for this column
@@ -2602,7 +2603,7 @@ static void HandleItemPaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont)
     for ( int col = 0; col < colCount; col++ )
     {
         pLVCD->iSubItem = col;
-        HandleSubItemPrepaint(pLVCD, hfont);
+        HandleSubItemPrepaint(pLVCD, hfont, colCount);
     }
 
     HandleItemPostpaint(nmcd);