Update images when DPI changes in wxBookCtrlBase-derived classes

Just pretend that the images themselves have changed, this should be
enough to recreate wxImageList from the bundle using the new scale
factor in UpdateImageListIfNecessary().
This commit is contained in:
Vadim Zeitlin
2021-11-07 16:06:55 +00:00
parent b0d9465921
commit 725c3d5608
2 changed files with 16 additions and 0 deletions

View File

@@ -360,6 +360,10 @@ private:
// common part of all ctors
void Init();
// update the images if we use them on DPI change
void WXHandleDPIChanged(wxDPIChangedEvent& event);
// internal border
unsigned int m_internalBorder;

View File

@@ -41,6 +41,8 @@ wxBEGIN_EVENT_TABLE(wxBookCtrlBase, wxControl)
#if wxUSE_HELP
EVT_HELP(wxID_ANY, wxBookCtrlBase::OnHelp)
#endif // wxUSE_HELP
EVT_DPI_CHANGED(wxBookCtrlBase::WXHandleDPIChanged)
wxEND_EVENT_TABLE()
// ----------------------------------------------------------------------------
@@ -291,6 +293,16 @@ wxSize wxBookCtrlBase::GetControllerSize() const
// miscellaneous stuff
// ----------------------------------------------------------------------------
void wxBookCtrlBase::WXHandleDPIChanged(wxDPIChangedEvent& event)
{
if ( HasImages() )
{
OnImagesChanged();
}
event.Skip();
}
#if wxUSE_HELP
void wxBookCtrlBase::OnHelp(wxHelpEvent& event)