From 97f0a27ab0cbf605ba789be553c0df3bb44a6787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 23 Jul 2022 00:16:42 +0200 Subject: Improve UpdateLayout and ResizeColumns. This incidentally removes the need for the variable template introduced by 21e96c6. I'm sure it will be needed at some point, though. --- c/datalistview.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'c/datalistview.cpp') diff --git a/c/datalistview.cpp b/c/datalistview.cpp index 9ff4659..b728fa8 100644 --- a/c/datalistview.cpp +++ b/c/datalistview.cpp @@ -29,13 +29,15 @@ DataListView::DataListView(const HWND hWndParent) ListView_InsertColumn(hWnd, DLVSIVALUE, &lvc); } -void DataListView::ResizeColumns(RECT& rcParent) +void DataListView::ResizeColumns() { - ListView_SetColumnWidth(hWnd, DLVSIKEY, LVSCW_AUTOSIZE); + RECT rc; + require(GetClientRect(hWnd, &rc)); + ListView_SetColumnWidth(hWnd, DLVSIKEY, LVSCW_AUTOSIZE); const int cxColumn = ListView_GetColumnWidth(hWnd, 0)+4; ListView_SetColumnWidth(hWnd, DLVSIKEY, cxColumn); - ListView_SetColumnWidth(hWnd, DLVSIVALUE, rcParent.right-cxColumn-Metric-4); + ListView_SetColumnWidth(hWnd, DLVSIVALUE, rc.right-cxColumn); } void DataListView::ShowEpisode(const int iEpisode) -- cgit v1.2.3