Started indeterminate progress bars. This is gonna be interesting.
This commit is contained in:
parent
8769bea3a0
commit
c978f6fece
|
@ -31,6 +31,7 @@ struct uiTable {
|
||||||
int backgroundColumn;
|
int backgroundColumn;
|
||||||
// TODO make sure replacing images while selected in the listview is even allowed
|
// TODO make sure replacing images while selected in the listview is even allowed
|
||||||
HIMAGELIST imagelist;
|
HIMAGELIST imagelist;
|
||||||
|
LONG indeterminatePosition;
|
||||||
};
|
};
|
||||||
|
|
||||||
// tabledispinfo.cpp
|
// tabledispinfo.cpp
|
||||||
|
|
|
@ -311,13 +311,16 @@ static HRESULT drawTextPart(struct drawState *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// much of this is to imitate what shell32.dll's CDrawProgressBar does
|
// much of this is to imitate what shell32.dll's CDrawProgressBar does
|
||||||
|
#define indeterminateSegments 8
|
||||||
|
|
||||||
static HRESULT drawProgressBarPart(struct drawState *s)
|
static HRESULT drawProgressBarPart(struct drawState *s)
|
||||||
{
|
{
|
||||||
uiTableData *data;
|
uiTableData *data;
|
||||||
int progress;
|
int progress;
|
||||||
HTHEME theme;
|
HTHEME theme;
|
||||||
RECT r;
|
RECT r;
|
||||||
RECT rBorder, rFill;
|
RECT rBorder, rFill[2];
|
||||||
|
int i, nFill;
|
||||||
TEXTMETRICW tm;
|
TEXTMETRICW tm;
|
||||||
int sysColor;
|
int sysColor;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -327,8 +330,6 @@ static HRESULT drawProgressBarPart(struct drawState *s)
|
||||||
data = (*(s->m->mh->CellValue))(s->m->mh, s->m, s->iItem, s->p->progressBarModelColumn);
|
data = (*(s->m->mh->CellValue))(s->m->mh, s->m, s->iItem, s->p->progressBarModelColumn);
|
||||||
progress = uiTableDataInt(data);
|
progress = uiTableDataInt(data);
|
||||||
uiFreeTableData(data);
|
uiFreeTableData(data);
|
||||||
if (progress == -1)
|
|
||||||
return S_OK; // TODO
|
|
||||||
|
|
||||||
theme = OpenThemeData(s->t->hwnd, L"TODO");
|
theme = OpenThemeData(s->t->hwnd, L"TODO");
|
||||||
|
|
||||||
|
@ -366,16 +367,35 @@ static HRESULT drawProgressBarPart(struct drawState *s)
|
||||||
DeleteObject(pen);
|
DeleteObject(pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
rFill = r;
|
nFill = 1;
|
||||||
|
rFill[0] = r;
|
||||||
// TODO check error
|
// TODO check error
|
||||||
InflateRect(&rFill, -1, -1);
|
InflateRect(&rFill[0], -1, -1);
|
||||||
rFill.right -= (rFill.right - rFill.left) * (100 - progress) / 100;
|
if (progress != -1)
|
||||||
if (theme != NULL) {
|
rFill[0].right -= (rFill[0].right - rFill[0].left) * (100 - progress) / 100;
|
||||||
// TODO
|
else {
|
||||||
}/* else*/
|
LONG barWidth;
|
||||||
// TODO check errors
|
LONG pieceWidth;
|
||||||
FillRect(s->dc, &rFill, GetSysColorBrush(sysColor));
|
|
||||||
|
|
||||||
|
// TODO explain all this
|
||||||
|
rFill[1] = rFill[0]; // save in case we need it
|
||||||
|
barWidth = rFill[0].right - rFill[0].left;
|
||||||
|
pieceWidth = barWidth / indeterminateSegments;
|
||||||
|
rFill[0].left += s->t->indeterminatePosition % barWidth;
|
||||||
|
if ((rFill[0].left + pieceWidth) >= rFill[0].right) {
|
||||||
|
// make this piece wrap back around
|
||||||
|
nFill++;
|
||||||
|
rFill[1].right = rFill[1].left + (pieceWidth - (rFill[0].right - rFill[0].left));
|
||||||
|
} else
|
||||||
|
rFill[0].right = rFill[0].left + pieceWidth;
|
||||||
|
}
|
||||||
|
for (i = 0; i < nFill; i++)
|
||||||
|
{ if (theme != NULL) {
|
||||||
|
// TODO
|
||||||
|
}/* else*/
|
||||||
|
// TODO check errors
|
||||||
|
FillRect(s->dc, &rFill[i], GetSysColorBrush(sysColor));
|
||||||
|
}
|
||||||
hr = S_OK;
|
hr = S_OK;
|
||||||
fail:
|
fail:
|
||||||
// TODO check errors
|
// TODO check errors
|
||||||
|
|
Loading…
Reference in New Issue