Fixed build errors. The image list selection part works, at least!! Let's figure out why nothing else does.
This commit is contained in:
parent
43bb983f5b
commit
f852359acb
|
@ -125,10 +125,8 @@ HRESULT uiprivWICToGDI(IWICBitmap *b, HDC dc, int width, int height, HBITMAP *hb
|
||||||
{
|
{
|
||||||
UINT ux, uy;
|
UINT ux, uy;
|
||||||
int x, y;
|
int x, y;
|
||||||
IWICImageSource *src;
|
IWICBitmapSource *src;
|
||||||
BITMAPINFO bmi;
|
BITMAPINFO bmi;
|
||||||
UINT width, height;
|
|
||||||
HBITMAP hb;
|
|
||||||
VOID *bits;
|
VOID *bits;
|
||||||
BITMAP bmp;
|
BITMAP bmp;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
|
@ -29,14 +29,8 @@ struct uiTable {
|
||||||
std::vector<uiprivTableColumnParams *> *columns;
|
std::vector<uiprivTableColumnParams *> *columns;
|
||||||
WPARAM nColumns;
|
WPARAM nColumns;
|
||||||
int backgroundColumn;
|
int backgroundColumn;
|
||||||
|
// TODO make sure replacing images while selected in the listview is even allowed
|
||||||
// tableimages.cpp
|
HIMAGELIST imagelist;
|
||||||
// TODO make sure what we're doing is even allowed
|
|
||||||
HIMAGELIST smallImages;
|
|
||||||
int smallIndex;
|
|
||||||
|
|
||||||
// custom draw state
|
|
||||||
COLORREF clrItemText;
|
|
||||||
};
|
};
|
||||||
typedef struct uiprivSubitemDrawParams uiprivSubitemDrawParams;
|
typedef struct uiprivSubitemDrawParams uiprivSubitemDrawParams;
|
||||||
struct uiprivSubitemDrawParams {
|
struct uiprivSubitemDrawParams {
|
||||||
|
|
|
@ -88,22 +88,22 @@ static HRESULT drawImagePart(struct drawState *s)
|
||||||
if (s->p->imageModelColumn == -1)
|
if (s->p->imageModelColumn == -1)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
data = (*(t->model->mh->CellValue))(t->model->mh, t->model, nm->item.iItem, p->imageModelColumn);
|
data = (*(s->m->mh->CellValue))(s->m->mh, s->m, s->iItem, s->p->imageModelColumn);
|
||||||
wb = uiprivImageAppropriateForDC(uiTableDataImage(data), s->dc);
|
wb = uiprivImageAppropriateForDC(uiTableDataImage(data), s->dc);
|
||||||
uiFreeTableData(data);
|
uiFreeTableData(data);
|
||||||
|
|
||||||
hr = uiprivWICToGDI(wb, s->cxIcon, s->cyIcon, &b);
|
hr = uiprivWICToGDI(wb, s->dc, s->cxIcon, s->cyIcon, &b);
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
return hr;
|
return hr;
|
||||||
// TODO rewrite this condition to make more sense; possibly swap the if and else blocks too
|
// TODO rewrite this condition to make more sense; possibly swap the if and else blocks too
|
||||||
// TODO proper cleanup
|
// TODO proper cleanup
|
||||||
if (ImageList_GetImageCount(t->imagelist) > 1) {
|
if (ImageList_GetImageCount(s->t->imagelist) > 1) {
|
||||||
if (ImageList_Replace(t->imagelist, 0, b, NULL) == 0) {
|
if (ImageList_Replace(s->t->imagelist, 0, b, NULL) == 0) {
|
||||||
logLastError(L"ImageList_Replace()");
|
logLastError(L"ImageList_Replace()");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (ImageList_Add(t->imagelist, b, NULL) == -1) {
|
if (ImageList_Add(s->t->imagelist, b, NULL) == -1) {
|
||||||
logLastError(L"ImageList_Add()");
|
logLastError(L"ImageList_Add()");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ static HRESULT drawImagePart(struct drawState *s)
|
||||||
if (s->selected)
|
if (s->selected)
|
||||||
fStyle = ILD_SELECTED;
|
fStyle = ILD_SELECTED;
|
||||||
// TODO copy the centering code from tableimage.cpp
|
// TODO copy the centering code from tableimage.cpp
|
||||||
if (ImageList_Draw(t->imagelist, 0,
|
if (ImageList_Draw(s->t->imagelist, 0,
|
||||||
s->dc, s->subitemIcon.left, s->subitemIcon.top,
|
s->dc, s->subitemIcon.left, s->subitemIcon.top,
|
||||||
fStyle) == 0) {
|
fStyle) == 0) {
|
||||||
logLastError(L"ImageList_Draw()");
|
logLastError(L"ImageList_Draw()");
|
||||||
|
@ -420,12 +420,12 @@ HRESULT uiprivUpdateImageListSize(uiTable *t)
|
||||||
t->imagelist = ImageList_Create(cxList, cyList,
|
t->imagelist = ImageList_Create(cxList, cyList,
|
||||||
ILC_COLOR32,
|
ILC_COLOR32,
|
||||||
1, 1);
|
1, 1);
|
||||||
if (t->smallImages == NULL) {
|
if (t->imagelist == NULL) {
|
||||||
logLastError(L"ImageList_Create()");
|
logLastError(L"ImageList_Create()");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
// TODO will this return NULL here because it's an initial state?
|
// TODO will this return NULL here because it's an initial state?
|
||||||
SendMessageW(t->hwnd, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM) (t->smallImages));
|
SendMessageW(t->hwnd, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM) (t->imagelist));
|
||||||
|
|
||||||
hr = CloseThemeData(theme);
|
hr = CloseThemeData(theme);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
|
|
|
@ -69,7 +69,9 @@ HRESULT uiprivLVN_GETDISPINFOImagesCheckboxes(uiTable *t, NMLVDISPINFOW *nm, uip
|
||||||
return S_OK; // nothing to do here
|
return S_OK; // nothing to do here
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
nm->item.iImage = 0;
|
nm->item.iImage = -1;
|
||||||
|
if (p->imageModelColumn != -1 || p->checkboxModelColumn != -1)
|
||||||
|
nm->item.iImage = 0;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
if (p->imageModelColumn != -1) {
|
if (p->imageModelColumn != -1) {
|
||||||
|
@ -100,6 +102,8 @@ HRESULT uiprivLVN_GETDISPINFOImagesCheckboxes(uiTable *t, NMLVDISPINFOW *nm, uip
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
// in order to properly look like checkboxes, we need to exclude them from being colored in by the selection rect
|
// 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 the icons ourselves
|
// 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)
|
// 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)
|
||||||
|
@ -264,3 +268,5 @@ static HRESULT mkCheckboxes(uiTable *t, HTHEME theme, HDC dc, int cxList, int cy
|
||||||
DeleteObject(b);
|
DeleteObject(b);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue