From a8fed6c28d1c81fbaf5457ad7df905f7de92ec9f Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 10 Dec 2014 10:01:16 -0500 Subject: [PATCH] Changed from recomputeHScroll() to updateTableWidth() as we will store the table width separately and just use one call to SetScrollInfo() for everything to avoid weirdness. --- wintable/new/api.h | 2 +- wintable/new/header.h | 8 ++++++-- wintable/new/resize.h | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/wintable/new/api.h b/wintable/new/api.h index d3ec3f7..535a940 100644 --- a/wintable/new/api.h +++ b/wintable/new/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); - recomputeHScroll(t); + updateTableWidth(t); } HANDLER(apiHandlers) diff --git a/wintable/new/header.h b/wintable/new/header.h index 0f23a9a..47c13b2 100644 --- a/wintable/new/header.h +++ b/wintable/new/header.h @@ -53,6 +53,11 @@ static void headerAddColumn(struct table *t, WCHAR *name) panic("error adding column to Table header"); } +static void updateTableWidth(struct table *t) +{ + recomputeHScroll(t); +} + HANDLER(headerNotifyHandler) { NMHDR *nmhdr = (NMHDR *) lParam; @@ -61,8 +66,7 @@ HANDLER(headerNotifyHandler) return FALSE; if (nmhdr->code != HDN_ITEMCHANGED) return FALSE; - // TODO should this be last? - recomputeHScroll(t); + updateTableWidth(t); // TODO make more intelligent InvalidateRect(t->hwnd, NULL, TRUE); // TODO UpdateWindow()? diff --git a/wintable/new/resize.h b/wintable/new/resize.h index bea7158..4121d3f 100644 --- a/wintable/new/resize.h +++ b/wintable/new/resize.h @@ -14,7 +14,7 @@ HANDLER(resizeHandler) if ((wp->flags & SWP_NOSIZE) != 0) return FALSE; repositionHeader(t); - recomputeHScroll(t); + updateTableWidth(t); *lResult = 0; return TRUE; }