Require wxWindow parameter for wxNativeFontInfo constructor in MSW

Use the DPI of the window to determine the correct font pointSize.

To not break user code, add a default argument when not building the library.
This commit is contained in:
Maarten Bent
2019-08-27 23:14:35 +02:00
parent 2704d32089
commit 13cb9d41d8
8 changed files with 29 additions and 40 deletions

View File

@@ -397,15 +397,8 @@ void wxMessageDialog::AdjustButtonLabels()
wxFont wxMessageDialog::GetMessageFont()
{
const wxWindow* win = wxTheApp ? wxTheApp->GetTopWindow() : NULL;
wxNativeFontInfo info(wxMSWImpl::GetNonClientMetrics(win).lfMessageFont);
// wxNativeFontInfo constructor calculates the pointSize using the
// main screen DPI. But lfHeight is based on the window DPI.
if ( win )
{
info.pointSize = wxNativeFontInfo::GetPointSizeAtPPI(
info.lf.lfHeight, win->GetDPI().y);
}
const wxNativeFontInfo
info(wxMSWImpl::GetNonClientMetrics(win).lfMessageFont, win);
return info;
}