Switched checkboxes from postpaint to prepaint and turned off drawing everything while we slowly transition everything over.

This commit is contained in:
Pietro Gagliardi 2018-06-12 08:17:31 -04:00
parent e52373c59a
commit f28c97d4d6
3 changed files with 7 additions and 12 deletions

View File

@ -236,7 +236,7 @@ static LRESULT onNM_CUSTOMDRAW(uiTable *t, NMLVCUSTOMDRAW *nm)
}
}
// TODO draw background on image columns if needed
ret = CDRF_NEWFONT;
ret = CDRF_SKIPDEFAULT | CDRF_NEWFONT;
break;
case CDDS_SUBITEM | CDDS_ITEMPOSTPAINT:
if(nm->iSubItem == 1) {
@ -260,7 +260,7 @@ if ((nm->nmcd.dwDrawStage & CDDS_SUBITEM) == 0)return ret;
if (hr != S_OK) {
// TODO
}
hr = uiprivNM_CUSTOMDRAWImagesCheckboxes(t, nm, &dp, &ret);
hr = uiprivNM_CUSTOMDRAWImagesCheckboxes(t, nm, &dp);
if (hr != S_OK) {
// TODO
}

View File

@ -52,5 +52,5 @@ struct uiprivSubitemDrawParams {
// tableimages.cpp
extern HRESULT uiprivLVN_GETDISPINFOImagesCheckboxes(uiTable *t, NMLVDISPINFOW *nm, uiprivTableColumnParams *p);
extern HRESULT uiprivNM_CUSTOMDRAWImagesCheckboxes(uiTable *t, NMLVCUSTOMDRAW *nm, uiprivSubitemDrawParams *dp, LRESULT *lResult);
extern HRESULT uiprivNM_CUSTOMDRAWImagesCheckboxes(uiTable *t, NMLVCUSTOMDRAW *nm, uiprivSubitemDrawParams *dp);
extern HRESULT uiprivTableSetupImagesCheckboxes(uiTable *t);

View File

@ -136,10 +136,9 @@ HRESULT uiprivLVN_GETDISPINFOImagesCheckboxes(uiTable *t, NMLVDISPINFOW *nm, uip
}
// in order to properly look like checkboxes, we need to exclude them from being colored in by the selection rect
// however, there seems to be no way to do this natively, so we have to draw over ourselves (TODO?)
// hopefully the performance won't be too bad
// see also https://www.codeproject.com/Articles/79/Neat-Stuff-to-Do-in-List-Controls-Using-Custom-Dra
HRESULT uiprivNM_CUSTOMDRAWImagesCheckboxes(uiTable *t, NMLVCUSTOMDRAW *nm, uiprivSubitemDrawParams *dp, LRESULT *lResult)
// however, there seems to be no way to do this natively, so we have to draw the icons ourselves
// see also https://www.codeproject.com/Articles/79/Neat-Stuff-to-Do-in-List-Controls-Using-Custom-Dra (and while this uses postpaint to draw over the existing icon, we are drawing everything ourselves, so we only draw once)
HRESULT uiprivNM_CUSTOMDRAWImagesCheckboxes(uiTable *t, NMLVCUSTOMDRAW *nm, uiprivSubitemDrawParams *dp)
{
uiprivTableColumnParams *p;
int index;
@ -147,11 +146,7 @@ HRESULT uiprivNM_CUSTOMDRAWImagesCheckboxes(uiTable *t, NMLVCUSTOMDRAW *nm, uipr
int cxIcon, cyIcon;
LONG yoff;
if (nm->nmcd.dwDrawStage == (CDDS_SUBITEM | CDDS_ITEMPREPAINT)) {
*lResult |= CDRF_NOTIFYPOSTPAINT;
return S_OK;
}
if (nm->nmcd.dwDrawStage != (CDDS_SUBITEM | CDDS_ITEMPOSTPAINT))
if (nm->nmcd.dwDrawStage != (CDDS_SUBITEM | CDDS_ITEMPREPAINT))
return S_OK;
// only draw over checkboxes