From 26bc41099c10b3a63fd744690df5c25cb713718b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sun, 17 Jul 2022 01:35:16 +0200 Subject: Add const to places. Note that I did NOT add const to non-pointer/non-reference arguments in function declarations (without a following definition), as they do not mean anything there. --- c/listview.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'c/listview.cpp') diff --git a/c/listview.cpp b/c/listview.cpp index 27529e0..5791226 100644 --- a/c/listview.cpp +++ b/c/listview.cpp @@ -9,7 +9,7 @@ extern HFONT g_hfNormal; static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); -ListView::ListView(HWND hWndParent, HMENU hMenu, DWORD dwStyle) +ListView::ListView(const HWND hWndParent, const HMENU hMenu, const DWORD dwStyle) { m_hWndParent = hWndParent; m_bHeader = !(dwStyle & LVS_NOCOLUMNHEADER); @@ -21,13 +21,11 @@ ListView::ListView(HWND hWndParent, HMENU hMenu, DWORD dwStyle) 0, 0, 0, 0, m_hWndParent, hMenu, GetModuleHandle(NULL), this ); - if (SetProp(m_hWnd, TEXT("this"), (HANDLE)this)) m_prevProc = (WNDPROC)SetWindowLongPtr(m_hWnd, GWLP_WNDPROC, (LONG_PTR)::WndProc); ListView_SetExtendedListViewStyle(m_hWnd, LVS_EX_FULLROWSELECT); - SendMessage(m_hWnd, WM_SETFONT, (WPARAM)g_hfNormal, MAKELPARAM(FALSE, 0)); } @@ -36,7 +34,7 @@ int ListView::Height(int bHeader) { if (bHeader == -1) bHeader = m_bHeader; - int iCount = ListView_GetItemCount(m_hWnd); + const int iCount = ListView_GetItemCount(m_hWnd); return iCount? Dpi(bHeader? 27: 4)+iCount*Dpi(19): 0; } @@ -45,7 +43,7 @@ HWND ListView::Handle() const return m_hWnd; } -void ListView::UpdateTheme(BOOL bThemeActive) +void ListView::UpdateTheme(const BOOL bThemeActive) { DWORD dwStyle; LPTSTR tszTheme; @@ -73,7 +71,8 @@ void ListView::UpdateTheme(BOOL bThemeActive) SendMessage(m_hWnd, WM_UPDATEUISTATE, MAKEWPARAM(wAction, UISF_HIDEFOCUS), 0); } -LRESULT CALLBACK ListView::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK ListView::WndProc(const HWND hWnd, const UINT uMsg, + const WPARAM wParam, const LPARAM lParam) { switch (uMsg) { case WM_NOTIFY: @@ -88,7 +87,8 @@ LRESULT CALLBACK ListView::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l return CallWindowProc(m_prevProc, hWnd, uMsg, wParam, lParam); } -LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, + const LPARAM lParam) { ListView *lpLv = (ListView *)GetProp(hWnd, TEXT("this")); -- cgit v1.2.3