Make wxWindow::GetContentScaleFactor() useful for non-OSX platforms.

Return the ration of the current DPI to the standard one to allow using this
function to scale pixel values for the current screen resolution.
This commit is contained in:
Vadim Zeitlin
2015-03-18 15:07:02 +01:00
parent 6448fa074a
commit bc492a9e6e
3 changed files with 27 additions and 5 deletions

View File

@@ -1126,10 +1126,18 @@ public:
Returns the magnification of the backing store of this window, eg 2.0
for a window on a retina screen.
This method can be used to adjust hard coded pixel values to the values
appropriate for the current screen resolution. E.g. instead of using
32px icons, which would look tiny on the high resolution (also known as
HiDPI or retina) displays, you should use
@code
wxRound(32*GetContentScaleFactor())
@endcode instead.
@since 2.9.5
*/
virtual double GetContentScaleFactor() const;
double GetContentScaleFactor() const;
/**
Returns the size of the left/right and top/bottom borders of this window in x
and y components of the result respectively.