Improve wxNotebook themed background drawing
Use GetThemeBackgroundContentRect() to properly draw the themed notebook background in all configurations. Closes #18156.
This commit is contained in:
@@ -130,6 +130,7 @@ wxMSW:
|
||||
- Support MSVC auto-linking when using monolithic build too (PB).
|
||||
- Implement wxFontDialog::SetTitle() (Vitaly Stakhovsky).
|
||||
- Fix build in ANSI (non-Unicode) mode.
|
||||
- Improve wxNotebook themed background drawing (Arrigo Marchiori).
|
||||
|
||||
wxOSX:
|
||||
|
||||
|
@@ -170,10 +170,17 @@ protected:
|
||||
void AdjustPageSize(wxNotebookPage *page);
|
||||
|
||||
#if wxUSE_UXTHEME
|
||||
virtual void MSWAdjustBrushOrg(int *xOrg, int* yOrg) const wxOVERRIDE
|
||||
{
|
||||
*xOrg -= m_bgBrushAdj.x;
|
||||
*yOrg -= m_bgBrushAdj.y;
|
||||
}
|
||||
|
||||
// return the themed brush for painting our children
|
||||
virtual WXHBRUSH MSWGetCustomBgBrush() wxOVERRIDE { return m_hbrBackground; }
|
||||
|
||||
// gets the bitmap of notebook background and returns a brush from it
|
||||
// gets the bitmap of notebook background and returns a brush from it and
|
||||
// sets m_bgBrushAdj
|
||||
WXHBRUSH QueryBgBitmap();
|
||||
|
||||
// creates the brush to be used for drawing the tab control background
|
||||
@@ -190,6 +197,9 @@ protected:
|
||||
#if wxUSE_UXTHEME
|
||||
// background brush used to paint the tab control
|
||||
WXHBRUSH m_hbrBackground;
|
||||
|
||||
// offset for MSWAdjustBrushOrg()
|
||||
wxPoint m_bgBrushAdj;
|
||||
#endif // wxUSE_UXTHEME
|
||||
|
||||
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user