Update custom header font after DPI change

This commit is contained in:
Maarten Bent
2019-09-18 01:26:18 +02:00
parent 017978a139
commit 54d514489e

View File

@@ -124,6 +124,7 @@ protected:
virtual void DoSetSize(int x, int y, virtual void DoSetSize(int x, int y,
int width, int height, int width, int height,
int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; int sizeFlags = wxSIZE_AUTO) wxOVERRIDE;
virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) wxOVERRIDE;
private: private:
// override MSW-specific methods needed for new control // override MSW-specific methods needed for new control
@@ -324,6 +325,16 @@ wxSize wxMSWHeaderCtrl::DoGetBestSize() const
return wxSize(wxDefaultCoord, wpos.cy); return wxSize(wxDefaultCoord, wpos.cy);
} }
void wxMSWHeaderCtrl::MSWUpdateFontOnDPIChange(const wxSize& newDPI)
{
wxControl::MSWUpdateFontOnDPIChange(newDPI);
if ( wxMSWHeaderCtrlCustomDraw * customDraw = GetCustomDraw() )
{
customDraw->m_attr.SetFont(m_font);
}
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxMSWHeaderCtrl columns managements // wxMSWHeaderCtrl columns managements
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -701,7 +712,7 @@ bool wxMSWHeaderCtrl::SetFont(const wxFont& font)
if ( wxMSWHeaderCtrlCustomDraw* customDraw = GetCustomDraw() ) if ( wxMSWHeaderCtrlCustomDraw* customDraw = GetCustomDraw() )
{ {
customDraw->m_attr.SetFont(font); customDraw->m_attr.SetFont(m_font);
} }
return true; return true;