Mercurial > dwindows
changeset 1976:775ea7d5f497
Win: Changes to select different stripe colors based on dark mode.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 07 Aug 2019 08:26:18 +0000 |
parents | b2cb0ef3ec3d |
children | 0467eb85a25b |
files | win/dw.c |
diffstat | 1 files changed, 23 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/win/dw.c Wed Aug 07 00:25:15 2019 +0000 +++ b/win/dw.c Wed Aug 07 08:26:18 2019 +0000 @@ -3182,7 +3182,26 @@ { RECT rectUpd, rectDestin, rectThis, *rect = &rectThis; int iItems, iTop, i; - COLORREF c; + COLORREF c, odd, even; + unsigned long temp = _internal_color(continfo->odd); + + /* Create the colors based on the current theme */ + if(continfo->odd == DW_CLR_DEFAULT) + { +#ifdef AEROGLASS + if(_DW_DARK_MODE_ALLOWED == 2 && _DW_DARK_MODE_ENABLED) + odd = RGB(100,100,100); + else +#endif + odd = RGB(230, 230, 230); + } + else + odd = RGB(DW_RED_VALUE(temp), DW_GREEN_VALUE(temp), DW_BLUE_VALUE(temp)); + temp = _internal_color(continfo->even); + if(continfo->even == DW_CLR_DEFAULT) + even = DW_RGB_TRANSPARENT; + else + even = RGB(DW_RED_VALUE(temp), DW_GREEN_VALUE(temp), DW_BLUE_VALUE(temp)); /* Load the default background color for the first pass */ ListView_SetTextBkColor(hWnd, continfo->cinfo.back != -1 ? continfo->cinfo.back : ListView_GetBkColor(hWnd)); @@ -3201,7 +3220,7 @@ if(ListView_GetItemRect(hWnd, i, rect, LVIR_BOUNDS) && IntersectRect(&rectDestin, &rectUpd, rect)) { /* change text background colour accordingly */ - c = (i % 2) ? continfo->odd : continfo->even; + c = (i % 2) ? odd : even; if(c != DW_RGB_TRANSPARENT) { @@ -9745,25 +9764,14 @@ void API dw_container_set_stripe(HWND handle, unsigned long oddcolor, unsigned long evencolor) { ContainerInfo *cinfo = (ContainerInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); - unsigned long temp = _internal_color(oddcolor); - COLORREF even, odd = RGB(DW_RED_VALUE(temp), DW_GREEN_VALUE(temp), DW_BLUE_VALUE(temp)); - temp = _internal_color(evencolor); - even = RGB(DW_RED_VALUE(temp), DW_GREEN_VALUE(temp), DW_BLUE_VALUE(temp)); /* Drop out on error */ if(!cinfo) return; /* Create new brushes or remove if transparent */ - if(oddcolor != DW_RGB_TRANSPARENT) - cinfo->odd = (oddcolor == DW_CLR_DEFAULT ? RGB(230, 230, 230) : odd); - else - cinfo->odd = oddcolor; - - if(evencolor != DW_RGB_TRANSPARENT) - cinfo->even = (evencolor == DW_CLR_DEFAULT ? DW_RGB_TRANSPARENT : even); - else - cinfo->even = evencolor; + cinfo->odd = oddcolor; + cinfo->even = evencolor; } /*