Split the code to compute the last visible item in the new Windows Table into its own function. This is needed for keyboard vertical scrolling.
This commit is contained in:
parent
f11b1141fb
commit
93046dc868
|
@ -148,6 +148,17 @@ static void repositionHeader(struct table *t)
|
||||||
t->headerHeight = headerpos.cy;
|
t->headerHeight = headerpos.cy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cliprect and rowHeight must be specified here to avoid recomputing things multiple times
|
||||||
|
static intptr_t lastVisible(struct table *t, RECT cliprect, LONG rowHeight)
|
||||||
|
{
|
||||||
|
intptr_t last;
|
||||||
|
|
||||||
|
last = ((cliprect.bottom + rowHeight - 1) / rowHeight) + t->firstVisible;
|
||||||
|
if (last >= t->count)
|
||||||
|
last = t->count;
|
||||||
|
return last;
|
||||||
|
}
|
||||||
|
|
||||||
static intptr_t hitTestColumn(struct table *t, int x)
|
static intptr_t hitTestColumn(struct table *t, int x)
|
||||||
{
|
{
|
||||||
HDITEMW item;
|
HDITEMW item;
|
||||||
|
@ -623,9 +634,7 @@ static void drawItems(struct table *t, HDC dc, RECT cliprect)
|
||||||
first = (cliprect.top / height) + t->firstVisible;
|
first = (cliprect.top / height) + t->firstVisible;
|
||||||
if (first < 0)
|
if (first < 0)
|
||||||
first = 0;
|
first = 0;
|
||||||
last = ((cliprect.bottom + height - 1) / height) + t->firstVisible;
|
last = lastVisible(t, cliprect, height);
|
||||||
if (last >= t->count)
|
|
||||||
last = t->count;
|
|
||||||
|
|
||||||
// now for the first y, discount firstVisible
|
// now for the first y, discount firstVisible
|
||||||
y = (first - t->firstVisible) * height;
|
y = (first - t->firstVisible) * height;
|
||||||
|
|
Loading…
Reference in New Issue