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/episodelistview.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'c/episodelistview.cpp') diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp index 17ae373..cdb3dc7 100644 --- a/c/episodelistview.cpp +++ b/c/episodelistview.cpp @@ -141,15 +141,16 @@ void EpisodeListView::Redraw() RDW_ERASE|RDW_FRAME|RDW_INVALIDATE|RDW_ALLCHILDREN); } -void EpisodeListView::ResizeColumns(RECT& rcParent) +void EpisodeListView::ResizeColumns() { - ListView_SetColumnWidth(hWnd, ELVSIEPISODE, LVSCW_AUTOSIZE); + RECT rc; + require(GetClientRect(hWnd, &rc)); + ListView_SetColumnWidth(hWnd, ELVSIEPISODE, LVSCW_AUTOSIZE); int cxColumn = ListView_GetColumnWidth(hWnd, ELVSIEPISODE)+4; ListView_SetColumnWidth(hWnd, ELVSIEPISODE, cxColumn); - cxColumn += ListView_GetColumnWidth(hWnd, ELVSIRATING); - ListView_SetColumnWidth(hWnd, ELVSITITLE, rcParent.right-cxColumn-Metric-4); + ListView_SetColumnWidth(hWnd, ELVSITITLE, rc.right-cxColumn); } /* Select previously focused episode. */ -- cgit v1.2.3