Merge branch 'per-monitor-dpi-aware-controls-3' of https://github.com/MaartenBent/wxWidgets

Add, or improve, per-monitor DPI awareness to/for more controls.

See https://github.com/wxWidgets/wxWidgets/pull/1589
This commit is contained in:
Vadim Zeitlin
2019-10-19 20:10:05 +02:00
20 changed files with 339 additions and 121 deletions

View File

@@ -269,6 +269,8 @@ public:
wxWindow* GetWindow() const { return m_window; }
void SetWindow(wxWindow* w) { m_window = w; }
virtual bool IsOk() const { return m_ok; }
// query capabilities
@@ -1364,6 +1366,9 @@ protected:
wxDCImpl * const m_pimpl;
void SetWindow(wxWindow* w)
{ return m_pimpl->SetWindow(w); }
private:
wxDECLARE_ABSTRACT_CLASS(wxDC);
wxDECLARE_NO_COPY_CLASS(wxDC);

View File

@@ -153,6 +153,8 @@ public:
wxBufferedPaintDC(wxWindow *window, wxBitmap& buffer, int style = wxBUFFER_CLIENT_AREA)
: m_paintdc(window)
{
SetWindow(window);
// If we're buffering the virtual window, scale the paint DC as well
if (style & wxBUFFER_VIRTUAL_AREA)
window->PrepareDC( m_paintdc );
@@ -167,6 +169,8 @@ public:
wxBufferedPaintDC(wxWindow *window, int style = wxBUFFER_CLIENT_AREA)
: m_paintdc(window)
{
SetWindow(window);
// If we're using the virtual window, scale the paint DC as well
if (style & wxBUFFER_VIRTUAL_AREA)
window->PrepareDC( m_paintdc );

View File

@@ -727,7 +727,7 @@ public:
}
// returns the resolution of the graphics context in device points per inch
virtual void GetDPI( wxDouble* dpiX, wxDouble* dpiY);
virtual void GetDPI( wxDouble* dpiX, wxDouble* dpiY) const;
#if 0
// sets the current alpha on this context
@@ -1038,6 +1038,9 @@ public:
const wxString& facename,
int flags = wxFONTFLAG_DEFAULT,
const wxColour& col = *wxBLACK) = 0;
virtual wxGraphicsFont CreateFontAtDPI(const wxFont& font,
const wxRealPoint& dpi,
const wxColour& col = *wxBLACK) = 0;
// create a native bitmap representation
virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) = 0;

View File

@@ -1766,6 +1766,8 @@ protected:
void OnSysColourChanged( wxSysColourChangedEvent &event );
void OnDPIChanged(wxDPIChangedEvent& event);
void OnTLPClose( wxCloseEvent& event );
protected:

View File

@@ -5479,6 +5479,7 @@ protected:
void OnKeyDown(wxKeyEvent& evt);
void OnLoseFocus(wxFocusEvent& evt);
void OnGainFocus(wxFocusEvent& evt);
void OnDPIChanged(wxDPIChangedEvent& evt);
void OnSysColourChanged(wxSysColourChangedEvent& evt);
void OnEraseBackground(wxEraseEvent& evt);
void OnMenu(wxCommandEvent& evt);