Improve wxNotebook themed background drawing

Use GetThemeBackgroundContentRect() to properly draw the themed notebook
background in all configurations.

Closes #18156.
This commit is contained in:
Vadim Zeitlin
2018-08-18 15:44:43 +02:00
parent 151309b2e4
commit 617a15d418
3 changed files with 29 additions and 8 deletions

View File

@@ -1095,30 +1095,40 @@ void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
WXHBRUSH wxNotebook::QueryBgBitmap()
{
wxRect r = GetPageSize();
if ( r.IsEmpty() )
RECT rc;
::GetClientRect(GetHwnd(), &rc);
if ( ::IsRectEmpty(&rc) )
return 0;
wxUxThemeHandle theme(this, L"TAB");
if ( !theme )
return 0;
RECT rc;
wxCopyRectToRECT(r, rc);
WindowHDC hDC(GetHwnd());
RECT rcBg;
::GetThemeBackgroundContentRect(theme,
(HDC) hDC,
9, /* TABP_PANE */
0,
&rc,
&rcBg);
m_bgBrushAdj = wxPoint(rcBg.left, rcBg.top);
::OffsetRect(&rcBg, -rcBg.left, -rcBg.top);
::GetThemeBackgroundExtent
(
theme,
(HDC) hDC,
9 /* TABP_PANE */,
0,
&rc,
&rcBg,
&rc
);
MemoryHDC hDCMem(hDC);
CompatibleBitmap hBmp(hDC, rc.right, rc.bottom);
CompatibleBitmap hBmp(hDC, rcBg.right, rcBg.bottom);
{
SelectInHDC selectBmp(hDCMem, hBmp);