Merge branch 'display-funcs'

Implement all global functions in terms of wxDisplay and add
wxDisplay::GetPPI().

See https://github.com/wxWidgets/wxWidgets/pull/963
This commit is contained in:
Vadim Zeitlin
2018-10-09 16:31:54 +02:00
28 changed files with 480 additions and 286 deletions

View File

@@ -11,6 +11,7 @@
#define _WX_DISPLAY_H_BASE_
#include "wx/defs.h"
#include "wx/gdicmn.h" // wxSize
// NB: no #if wxUSE_DISPLAY here, the display geometry part of this class (but
// not the video mode stuff) is always available but if wxUSE_DISPLAY == 0
@@ -74,6 +75,12 @@ public:
// get the client area of the display, i.e. without taskbars and such
wxRect GetClientArea() const;
// get the depth, i.e. number of bits per pixel (0 if unknown)
int GetDepth() const;
// get the resolution of this monitor in pixels per inch
wxSize GetPPI() const;
// name may be empty
wxString GetName() const;

View File

@@ -1080,6 +1080,9 @@ extern WXDLLIMPEXP_DATA_CORE(const wxPoint) wxDefaultPosition;
extern void WXDLLIMPEXP_CORE wxInitializeStockLists();
extern void WXDLLIMPEXP_CORE wxDeleteStockLists();
// Note: all the display-related functions here exist for compatibility only,
// please use wxDisplay class in the new code
// is the display colour (or monochrome)?
extern bool WXDLLIMPEXP_CORE wxColourDisplay();

View File

@@ -78,6 +78,18 @@ public:
// return the area of the display available for normal windows
virtual wxRect GetClientArea() const { return GetGeometry(); }
// return the depth or 0 if unknown
virtual int GetDepth() const = 0;
// return the resolution of the display, uses GetSizeMM() by default but
// can be also overridden directly
virtual wxSize GetPPI() const;
// return the physical size of the display or (0, 0) if unknown: this is
// only used by GetPPI() implementation in the base class, so if GetPPI()
// is overridden, this one doesn't have to be implemented
virtual wxSize GetSizeMM() const { return wxSize(0, 0); }
// return the name (may be empty)
virtual wxString GetName() const { return wxString(); }