diff --git a/windows/table.cpp b/windows/table.cpp index 9689a023..7a16e02c 100644 --- a/windows/table.cpp +++ b/windows/table.cpp @@ -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 } diff --git a/windows/table.hpp b/windows/table.hpp index 4820eaad..514af352 100644 --- a/windows/table.hpp +++ b/windows/table.hpp @@ -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); diff --git a/windows/tableimages.cpp b/windows/tableimages.cpp index 8bc563ac..278a88a5 100644 --- a/windows/tableimages.cpp +++ b/windows/tableimages.cpp @@ -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