From 212d59cd8001d013c6198a7a543f6461aecf492d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 25 May 2022 22:18:43 +0200 Subject: [PATCH] Fix determining the size of wxBitmapComboBox bitmaps Instead of using the size of the first item bitmap, use the size best suited for all the bitmaps, which may result in better appearance if the different bitmaps are not all available in the same sizes. This also fixes the unit test after 80a736250e (Fix margin between wxBitmapComboBox images and text in high DPI, 2022-05-25) and should have been part of it. --- src/common/bmpcboxcmn.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/common/bmpcboxcmn.cpp b/src/common/bmpcboxcmn.cpp index 7fc297982a..3b29913b60 100644 --- a/src/common/bmpcboxcmn.cpp +++ b/src/common/bmpcboxcmn.cpp @@ -67,8 +67,15 @@ void wxBitmapComboBoxBase::UpdateInternals() while ( m_bitmapbundles.size() < GetItemContainer()->GetCount() ) m_bitmapbundles.push_back( wxBitmapBundle() ); - if ( m_usedImgSize.x != -1 && m_bitmapbundles.size() > 0 ) - m_usedImgSize = m_bitmapbundles[0].GetPreferredLogicalSizeFor(GetControl()); + if ( m_usedImgSize.x != -1 ) + { + m_usedImgSize = wxBitmapBundle::GetConsensusSizeFor + ( + GetControl(), + m_bitmapbundles, + wxSize(0, 0) + ); + } } // ----------------------------------------------------------------------------