From 5fb8df682831045c4619b65403c4a24d7583d2e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Wed, 3 Aug 2022 19:11:15 +0200 Subject: Remove m_bHeader from ListView. If it is relevant to add height for a header for a given list view, it is better to override Height and do it there. --- c/listview.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'c/listview.cpp') diff --git a/c/listview.cpp b/c/listview.cpp index c2f5593..e5d22b2 100644 --- a/c/listview.cpp +++ b/c/listview.cpp @@ -11,19 +11,16 @@ static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); ListView::ListView(const HWND hWndParent, const HMENU hMenu, const DWORD dwStyle) { m_hWndParent = hWndParent; - m_bHeader = !(dwStyle & LVS_NOCOLUMNHEADER); hWnd = require(CreateWindowEx( WS_EX_CLIENTEDGE, WC_LISTVIEW, L"", dwStyle|WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP|LVS_REPORT|LVS_SHOWSELALWAYS, 0, 0, 0, 0, - m_hWndParent, hMenu, GetModuleHandle(NULL), this)); - - if (require(SetProp(hWnd, L"this", (HANDLE)this))) - m_proc0 = (WNDPROC)SetWindowLongPtr(hWnd, - GWLP_WNDPROC, (LONG_PTR)::WndProc); + hWndParent, hMenu, GetModuleHandle(NULL), this)); + m_proc0 = (WNDPROC)SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)::WndProc); + require(SetProp(hWnd, L"this", (HANDLE)this)); ListView_SetExtendedListViewStyle(hWnd, LVS_EX_FULLROWSELECT|LVS_EX_DOUBLEBUFFER); SendMessage(hWnd, WM_SETFONT, (WPARAM)g_hfNormal, MAKELPARAM(FALSE, 0)); } @@ -37,12 +34,10 @@ bool ListView::FindNextItem(LVITEM* const lvi, const LPARAM lParam) } /* Naively calculate height of list view. */ -int ListView::Height(int bHeader) +int ListView::Height() { - if (bHeader == -1) - bHeader = m_bHeader; const int cItem = ListView_GetItemCount(hWnd); - return cItem? Dpi(bHeader? 27: 4)+cItem*Dpi(19): 0; + return Dpi(4)+cItem*Dpi(19); } void ListView::ResizeColumns(int) {} -- cgit v1.2.3