diff --git a/include/wx/generic/wizard.h b/include/wx/generic/wizard.h index 2b512ec5e3..06c86da064 100644 --- a/include/wx/generic/wizard.h +++ b/include/wx/generic/wizard.h @@ -29,7 +29,7 @@ public: wxWizard(wxWindow *parent, int id = wxID_ANY, const wxString& title = wxEmptyString, - const wxBitmap& bitmap = wxNullBitmap, + const wxBitmapBundle& bitmap = wxBitmapBundle(), const wxPoint& pos = wxDefaultPosition, long style = wxDEFAULT_DIALOG_STYLE) { @@ -39,7 +39,7 @@ public: bool Create(wxWindow *parent, int id = wxID_ANY, const wxString& title = wxEmptyString, - const wxBitmap& bitmap = wxNullBitmap, + const wxBitmapBundle& bitmap = wxBitmapBundle(), const wxPoint& pos = wxDefaultPosition, long style = wxDEFAULT_DIALOG_STYLE); void Init(); @@ -55,8 +55,8 @@ public: virtual void SetBorder(int border) wxOVERRIDE; /// set/get bitmap - const wxBitmap& GetBitmap() const { return m_bitmap; } - void SetBitmap(const wxBitmap& bitmap); + wxBitmap GetBitmap() const { return m_bitmap.GetBitmapFor(this); } + void SetBitmap(const wxBitmapBundle& bitmap); // implementation only from now on // ------------------------------- @@ -116,6 +116,9 @@ protected: void AddBackNextPair(wxBoxSizer *buttonRow); void AddButtonRow(wxBoxSizer *mainColumn); + // This function can be used as event handle for wxEVT_DPI_CHANGED event. + void WXHandleDPIChanged(wxDPIChangedEvent& event); + // the page size requested by user wxSize m_sizePage; @@ -123,9 +126,9 @@ protected: wxPoint m_posWizard; // wizard state - wxWizardPage *m_page; // the current page or NULL - wxWizardPage *m_firstpage; // the page RunWizard started on or NULL - wxBitmap m_bitmap; // the default bitmap to show + wxWizardPage *m_page; // the current page or NULL + wxWizardPage *m_firstpage; // the page RunWizard started on or NULL + wxBitmapBundle m_bitmap; // the default bitmap to show // wizard controls wxButton *m_btnPrev, // the "GetBitmap(); if ( !bmp.IsOk() ) - bmp = m_bitmap; + bmp = m_bitmap.GetBitmapFor(this); if ( !bmpPrev.IsOk() ) - bmpPrev = m_bitmap; + bmpPrev = m_bitmap.GetBitmapFor(this); if (!GetBitmapPlacement()) { @@ -729,7 +731,7 @@ wxSize wxWizard::GetPageSize() const if ( m_statbmp ) { // make the page at least as tall as the bitmap - pageSize.IncTo(wxSize(0, m_bitmap.GetLogicalHeight())); + pageSize.IncTo(wxSize(0, m_bitmap.GetPreferredLogicalSizeFor(this).GetHeight())); } if ( m_usingSizer ) @@ -862,13 +864,29 @@ void wxWizard::OnWizEvent(wxWizardEvent& event) } } -void wxWizard::SetBitmap(const wxBitmap& bitmap) +void wxWizard::SetBitmap(const wxBitmapBundle& bitmap) { m_bitmap = bitmap; if (m_statbmp) m_statbmp->SetBitmap(m_bitmap); } +void wxWizard::WXHandleDPIChanged(wxDPIChangedEvent& event) +{ + wxBitmap bmp; + if ( m_statbmp ) + { + bmp = m_page->GetBitmap(); + if ( !bmp.IsOk() ) + bmp = m_bitmap.GetBitmapFor(this); + + ResizeBitmap(bmp); + m_statbmp->SetBitmap(bmp); + } + + event.Skip(); +} + // ---------------------------------------------------------------------------- // wxWizardEvent // ---------------------------------------------------------------------------- @@ -948,7 +966,8 @@ bool wxWizard::ResizeBitmap(wxBitmap& bmp) if (!m_statbmp->GetBitmap().IsOk() || m_statbmp->GetBitmap().GetLogicalHeight() != bitmapHeight) { - wxBitmap bitmap(bitmapWidth, bitmapHeight); + wxBitmap bitmap; + bitmap.CreateWithLogicalSize(bitmapWidth, bitmapHeight, bmp.GetScaleFactor(), bmp.GetDepth()); { wxMemoryDC dc; dc.SelectObject(bitmap);