Auto-size theme list

This commit is contained in:
Jon Evans 2020-05-05 21:44:00 -04:00
parent 51eac3e3e6
commit 66eb84097a
1 changed files with 11 additions and 0 deletions

View File

@ -163,6 +163,12 @@ void PANEL_COLOR_SETTINGS::OnThemeChanged( wxCommandEvent& event )
void PANEL_COLOR_SETTINGS::createThemeList( const wxString& aCurrent )
{
int width = 0;
int height = 0;
m_cbTheme->GetTextExtent( _( "New Theme..." ), &width, &height );
int minwidth = width;
m_cbTheme->Clear();
for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() )
@ -171,10 +177,15 @@ void PANEL_COLOR_SETTINGS::createThemeList( const wxString& aCurrent )
if( settings->GetFilename() == aCurrent )
m_cbTheme->SetSelection( pos );
m_cbTheme->GetTextExtent( settings->GetName(), &width, &height );
minwidth = std::max( minwidth, width );
}
m_cbTheme->Append( wxT( "---" ) );
m_cbTheme->Append( _( "New Theme..." ) );
m_cbTheme->SetMinSize( wxSize( minwidth + 50, -1 ) );
}