Implement wxWindow::GetDPI() on macOS and iOS

This commit is contained in:
Stefan Csomor
2020-07-18 20:01:23 +02:00
committed by Vadim Zeitlin
parent fa58dc2c45
commit 668f0e7c54
2 changed files with 15 additions and 0 deletions

View File

@@ -120,6 +120,8 @@ public:
virtual bool UnregisterHotKey(int hotkeyId) wxOVERRIDE;
#endif // wxUSE_HOTKEY
virtual wxSize GetDPI() const wxOVERRIDE;
#if wxUSE_DRAG_AND_DROP
virtual void SetDropTarget( wxDropTarget *dropTarget ) wxOVERRIDE;

View File

@@ -2599,6 +2599,19 @@ bool wxWindowMac::OSXHandleKeyEvent( wxKeyEvent& event )
return handled ;
}
wxSize wxWindowMac::GetDPI() const
{
wxNonOwnedWindow* tlw = MacGetTopLevelWindow() ;
double scaleFactor;
if ( tlw )
scaleFactor = tlw->GetContentScaleFactor();
else
scaleFactor = wxOSXGetMainScreenContentScaleFactor();
return wxSize(wxRound(scaleFactor*72.0),wxRound(scaleFactor*72.0));
}
//
// wxWidgetImpl
//