Nikolay Sivov : comctl32/listview: Fix selection and focus rectangles on reordered list (report mode).

Alexandre Julliard julliard at winehq.org
Thu Jul 9 10:56:58 CDT 2009


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

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Thu Jul  9 02:58:11 2009 +0400

comctl32/listview: Fix selection and focus rectangles on reordered list (report mode).

---

 dlls/comctl32/listview.c |   59 ++++++++++++++++++++++++++++++---------------
 1 files changed, 39 insertions(+), 20 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index cd1d0d5..73781b2 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -4120,6 +4120,45 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
     if (nSubItem && infoPtr->uView == LV_VIEW_DETAILS && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
 	nmlvcd.clrTextBk = CLR_NONE;
 
+    /* FIXME: temporary hack */
+    rcSelect.left = rcLabel.left;
+
+    /* draw the selection background, if we're drawing the main item */
+    if (nSubItem == 0)
+    {
+        /* in icon mode, the label rect is really what we want to draw the
+         * background for */
+        if (infoPtr->uView == LV_VIEW_ICON)
+	    rcSelect = rcLabel;
+
+	if (infoPtr->uView == LV_VIEW_DETAILS && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
+	{
+	    /* we have to update left focus bound too if item isn't in leftmost column
+	       and reduce right box bound */
+	    if (DPA_GetPtrCount(infoPtr->hdpaColumns) > 0)
+	    {
+		INT leftmost;
+
+	        if ((leftmost = SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX, 0, 0)))
+	        {
+		    INT Originx = pos.x - LISTVIEW_GetColumnInfo(infoPtr, 0)->rcHeader.left;
+		    INT index = SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX,
+				DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, 0);
+
+		    rcBox.right   = LISTVIEW_GetColumnInfo(infoPtr, index)->rcHeader.right + Originx;
+		    rcSelect.left = LISTVIEW_GetColumnInfo(infoPtr, leftmost)->rcHeader.left + Originx;
+	        }
+	    }
+
+	    rcSelect.right = rcBox.right;
+	}
+
+	if (nmlvcd.clrTextBk != CLR_NONE)
+	    ExtTextOutW(hdc, rcSelect.left, rcSelect.top, ETO_OPAQUE, &rcSelect, NULL, 0, NULL);
+	/* store new focus rectangle */
+	if (infoPtr->nFocusedItem == nItem) infoPtr->rcFocus = rcSelect;
+    }
+
     /* state icons */
     if (infoPtr->himlState && STATEIMAGEINDEX(lvItem.state) && (nSubItem == 0))
     {
@@ -4144,26 +4183,6 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
 
     /* Don't bother painting item being edited */
     if (infoPtr->hwndEdit && nItem == infoPtr->nEditLabelItem && nSubItem == 0) goto postpaint;
-
-    /* FIXME: temporary hack */
-    rcSelect.left = rcLabel.left;
-
-    /* draw the selection background, if we're drawing the main item */
-    if (nSubItem == 0)
-    {
-        /* in icon mode, the label rect is really what we want to draw the
-         * background for */
-        if (infoPtr->uView == LV_VIEW_ICON)
-	    rcSelect = rcLabel;
-
-	if (infoPtr->uView == LV_VIEW_DETAILS && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
-	    rcSelect.right = rcBox.right;
-
-    	if (nmlvcd.clrTextBk != CLR_NONE) 
-            ExtTextOutW(hdc, rcSelect.left, rcSelect.top, ETO_OPAQUE, &rcSelect, 0, 0, 0);
-	/* store new focus rectangle */
-	if (infoPtr->nFocusedItem == nItem) infoPtr->rcFocus = rcSelect;
-    }
    
     /* figure out the text drawing flags */
     uFormat = (infoPtr->uView == LV_VIEW_ICON ? (lprcFocus ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS) : LV_SL_DT_FLAGS);




More information about the wine-cvs mailing list