diff options
Diffstat (limited to 'c/listview.cpp')
-rw-r--r-- | c/listview.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
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) { |