From 8504a00a00a2d5f281c2b444933c860ce2b2f3bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Fri, 20 Nov 2020 00:26:06 +0100 Subject: [PATCH] Make the list views in settings prettier --- src/win/Makefile.mingw | 2 +- src/win/win_settings.c | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index d8d7ba9b8..de404565d 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -813,7 +813,7 @@ endif ifneq ($(WX), n) LIBS += $(WX_LIBS) -lm endif -LIBS += -lpng -lz -lwsock32 -lshell32 -liphlpapi -lpsapi -lSDL2 -limm32 -lhid -lsetupapi -loleaut32 -lversion -lwinmm -static -lstdc++ +LIBS += -lpng -lz -lwsock32 -lshell32 -liphlpapi -lpsapi -lSDL2 -limm32 -lhid -lsetupapi -loleaut32 -luxtheme -lversion -lwinmm -static -lstdc++ ifneq ($(X64), y) LIBS += -Wl,--large-address-aware endif diff --git a/src/win/win_settings.c b/src/win/win_settings.c index 9175ff930..5b9124f4c 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -1,4 +1,4 @@ -/* +/* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent @@ -20,6 +20,7 @@ #define BITMAP WINDOWS_BITMAP #include #include +#include #undef BITMAP #ifdef ENABLE_SETTINGS_LOG #include @@ -207,6 +208,17 @@ settings_show_window(HWND hdlg, int id, int condition) } +static void +settings_listview_enable_styles(HWND hdlg, int id) +{ + HWND h; + + h = GetDlgItem(hdlg, id); + SetWindowTheme(h, L"Explorer", NULL); + ListView_SetExtendedListViewStyle(h, LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER); +} + + static void settings_listview_select(HWND hdlg, int id, int selection) { @@ -3124,6 +3136,8 @@ win_settings_hard_disks_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPar lv1_current_sel = -1; recalc_location_controls(hdlg, 0, 0); + settings_listview_enable_styles(hdlg, IDC_LIST_HARD_DISKS); + ignore_change = 0; return TRUE; @@ -4178,6 +4192,8 @@ win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam settings_set_check(hdlg, IDC_CHECKTURBO, temp_fdd_turbo[lv1_current_sel]); settings_set_check(hdlg, IDC_CHECKBPB, temp_fdd_check_bpb[lv1_current_sel]); + settings_listview_enable_styles(hdlg, IDC_LIST_FLOPPY_DRIVES); + lv2_current_sel = 0; win_settings_cdrom_drives_init_columns(hdlg); image_list_init(hdlg, IDC_LIST_CDROM_DRIVES, (const uint8_t *) cd_icons); @@ -4200,6 +4216,8 @@ win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam settings_set_cur_sel(hdlg, IDC_COMBO_CD_BUS, b); cdrom_recalc_location_controls(hdlg, 0); + settings_listview_enable_styles(hdlg, IDC_LIST_CDROM_DRIVES); + ignore_change = 0; return TRUE; @@ -4362,6 +4380,8 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam settings_set_cur_sel(hdlg, IDC_COMBO_MO_BUS, b); mo_recalc_location_controls(hdlg, 0); + settings_listview_enable_styles(hdlg, IDC_LIST_MO_DRIVES); + lv2_current_sel = 0; win_settings_zip_drives_init_columns(hdlg); image_list_init(hdlg, IDC_LIST_ZIP_DRIVES, (const uint8_t *) zip_icons); @@ -4384,6 +4404,8 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam settings_set_cur_sel(hdlg, IDC_COMBO_ZIP_BUS, b); zip_recalc_location_controls(hdlg, 0); + settings_listview_enable_styles(hdlg, IDC_LIST_ZIP_DRIVES); + ignore_change = 0; return TRUE; @@ -4669,6 +4691,7 @@ win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) image_list_init(hdlg, IDC_SETTINGSCATLIST, (const uint8_t *) cat_icons); win_settings_main_insert_categories(h); settings_listview_select(hdlg, IDC_SETTINGSCATLIST, first_cat); + settings_listview_enable_styles(hdlg, IDC_SETTINGSCATLIST); return TRUE; case WM_NOTIFY: if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_SETTINGSCATLIST)) {