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).
|
- Support MSVC auto-linking when using monolithic build too (PB).
|
||||||
- Implement wxFontDialog::SetTitle() (Vitaly Stakhovsky).
|
- Implement wxFontDialog::SetTitle() (Vitaly Stakhovsky).
|
||||||
- Fix build in ANSI (non-Unicode) mode.
|
- Fix build in ANSI (non-Unicode) mode.
|
||||||
|
- Improve wxNotebook themed background drawing (Arrigo Marchiori).
|
||||||
|
|
||||||
wxOSX:
|
wxOSX:
|
||||||
|
|
||||||
|
@@ -170,10 +170,17 @@ protected:
|
|||||||
void AdjustPageSize(wxNotebookPage *page);
|
void AdjustPageSize(wxNotebookPage *page);
|
||||||
|
|
||||||
#if wxUSE_UXTHEME
|
#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
|
// return the themed brush for painting our children
|
||||||
virtual WXHBRUSH MSWGetCustomBgBrush() wxOVERRIDE { return m_hbrBackground; }
|
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();
|
WXHBRUSH QueryBgBitmap();
|
||||||
|
|
||||||
// creates the brush to be used for drawing the tab control background
|
// creates the brush to be used for drawing the tab control background
|
||||||
@@ -190,6 +197,9 @@ protected:
|
|||||||
#if wxUSE_UXTHEME
|
#if wxUSE_UXTHEME
|
||||||
// background brush used to paint the tab control
|
// background brush used to paint the tab control
|
||||||
WXHBRUSH m_hbrBackground;
|
WXHBRUSH m_hbrBackground;
|
||||||
|
|
||||||
|
// offset for MSWAdjustBrushOrg()
|
||||||
|
wxPoint m_bgBrushAdj;
|
||||||
#endif // wxUSE_UXTHEME
|
#endif // wxUSE_UXTHEME
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1095,30 +1095,40 @@ void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
|
|||||||
|
|
||||||
WXHBRUSH wxNotebook::QueryBgBitmap()
|
WXHBRUSH wxNotebook::QueryBgBitmap()
|
||||||
{
|
{
|
||||||
wxRect r = GetPageSize();
|
RECT rc;
|
||||||
if ( r.IsEmpty() )
|
::GetClientRect(GetHwnd(), &rc);
|
||||||
|
if ( ::IsRectEmpty(&rc) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
wxUxThemeHandle theme(this, L"TAB");
|
wxUxThemeHandle theme(this, L"TAB");
|
||||||
if ( !theme )
|
if ( !theme )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
RECT rc;
|
|
||||||
wxCopyRectToRECT(r, rc);
|
|
||||||
|
|
||||||
WindowHDC hDC(GetHwnd());
|
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
|
::GetThemeBackgroundExtent
|
||||||
(
|
(
|
||||||
theme,
|
theme,
|
||||||
(HDC) hDC,
|
(HDC) hDC,
|
||||||
9 /* TABP_PANE */,
|
9 /* TABP_PANE */,
|
||||||
0,
|
0,
|
||||||
&rc,
|
&rcBg,
|
||||||
&rc
|
&rc
|
||||||
);
|
);
|
||||||
|
|
||||||
MemoryHDC hDCMem(hDC);
|
MemoryHDC hDCMem(hDC);
|
||||||
CompatibleBitmap hBmp(hDC, rc.right, rc.bottom);
|
CompatibleBitmap hBmp(hDC, rcBg.right, rcBg.bottom);
|
||||||
|
|
||||||
{
|
{
|
||||||
SelectInHDC selectBmp(hDCMem, hBmp);
|
SelectInHDC selectBmp(hDCMem, hBmp);
|
||||||
|
Reference in New Issue
Block a user