# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1318155196 0 # Node ID 22cedf18db25625b94ce5e1cbd029534b86dfdad # Parent 5271d5cb27ac6df04658571c0a8f89ff9c7af0a8 Fixed a slight miscalculation and simplified the Windows container row code. Also added alternating row colors to the test program and updated readme. diff -r 5271d5cb27ac -r 22cedf18db25 dwtest.c --- a/dwtest.c Sun Oct 09 09:50:07 2011 +0000 +++ b/dwtest.c Sun Oct 09 10:13:16 2011 +0000 @@ -1024,6 +1024,7 @@ titles[3] = "Date"; dw_filesystem_setup(container, flags, titles, 4); + dw_container_set_row_bg(container, DW_CLR_DEFAULT, DW_CLR_DEFAULT); containerinfo = dw_container_alloc(container, 3); for(z=0;z<3;z++) diff -r 5271d5cb27ac -r 22cedf18db25 readme --- a/readme Sun Oct 09 09:50:07 2011 +0000 +++ b/readme Sun Oct 09 10:13:16 2011 +0000 @@ -53,7 +53,7 @@ Added dw_container_set_row_data() and dw_container_change_row_data() macros which just call dw_container_set/change_row_title() but with (void *). Added dw_container_set_row_bg() to set alternating row colors. - Currently only Mac and GTK3 support. Windows and GTK2 in progress. + Currently Mac, Win and GTK3 are supported. GTK2 in progress. Improved container optimization on Mac, header width now taken into account. Fixes for incorrect return codes from the dw_event_* functions on Windows. Fixes for incorrect behavior on key_press callbacks on Mac and Windows. diff -r 5271d5cb27ac -r 22cedf18db25 win/dw.c --- a/win/dw.c Sun Oct 09 09:50:07 2011 +0000 +++ b/win/dw.c Sun Oct 09 10:13:16 2011 +0000 @@ -2702,7 +2702,6 @@ if(cinfo->cinfo.pOldProc && (cinfo->even != DW_RGB_TRANSPARENT || cinfo->odd != DW_RGB_TRANSPARENT)) { RECT rectUpd, rectDestin, rect; - POINT pt; int iItems, iTop, i; COLORREF c; @@ -2719,18 +2718,15 @@ /* first visible row */ iTop = ListView_GetTopIndex(hWnd); - ListView_GetItemPosition(hWnd, iTop, &pt); - for(i=iTop; i<=(iTop+iItems)+1; i++) + for(i=iTop; i<=iTop+iItems; i++) { - /* set row vertical dimensions */ - rect.top = pt.y; - ListView_GetItemPosition(hWnd, i, &pt); - rect.bottom = pt.y; + /* Get the row's rect */ + ListView_GetItemRect(hWnd, i, &rect, LVIR_BOUNDS); /* if row rectangle intersects update rectangle then it requires re-drawing */ if(IntersectRect(&rectDestin, &rectUpd, &rect)) { /* change text background colour accordingly */ - c = (i % 2) ? cinfo->even : cinfo->odd; + c = (i % 2) ? cinfo->odd : cinfo->even; if(c != DW_RGB_TRANSPARENT) {