Mercurial > dwindows
comparison win/dw.c @ 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 |
comparison
equal
deleted
inserted
replaced
1975:b2cb0ef3ec3d | 1976:775ea7d5f497 |
---|---|
3180 case WM_PAINT: | 3180 case WM_PAINT: |
3181 if(continfo->cinfo.pOldProc && (continfo->even != DW_RGB_TRANSPARENT || continfo->odd != DW_RGB_TRANSPARENT)) | 3181 if(continfo->cinfo.pOldProc && (continfo->even != DW_RGB_TRANSPARENT || continfo->odd != DW_RGB_TRANSPARENT)) |
3182 { | 3182 { |
3183 RECT rectUpd, rectDestin, rectThis, *rect = &rectThis; | 3183 RECT rectUpd, rectDestin, rectThis, *rect = &rectThis; |
3184 int iItems, iTop, i; | 3184 int iItems, iTop, i; |
3185 COLORREF c; | 3185 COLORREF c, odd, even; |
3186 unsigned long temp = _internal_color(continfo->odd); | |
3187 | |
3188 /* Create the colors based on the current theme */ | |
3189 if(continfo->odd == DW_CLR_DEFAULT) | |
3190 { | |
3191 #ifdef AEROGLASS | |
3192 if(_DW_DARK_MODE_ALLOWED == 2 && _DW_DARK_MODE_ENABLED) | |
3193 odd = RGB(100,100,100); | |
3194 else | |
3195 #endif | |
3196 odd = RGB(230, 230, 230); | |
3197 } | |
3198 else | |
3199 odd = RGB(DW_RED_VALUE(temp), DW_GREEN_VALUE(temp), DW_BLUE_VALUE(temp)); | |
3200 temp = _internal_color(continfo->even); | |
3201 if(continfo->even == DW_CLR_DEFAULT) | |
3202 even = DW_RGB_TRANSPARENT; | |
3203 else | |
3204 even = RGB(DW_RED_VALUE(temp), DW_GREEN_VALUE(temp), DW_BLUE_VALUE(temp)); | |
3186 | 3205 |
3187 /* Load the default background color for the first pass */ | 3206 /* Load the default background color for the first pass */ |
3188 ListView_SetTextBkColor(hWnd, continfo->cinfo.back != -1 ? continfo->cinfo.back : ListView_GetBkColor(hWnd)); | 3207 ListView_SetTextBkColor(hWnd, continfo->cinfo.back != -1 ? continfo->cinfo.back : ListView_GetBkColor(hWnd)); |
3189 /* get the rectangle to be updated */ | 3208 /* get the rectangle to be updated */ |
3190 GetUpdateRect(hWnd, &rectUpd, FALSE); | 3209 GetUpdateRect(hWnd, &rectUpd, FALSE); |
3199 { | 3218 { |
3200 /* if row rectangle intersects update rectangle then it requires re-drawing */ | 3219 /* if row rectangle intersects update rectangle then it requires re-drawing */ |
3201 if(ListView_GetItemRect(hWnd, i, rect, LVIR_BOUNDS) && IntersectRect(&rectDestin, &rectUpd, rect)) | 3220 if(ListView_GetItemRect(hWnd, i, rect, LVIR_BOUNDS) && IntersectRect(&rectDestin, &rectUpd, rect)) |
3202 { | 3221 { |
3203 /* change text background colour accordingly */ | 3222 /* change text background colour accordingly */ |
3204 c = (i % 2) ? continfo->odd : continfo->even; | 3223 c = (i % 2) ? odd : even; |
3205 | 3224 |
3206 if(c != DW_RGB_TRANSPARENT) | 3225 if(c != DW_RGB_TRANSPARENT) |
3207 { | 3226 { |
3208 ListView_SetTextBkColor(hWnd, c); | 3227 ListView_SetTextBkColor(hWnd, c); |
3209 /* invalidate the row rectangle then... */ | 3228 /* invalidate the row rectangle then... */ |
9743 * DW_CLR_DEFAULT will use the system default alternating row colors. | 9762 * DW_CLR_DEFAULT will use the system default alternating row colors. |
9744 */ | 9763 */ |
9745 void API dw_container_set_stripe(HWND handle, unsigned long oddcolor, unsigned long evencolor) | 9764 void API dw_container_set_stripe(HWND handle, unsigned long oddcolor, unsigned long evencolor) |
9746 { | 9765 { |
9747 ContainerInfo *cinfo = (ContainerInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); | 9766 ContainerInfo *cinfo = (ContainerInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); |
9748 unsigned long temp = _internal_color(oddcolor); | |
9749 COLORREF even, odd = RGB(DW_RED_VALUE(temp), DW_GREEN_VALUE(temp), DW_BLUE_VALUE(temp)); | |
9750 temp = _internal_color(evencolor); | |
9751 even = RGB(DW_RED_VALUE(temp), DW_GREEN_VALUE(temp), DW_BLUE_VALUE(temp)); | |
9752 | 9767 |
9753 /* Drop out on error */ | 9768 /* Drop out on error */ |
9754 if(!cinfo) | 9769 if(!cinfo) |
9755 return; | 9770 return; |
9756 | 9771 |
9757 /* Create new brushes or remove if transparent */ | 9772 /* Create new brushes or remove if transparent */ |
9758 if(oddcolor != DW_RGB_TRANSPARENT) | 9773 cinfo->odd = oddcolor; |
9759 cinfo->odd = (oddcolor == DW_CLR_DEFAULT ? RGB(230, 230, 230) : odd); | 9774 cinfo->even = evencolor; |
9760 else | |
9761 cinfo->odd = oddcolor; | |
9762 | |
9763 if(evencolor != DW_RGB_TRANSPARENT) | |
9764 cinfo->even = (evencolor == DW_CLR_DEFAULT ? DW_RGB_TRANSPARENT : even); | |
9765 else | |
9766 cinfo->even = evencolor; | |
9767 } | 9775 } |
9768 | 9776 |
9769 /* | 9777 /* |
9770 * Sets the width of a column in the container. | 9778 * Sets the width of a column in the container. |
9771 * Parameters: | 9779 * Parameters: |