From 647fd553af9054b89f4a0d751ea89a98439ae5ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 23 Jul 2022 22:42:03 +0200 Subject: Improve window layout. This reverts much of 97f0a27. 1. It turns out not to be a good idea to resize the list view columns based on the list view window's own rectangle, as it will change depending on whether a scrollbar is visible. The problem is that resizing the columns may add a horizontal scrollbar -- which in turn may add a vertical scrollbar. 2. The WS_EX_CLIENTEDGE style does not look very good in "modern" (non-classic) themes. In 97f0a27, I tried solving this by extending the dimensions of the child windows such that their edges were hidden. However, this type of overlapping causes problems with the status bar. My new solution is to instead *reduce* the child windows' dimensions. This achieves a visual impression similar to the thicker (more well-designed) edges of the "classically themed" list view control. To make it look even better, the main window background is changed from COLOR_WINDOWFRAME (white) to COLOR_WINDOW (light gray). --- c/episodelistview.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'c/episodelistview.cpp') diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp index bc01ce9..4b93587 100644 --- a/c/episodelistview.cpp +++ b/c/episodelistview.cpp @@ -141,16 +141,13 @@ void EpisodeListView::Redraw() RDW_ERASE|RDW_FRAME|RDW_INVALIDATE|RDW_ALLCHILDREN); } -void EpisodeListView::ResizeColumns() +void EpisodeListView::ResizeColumns(int w) { - RECT rc; - require(GetClientRect(hWnd, &rc)); - ListView_SetColumnWidth(hWnd, ELVSIEPISODE, LVSCW_AUTOSIZE); - int cxColumn = ListView_GetColumnWidth(hWnd, ELVSIEPISODE)+4; + int cxColumn = ListView_GetColumnWidth(hWnd, ELVSIEPISODE)+Dpi(4); ListView_SetColumnWidth(hWnd, ELVSIEPISODE, cxColumn); cxColumn += ListView_GetColumnWidth(hWnd, ELVSIRATING); - ListView_SetColumnWidth(hWnd, ELVSITITLE, rc.right-cxColumn); + ListView_SetColumnWidth(hWnd, ELVSITITLE, w-cxColumn-Metric-Dpi(4)); } /* Select previously focused episode. */ @@ -406,8 +403,10 @@ void EpisodeListView::Update() if (iItemTopNew != -1) SetTop(iItemTopNew); + /* Show number of displayed items in status bar. */ _stprintf_s(tszDisp, sizeof(tszDisp), TEXT("%d"), iItem); SendMessage(g_hWndStatus, SB_SETTEXT, MAKEWPARAM(1,0), (LPARAM)tszDisp); + SendMessage(hWnd, WM_SETREDRAW, TRUE, 0); } -- cgit v1.2.3