aboutsummaryrefslogtreecommitdiff
path: root/c/listview.c
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-03-02 18:31:34 +0100
committerJohn Ankarström <john@ankarstrom.se>2022-03-02 18:31:34 +0100
commitde437e83986d80f2fd49291969d154885ede7e9d (patch)
tree10c1974a2a0c5e68e5ba165a85fc7397e5a393a8 /c/listview.c
parent196aeb5a981e184c9eb48a8215639252812f2608 (diff)
downloadEpisodeBrowser-de437e83986d80f2fd49291969d154885ede7e9d.tar.gz
Handle theme updates, improve focus handling
Diffstat (limited to 'c/listview.c')
-rw-r--r--c/listview.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/c/listview.c b/c/listview.c
index 48b61e1..7039e89 100644
--- a/c/listview.c
+++ b/c/listview.c
@@ -13,14 +13,14 @@ static LRESULT CALLBACK LvProc(HWND, UINT, WPARAM, LPARAM);
HWND
LvCreate(HMENU hMenu)
{
- HMODULE hModule;
HWND hLv;
hLv = CreateWindowEx(
WS_EX_CLIENTEDGE,
WC_LISTVIEW,
TEXT(""),
- WS_CHILD|WS_VISIBLE|WS_VSCROLL|LVS_REPORT|LVS_NOSORTHEADER,
+ WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP
+ |LVS_REPORT|LVS_NOSORTHEADER,
0, 0, 0, 0,
HWnd, hMenu, GetModuleHandle(NULL), NULL
);
@@ -33,15 +33,6 @@ LvCreate(HMENU hMenu)
SendMessage(hLv, WM_SETFONT,
(WPARAM)HfNormal, MAKELPARAM(FALSE, 0));
- hModule = LoadLibrary(TEXT("uxtheme.dll"));
- if (hModule && GetProcAddress(hModule, "SetWindowTheme")) {
- ListView_SetExtendedListViewStyleEx(hLv,
- LVS_EX_DOUBLEBUFFER, LVS_EX_DOUBLEBUFFER);
- SendMessage(hLv, WM_CHANGEUISTATE,
- MAKEWPARAM(UIS_SET, UISF_HIDEFOCUS), 0);
- SetWindowTheme(hLv, TEXT("Explorer"), NULL);
- }
-
return hLv;
}
@@ -60,3 +51,15 @@ LvProc(HWND hLv, UINT uMsg, WPARAM wParam, LPARAM lParam)
return CallWindowProc(LvPrevProc, hLv, uMsg, wParam, lParam);
}
+
+void
+LvSetTheme(HWND hLv, int bUseTheme)
+{
+ ListView_SetExtendedListViewStyleEx(hLv,
+ LVS_EX_DOUBLEBUFFER,
+ bUseTheme ? LVS_EX_DOUBLEBUFFER : 0);
+ SendMessage(hLv, WM_CHANGEUISTATE,
+ MAKEWPARAM(bUseTheme ? UIS_SET : UIS_CLEAR,
+ UISF_HIDEFOCUS), 0);
+ SetWindowTheme(hLv, bUseTheme ? TEXT("Explorer") : NULL, NULL);
+}