From 395521b832acb7f5133f1b2b1920cd31734ed585 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 10 Dec 2014 10:07:08 -0500 Subject: Moved Table width calculation out of recomputeHScroll() and into updateTableWidth(); also stored width in the Table itself. --- wintable/new/header.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'wintable/new/header.h') diff --git a/wintable/new/header.h b/wintable/new/header.h index 47c13b2..c89b506 100644 --- a/wintable/new/header.h +++ b/wintable/new/header.h @@ -55,6 +55,19 @@ static void headerAddColumn(struct table *t, WCHAR *name) static void updateTableWidth(struct table *t) { + HDITEMW item; + intptr_t i; + + t->width = 0; + // TODO count dividers? + for (i = 0; i < t->nColumns; i++) { + ZeroMemory(&item, sizeof (HDITEMW)); + item.mask = HDI_WIDTH; + if (SendMessageW(t->header, HDM_GETITEM, (WPARAM) i, (LPARAM) (&item)) == FALSE) + panic("error getting Table column width for updateTableWidth()"); + t->width += item.cxy; + } + // TODO replace this with a call to hscrollby(t, 0) recomputeHScroll(t); } -- cgit v1.2.3