Added wxWindow::ToDIP functionality.

This commit is contained in:
Steve Browne
2015-11-24 12:47:31 -05:00
parent 633d04ca92
commit bbb6dbea1b
2 changed files with 27 additions and 0 deletions

View File

@@ -2878,6 +2878,18 @@ wxWindowBase::FromDIP(const wxSize& sz, const wxWindowBase* WXUNUSED(w))
sz.y == -1 ? -1 : wxMulDivInt32(sz.y, dpi.y, BASELINE_DPI));
}
/* static */
wxSize
wxWindowBase::ToDIP(const wxSize& sz, const wxWindowBase* WXUNUSED(w))
{
const wxSize dpi = wxScreenDC().GetPPI();
// Take care to not scale -1 because it has a special meaning of
// "unspecified" which should be preserved.
return wxSize(sz.x == -1 ? -1 : wxMulDivInt32(sz.x, BASELINE_DPI, dpi.x),
sz.y == -1 ? -1 : wxMulDivInt32(sz.y, BASELINE_DPI, dpi.y));
}
#endif // !wxHAVE_DPI_INDEPENDENT_PIXELS
// Windows' computes dialog units using average character width over upper-