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

This commit is contained in:
Nikolay Sivov 2009-07-09 02:58:11 +04:00 committed by Alexandre Julliard
parent 1cd8512695
commit 6c0c08af02
1 changed files with 39 additions and 20 deletions

View File

@ -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))
{
@ -4145,26 +4184,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);
if (infoPtr->uView == LV_VIEW_ICON)