comparison win/dw.c @ 1214:e16e7c51b6c7

Another attempt at fixing alternating row issues on Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 09 Oct 2011 10:24:21 +0000
parents 22cedf18db25
children 10f5b8645975
comparison
equal deleted inserted replaced
1213:22cedf18db25 1214:e16e7c51b6c7
2709 ListView_SetTextBkColor(hWnd, cinfo->cinfo.back != -1 ? cinfo->cinfo.back : ListView_GetBkColor(hWnd)); 2709 ListView_SetTextBkColor(hWnd, cinfo->cinfo.back != -1 ? cinfo->cinfo.back : ListView_GetBkColor(hWnd));
2710 /* get the rectangle to be updated */ 2710 /* get the rectangle to be updated */
2711 GetUpdateRect(hWnd, &rectUpd, FALSE); 2711 GetUpdateRect(hWnd, &rectUpd, FALSE);
2712 /* allow default processing first */ 2712 /* allow default processing first */
2713 CallWindowProc(cinfo->cinfo.pOldProc, hWnd, msg, 0, 0); 2713 CallWindowProc(cinfo->cinfo.pOldProc, hWnd, msg, 0, 0);
2714 /* set the row horizontal dimensions */
2715 SetRect(&rect, rectUpd.left, 0, rectUpd.right, 0);
2716 /* number of displayed rows */ 2714 /* number of displayed rows */
2717 iItems = ListView_GetCountPerPage(hWnd); 2715 iItems = ListView_GetCountPerPage(hWnd);
2718 /* first visible row */ 2716 /* first visible row */
2719 iTop = ListView_GetTopIndex(hWnd); 2717 iTop = ListView_GetTopIndex(hWnd);
2720 2718
2721 for(i=iTop; i<=iTop+iItems; i++) 2719 for(i=iTop; i<=(iTop+iItems+1); i++)
2722 { 2720 {
2723 /* Get the row's rect */
2724 ListView_GetItemRect(hWnd, i, &rect, LVIR_BOUNDS);
2725 /* if row rectangle intersects update rectangle then it requires re-drawing */ 2721 /* if row rectangle intersects update rectangle then it requires re-drawing */
2726 if(IntersectRect(&rectDestin, &rectUpd, &rect)) 2722 if(ListView_GetItemRect(hWnd, i, &rect, LVIR_BOUNDS) && IntersectRect(&rectDestin, &rectUpd, &rect))
2727 { 2723 {
2728 /* change text background colour accordingly */ 2724 /* change text background colour accordingly */
2729 c = (i % 2) ? cinfo->odd : cinfo->even; 2725 c = (i % 2) ? cinfo->odd : cinfo->even;
2730 2726
2731 if(c != DW_RGB_TRANSPARENT) 2727 if(c != DW_RGB_TRANSPARENT)
2732 { 2728 {
2733 ListView_SetTextBkColor(hWnd, c); 2729 ListView_SetTextBkColor(hWnd, c);
2734 /* invalidate the row rectangle then... */ 2730 /* invalidate the row rectangle then... */
2735 InvalidateRect(hWnd, &rect, FALSE); 2731 InvalidateRect(hWnd, &rectDestin, FALSE);
2736 /* ...force default processing */ 2732 /* ...force default processing */
2737 CallWindowProc(cinfo->cinfo.pOldProc, hWnd, msg, 0, 0); 2733 CallWindowProc(cinfo->cinfo.pOldProc, hWnd, msg, 0, 0);
2738 } 2734 }
2739 } 2735 }
2740 } 2736 }