From ca56ce2c32b4479af32bf7fb5d065ee9a3a45d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 11 Jul 2022 00:04:35 +0200 Subject: Refactor, adjust minimum window size. --- c/listview.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'c/listview.cpp') diff --git a/c/listview.cpp b/c/listview.cpp index 9f24dc3..87b7dbc 100644 --- a/c/listview.cpp +++ b/c/listview.cpp @@ -46,6 +46,35 @@ ListView::HWnd() return m_hWnd; } +void +ListView::UpdateTheme(BOOL bThemeActive) +{ + DWORD dwStyle; + LPTSTR tszTheme; + WORD wAction; + extern int g_bThemes; + + if (!g_bThemes) return; + if (bThemeActive) { + dwStyle = LVS_EX_DOUBLEBUFFER; + tszTheme = TEXT("Explorer"); + wAction = UIS_SET; + } else { + dwStyle = 0; + tszTheme = NULL; + wAction = UIS_CLEAR; + } + + /* Use modern "Explorer" theme. */ + SetWindowTheme(m_hWnd, tszTheme, NULL); + + /* The modern theme requires double buffering. */ + ListView_SetExtendedListViewStyleEx(m_hWnd, LVS_EX_DOUBLEBUFFER, dwStyle); + + /* Hide focus rectangles. */ + SendMessage(m_hWnd, WM_UPDATEUISTATE, MAKEWPARAM(wAction, UISF_HIDEFOCUS), 0); +} + LRESULT CALLBACK ListView::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { -- cgit v1.2.3