From 1dcdcd522cf1e63fd61f4ca376d4108a775a1565 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 8 Jan 2015 01:45:06 -0500 Subject: Collected all of the metric updating stuff into a single update() function. Far from optimal, but much better. --- wintable/api.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'wintable/api.h') diff --git a/wintable/api.h b/wintable/api.h index bf259ad..260202e 100644 --- a/wintable/api.h +++ b/wintable/api.h @@ -9,7 +9,7 @@ static void addColumn(struct table *t, WPARAM wParam, LPARAM lParam) if (t->columnTypes[t->nColumns - 1] >= nTableColumnTypes) panic("invalid column type passed to tableAddColumn"); headerAddColumn(t, (WCHAR *) lParam); - updateTableWidth(t); + update(t, TRUE); } HANDLER(apiHandlers) @@ -21,8 +21,11 @@ HANDLER(apiHandlers) // don't free the old font; see http://blogs.msdn.com/b/oldnewthing/archive/2008/09/12/8945692.aspx t->font = (HFONT) wParam; SendMessageW(t->header, WM_SETFONT, wParam, lParam); - // TODO how to properly handle LOWORD(lParam) != FALSE? - // TODO depending on the result of the above, update table width to refresh t->headerHeight? + update(t, LOWORD(lParam) != FALSE); + // TODO is this needed? + if (LOWORD(lParam) != FALSE) + // TODO check error + InvalidateRect(t->hwnd, NULL, TRUE); *lResult = 0; return TRUE; case WM_GETFONT: @@ -35,8 +38,8 @@ HANDLER(apiHandlers) case tableSetRowCount: rcp = (intptr_t *) lParam; t->count = *rcp; - // TODO refresh table in this way? - updateTableWidth(t); + // TODO shouldn't we just redraw everything? + update(t, TRUE); *lResult = 0; return TRUE; } -- cgit v1.2.3