Centered the table image.
This commit is contained in:
parent
f92c83992e
commit
4bfd950caa
|
@ -77,11 +77,21 @@ static HRESULT computeOtherRectsAndDrawBackgrounds(struct drawState *s)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void centerImageRect(RECT *image, RECT *space)
|
||||||
|
{
|
||||||
|
LONG yoff;
|
||||||
|
|
||||||
|
yoff = ((space->bottom - space->top) - (image->bottom - image->top)) / 2;
|
||||||
|
image->top += yoff;
|
||||||
|
image->bottom += yoff;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT drawImagePart(struct drawState *s)
|
static HRESULT drawImagePart(struct drawState *s)
|
||||||
{
|
{
|
||||||
uiTableData *data;
|
uiTableData *data;
|
||||||
IWICBitmap *wb;
|
IWICBitmap *wb;
|
||||||
HBITMAP b;
|
HBITMAP b;
|
||||||
|
RECT r;
|
||||||
UINT fStyle;
|
UINT fStyle;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
@ -110,13 +120,15 @@ static HRESULT drawImagePart(struct drawState *s)
|
||||||
// TODO error check
|
// TODO error check
|
||||||
DeleteObject(b);
|
DeleteObject(b);
|
||||||
|
|
||||||
|
r = s->subitemIcon;
|
||||||
|
r.right = r.left + s->cxIcon;
|
||||||
|
r.bottom = r.top + s->cyIcon;
|
||||||
|
centerImageRect(&r, &(s->subitemIcon));
|
||||||
fStyle = ILD_NORMAL;
|
fStyle = ILD_NORMAL;
|
||||||
if (s->selected)
|
if (s->selected)
|
||||||
fStyle = ILD_SELECTED;
|
fStyle = ILD_SELECTED;
|
||||||
// TODO copy the centering code from tableimage.cpp
|
|
||||||
if (ImageList_Draw(s->t->imagelist, 0,
|
if (ImageList_Draw(s->t->imagelist, 0,
|
||||||
s->dc, s->subitemIcon.left, s->subitemIcon.top,
|
s->dc, r.left, r.top, fStyle) == 0) {
|
||||||
fStyle) == 0) {
|
|
||||||
logLastError(L"ImageList_Draw()");
|
logLastError(L"ImageList_Draw()");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue