Commit b4b87987 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

comctl32/listview: Support themed check boxes for LVS_EX_CHECKBOXES style.

Fix check boxes in the list items of 7-zip options dialog not being themed even when theming is on. Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 0b5e587e
...@@ -139,6 +139,7 @@ ...@@ -139,6 +139,7 @@
#include "commctrl.h" #include "commctrl.h"
#include "comctl32.h" #include "comctl32.h"
#include "uxtheme.h" #include "uxtheme.h"
#include "vsstyle.h"
#include "shlwapi.h" #include "shlwapi.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -8424,15 +8425,62 @@ static BOOL LISTVIEW_SetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn, INT cx) ...@@ -8424,15 +8425,62 @@ static BOOL LISTVIEW_SetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn, INT cx)
* Creates the checkbox imagelist. Helper for LISTVIEW_SetExtendedListViewStyle * Creates the checkbox imagelist. Helper for LISTVIEW_SetExtendedListViewStyle
* *
*/ */
static HIMAGELIST LISTVIEW_CreateThemedCheckBoxImageList(const LISTVIEW_INFO *info)
{
HBITMAP bitmap, old_bitmap;
HIMAGELIST image_list;
HDC hdc, mem_hdc;
HTHEME theme;
RECT rect;
SIZE size;
if (!GetWindowTheme(info->hwndSelf))
return NULL;
theme = OpenThemeDataForDpi(NULL, L"Button", GetDpiForWindow(info->hwndSelf));
if (!theme)
return NULL;
hdc = GetDC(info->hwndSelf);
GetThemePartSize(theme, hdc, BP_CHECKBOX, 0, NULL, TS_DRAW, &size);
SetRect(&rect, 0, 0, size.cx, size.cy);
image_list = ImageList_Create(size.cx, size.cy, ILC_COLOR32, 2, 2);
mem_hdc = CreateCompatibleDC(hdc);
bitmap = CreateCompatibleBitmap(hdc, size.cx, size.cy);
old_bitmap = SelectObject(mem_hdc, bitmap);
ReleaseDC(info->hwndSelf, hdc);
if (IsThemeBackgroundPartiallyTransparent(theme, BP_CHECKBOX, CBS_UNCHECKEDNORMAL))
FillRect(mem_hdc, &rect, (HBRUSH)(COLOR_WINDOW + 1));
DrawThemeBackground(theme, mem_hdc, BP_CHECKBOX, CBS_UNCHECKEDNORMAL, &rect, NULL);
ImageList_Add(image_list, bitmap, NULL);
if (IsThemeBackgroundPartiallyTransparent(theme, BP_CHECKBOX, CBS_CHECKEDNORMAL))
FillRect(mem_hdc, &rect, (HBRUSH)(COLOR_WINDOW + 1));
DrawThemeBackground(theme, mem_hdc, BP_CHECKBOX, CBS_CHECKEDNORMAL, &rect, NULL);
ImageList_Add(image_list, bitmap, NULL);
SelectObject(mem_hdc, old_bitmap);
DeleteObject(bitmap);
DeleteDC(mem_hdc);
CloseThemeData(theme);
return image_list;
}
static HIMAGELIST LISTVIEW_CreateCheckBoxIL(const LISTVIEW_INFO *infoPtr) static HIMAGELIST LISTVIEW_CreateCheckBoxIL(const LISTVIEW_INFO *infoPtr)
{ {
HDC hdc_wnd, hdc; HDC hdc_wnd, hdc;
HBITMAP hbm_im, hbm_mask, hbm_orig; HBITMAP hbm_im, hbm_mask, hbm_orig;
RECT rc; RECT rc;
HBRUSH hbr_white = GetStockObject(WHITE_BRUSH); HBRUSH hbr_white, hbr_black;
HBRUSH hbr_black = GetStockObject(BLACK_BRUSH);
HIMAGELIST himl; HIMAGELIST himl;
himl = LISTVIEW_CreateThemedCheckBoxImageList(infoPtr);
if (himl)
return himl;
hbr_white = GetStockObject(WHITE_BRUSH);
hbr_black = GetStockObject(BLACK_BRUSH);
himl = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), himl = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
ILC_COLOR | ILC_MASK, 2, 2); ILC_COLOR | ILC_MASK, 2, 2);
hdc_wnd = GetDC(infoPtr->hwndSelf); hdc_wnd = GetDC(infoPtr->hwndSelf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment