Fixed the checkbox y-offset issue. There are other issues, but this is more hopeful already...
This commit is contained in:
parent
2a2990f19c
commit
cd2a6f7c29
|
@ -174,20 +174,6 @@ static LRESULT onNM_CUSTOMDRAW(uiTable *t, NMLVCUSTOMDRAW *nm)
|
||||||
nm->clrText = blend(nm->clrTextBk, r, g, b, a);
|
nm->clrText = blend(nm->clrTextBk, r, g, b, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nm->iSubItem != 0) {
|
|
||||||
HWND header;
|
|
||||||
LRESULT margin;
|
|
||||||
header = (HWND) SendMessageW(t->hwnd, LVM_GETHEADER, NULL, NULL);
|
|
||||||
margin = SendMessageW(header, HDM_GETBITMAPMARGIN, 0, 0);
|
|
||||||
//nm->rcText.left -= margin;
|
|
||||||
printf("%d %d %d %d\n",
|
|
||||||
(int)(nm->nmcd.rc.left),
|
|
||||||
(int)(nm->nmcd.rc.top),
|
|
||||||
(int)(nm->nmcd.rc.right),
|
|
||||||
(int)(nm->nmcd.rc.bottom));
|
|
||||||
FillRect(nm->nmcd.hdc, &(nm->nmcd.rc), GetSysColorBrush(COLOR_ACTIVECAPTION));
|
|
||||||
return CDRF_SKIPDEFAULT;
|
|
||||||
}
|
|
||||||
// TODO draw background on image columns if needed
|
// TODO draw background on image columns if needed
|
||||||
ret = CDRF_NEWFONT;
|
ret = CDRF_NEWFONT;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -144,6 +144,8 @@ HRESULT uiprivNM_CUSTOMDRAWImagesCheckboxes(uiTable *t, NMLVCUSTOMDRAW *nm, LRES
|
||||||
uiprivTableColumnParams *p;
|
uiprivTableColumnParams *p;
|
||||||
int index;
|
int index;
|
||||||
RECT r;
|
RECT r;
|
||||||
|
RECT cellRect;
|
||||||
|
LONG yoff;
|
||||||
|
|
||||||
if (nm->nmcd.dwDrawStage == (CDDS_SUBITEM | CDDS_ITEMPREPAINT)) {
|
if (nm->nmcd.dwDrawStage == (CDDS_SUBITEM | CDDS_ITEMPREPAINT)) {
|
||||||
*lResult |= CDRF_NOTIFYPOSTPAINT;
|
*lResult |= CDRF_NOTIFYPOSTPAINT;
|
||||||
|
@ -166,14 +168,23 @@ HRESULT uiprivNM_CUSTOMDRAWImagesCheckboxes(uiTable *t, NMLVCUSTOMDRAW *nm, LRES
|
||||||
logLastError(L"LVM_GETSUBITEMRECT");
|
logLastError(L"LVM_GETSUBITEMRECT");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
#if 0
|
// the real listview also does this :|
|
||||||
// TODO this is offset by one pixel on my system and everything I've found indicates this should not be happening???
|
ZeroMemory(&cellRect, sizeof (RECT));
|
||||||
|
r.left = LVIR_BOUNDS;
|
||||||
|
r.top = nm->iSubItem;
|
||||||
|
if (SendMessageW(t->hwnd, LVM_GETSUBITEMRECT, nm->nmcd.dwItemSpec, (LPARAM) (&cellRect)) == 0) {
|
||||||
|
logLastError(L"LVM_GETSUBITEMRECT cell");
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
yoff = ((cellRect.bottom - cellRect.top) - (r.bottom - r.top)) / 2;
|
||||||
|
r.top += yoff;
|
||||||
|
r.bottom += yoff;
|
||||||
|
if ((nm->nmcd.dwItemSpec%2)==0)
|
||||||
if (ImageList_Draw(t->smallImages, index, nm->nmcd.hdc,
|
if (ImageList_Draw(t->smallImages, index, nm->nmcd.hdc,
|
||||||
r.left, r.top, ILD_NORMAL) == 0) {
|
r.left, r.top, ILD_NORMAL) == 0) {
|
||||||
logLastError(L"ImageList_Draw()");
|
logLastError(L"ImageList_Draw()");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue