More update() reasoning and TODOs.

This commit is contained in:
Pietro Gagliardi 2015-01-08 02:05:06 -05:00
parent ce64650aad
commit fe42db6ebd
3 changed files with 9 additions and 3 deletions

View File

@ -10,6 +10,8 @@ static void addColumn(struct table *t, WPARAM wParam, LPARAM lParam)
panic("invalid column type passed to tableAddColumn");
headerAddColumn(t, (WCHAR *) lParam);
update(t, TRUE);
// TODO only redraw the part of the client area where the new client went, if any
// (TODO when — if — adding autoresize, figure this one out)
}
HANDLER(apiHandlers)
@ -38,8 +40,9 @@ HANDLER(apiHandlers)
case tableSetRowCount:
rcp = (intptr_t *) lParam;
t->count = *rcp;
// TODO shouldn't we just redraw everything?
update(t, TRUE);
// we DO redraw everything because we don't want any rows that should no longer be there to remain on screen!
updateAll(t); // DONE
// TODO reset checkbox and selection logic if the current row for both no longer exists
*lResult = 0;
return TRUE;
}

View File

@ -61,6 +61,7 @@ static void headerAddColumn(struct table *t, WCHAR *name)
panic("error adding column to Table header");
}
// TODO is this triggered if we programmatically move headers (for autosizing)?
HANDLER(headerNotifyHandler)
{
NMHDR *nmhdr = (NMHDR *) lParam;
@ -71,7 +72,8 @@ HANDLER(headerNotifyHandler)
return FALSE;
update(t, TRUE);
// TODO make more intelligent
// (TODO is it actually needed?)
// to do this, we have to redraw the column to the left of the divider that was dragged and scroll everything to the right normally (leaving the hole that was scrolled invalidated as well)
// of course, this implies that dragging a divider only resizes the column of which it is the right side of and moves all others
InvalidateRect(t->hwnd, NULL, TRUE);
*lResult = 0;
return TRUE;

View File

@ -14,6 +14,7 @@ HANDLER(resizeHandler)
wp = (WINDOWPOS *) lParam;
if ((wp->flags & SWP_NOSIZE) != 0)
return FALSE;
// TODO redraw everything?
update(t, TRUE);
*lResult = 0;
return TRUE;