summaryrefslogtreecommitdiff
path: root/redo/table_windows.c
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-06 10:42:26 -0400
committerPietro Gagliardi <[email protected]>2014-08-06 10:42:26 -0400
commitb3b91c68d0b2613700cf84b5887b5ac79da0eb56 (patch)
tree9dda9358e571d3dfcf64a549d92c72846c229bce /redo/table_windows.c
parent3dcdd055620e76a3606e6d525aed7cf86595a279 (diff)
Implemented reasonable table column autosizing on Windows.
Diffstat (limited to 'redo/table_windows.c')
-rw-r--r--redo/table_windows.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/redo/table_windows.c b/redo/table_windows.c
index 56a3b02..8252f6c 100644
--- a/redo/table_windows.c
+++ b/redo/table_windows.c
@@ -20,6 +20,21 @@ static LRESULT CALLBACK tableSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
return 0;
}
return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam);
+ /* the autosize behavior is simple: always autosize until the user manually sizes, then never autosize again (this is my best guess as to how GTK+ behaves) */
+ case WM_NOTIFY: /* from the contained header control */
+ if (nmhdr->code == HDN_BEGINTRACK)
+ tableStopColumnAutosize((void *) data);
+ return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam);
+ case WM_SIZE:
+ if (tableAutosizeColumns((void *) data)) {
+ int i, nColumns;
+
+ nColumns = tableColumnCount((void *) data);
+ for (i = 0; i < nColumns; i++)
+ if (SendMessageW(hwnd, LVM_SETCOLUMNWIDTH, (WPARAM) i, (LPARAM) LVSCW_AUTOSIZE_USEHEADER) == FALSE)
+ xpanic("error resizing columns of results list view", GetLastError());
+ }
+ return (*fv_DefSubclassProc)(hwnd, uMsg, wParam, lParam);
case WM_NCDESTROY:
if ((*fv_RemoveWindowSubclass)(hwnd, tableSubProc, id) == FALSE)
xpanic("error removing Table subclass (which was for its own event handler)", GetLastError());