aboutsummaryrefslogtreecommitdiff
path: root/c/datalistview.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-07-23 22:42:03 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-07-24 00:30:03 +0200
commit647fd553af9054b89f4a0d751ea89a98439ae5ac (patch)
treec8f80284b012a35172c298fcc2950b63238394e1 /c/datalistview.cpp
parentc6cd2f1f164baac1414f2cf658566de146b10552 (diff)
downloadEpisodeBrowser-647fd553af9054b89f4a0d751ea89a98439ae5ac.tar.gz
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).
Diffstat (limited to 'c/datalistview.cpp')
-rw-r--r--c/datalistview.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/c/datalistview.cpp b/c/datalistview.cpp
index 1ceeb3b..82b62e6 100644
--- a/c/datalistview.cpp
+++ b/c/datalistview.cpp
@@ -29,15 +29,12 @@ DataListView::DataListView(const HWND hWndParent)
ListView_InsertColumn(hWnd, DLVSIVALUE, &lvc);
}
-void DataListView::ResizeColumns()
+void DataListView::ResizeColumns(int w)
{
- RECT rc;
- require(GetClientRect(hWnd, &rc));
-
ListView_SetColumnWidth(hWnd, DLVSIKEY, LVSCW_AUTOSIZE);
- const int cxColumn = ListView_GetColumnWidth(hWnd, 0)+4;
+ const int cxColumn = ListView_GetColumnWidth(hWnd, DLVSIKEY)+Dpi(4);
ListView_SetColumnWidth(hWnd, DLVSIKEY, cxColumn);
- ListView_SetColumnWidth(hWnd, DLVSIVALUE, rc.right-cxColumn);
+ ListView_SetColumnWidth(hWnd, DLVSIVALUE, w-cxColumn-Metric<SM_CXVSCROLL>-Dpi(4));
}
void DataListView::ShowEpisode(const int iEpisode)