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.
This commit is contained in:
Vadim Zeitlin
2022-05-25 22:18:43 +02:00
parent 76d1b3c9a9
commit 212d59cd80

View File

@@ -67,8 +67,15 @@ void wxBitmapComboBoxBase::UpdateInternals()
while ( m_bitmapbundles.size() < GetItemContainer()->GetCount() ) while ( m_bitmapbundles.size() < GetItemContainer()->GetCount() )
m_bitmapbundles.push_back( wxBitmapBundle() ); m_bitmapbundles.push_back( wxBitmapBundle() );
if ( m_usedImgSize.x != -1 && m_bitmapbundles.size() > 0 ) if ( m_usedImgSize.x != -1 )
m_usedImgSize = m_bitmapbundles[0].GetPreferredLogicalSizeFor(GetControl()); {
m_usedImgSize = wxBitmapBundle::GetConsensusSizeFor
(
GetControl(),
m_bitmapbundles,
wxSize(0, 0)
);
}
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------