Fix width of file type wxChoice in open dialogs on macOS

When using both an extra control and wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES
set to 1 to show file types, the controls for the latter stretch towards
the dialog's width.

Fix by not stretching the wxChoice used for filtering and surrounding
the file type controls with stretching spacers instead. This makes
the filter controls appear the same as without an extra control:
horizontally centred and not stretching.
This commit is contained in:
Dimitri Schoolwerth
2021-02-13 00:04:45 +01:00
parent 25f981bfad
commit 5cc2f6ce9f

View File

@@ -261,10 +261,12 @@ wxWindow* wxFileDialog::CreateFilterPanel(wxWindow *extracontrol)
{
wxBoxSizer *horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
verticalSizer->Add(horizontalSizer, 0, wxEXPAND, 0);
horizontalSizer->AddStretchSpacer();
wxStaticText *stattext = new wxStaticText( extrapanel, wxID_ANY, _("File type:") );
horizontalSizer->Add(stattext, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_filterChoice = new wxChoice(extrapanel, wxID_ANY);
horizontalSizer->Add(m_filterChoice, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
horizontalSizer->Add(m_filterChoice, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
horizontalSizer->AddStretchSpacer();
m_filterChoice->Append(m_filterNames);
if( m_filterNames.GetCount() > 0)
{