Refactor repetitions into wxFileDialogBase::UpdateExtraControlUI()

No real changes, just prepare for the next commit before repeating more
code.
This commit is contained in:
Dimitri Schoolwerth
2021-02-13 00:30:02 +01:00
parent 5cc2f6ce9f
commit 57688cf2da
4 changed files with 12 additions and 6 deletions

View File

@@ -181,6 +181,9 @@ protected:
{ return m_extraControlCreator != NULL; } { return m_extraControlCreator != NULL; }
// get the size of the extra control by creating and deleting it // get the size of the extra control by creating and deleting it
wxSize GetExtraControlSize(); wxSize GetExtraControlSize();
// Helper function for native file dialog usage where no wx events
// are processed.
void UpdateExtraControlUI();
private: private:
ExtraControlCreatorFunction m_extraControlCreator; ExtraControlCreatorFunction m_extraControlCreator;

View File

@@ -192,6 +192,12 @@ wxSize wxFileDialogBase::GetExtraControlSize()
return (*m_extraControlCreator)(&dlg)->GetSize(); return (*m_extraControlCreator)(&dlg)->GetSize();
} }
void wxFileDialogBase::UpdateExtraControlUI()
{
if ( m_extraControl )
m_extraControl->UpdateWindowUI(wxUPDATE_UI_RECURSE);
}
void wxFileDialogBase::SetPath(const wxString& path) void wxFileDialogBase::SetPath(const wxString& path)
{ {
wxString ext; wxString ext;

View File

@@ -496,8 +496,7 @@ void wxFileDialog::GTKSelectionChanged(const wxString& filename)
{ {
m_currentlySelectedFilename = filename; m_currentlySelectedFilename = filename;
if (m_extraControl) UpdateExtraControlUI();
m_extraControl->UpdateWindowUI(wxUPDATE_UI_RECURSE);
} }
#endif // wxUSE_FILEDLG #endif // wxUSE_FILEDLG

View File

@@ -353,8 +353,7 @@ void wxFileDialog::MSWOnSelChange(WXHWND hDlg)
else else
m_currentlySelectedFilename.clear(); m_currentlySelectedFilename.clear();
if ( m_extraControl ) UpdateExtraControlUI();
m_extraControl->UpdateWindowUI(wxUPDATE_UI_RECURSE);
} }
void wxFileDialog::MSWOnTypeChange(WXHWND WXUNUSED(hDlg), int nFilterIndex) void wxFileDialog::MSWOnTypeChange(WXHWND WXUNUSED(hDlg), int nFilterIndex)
@@ -364,8 +363,7 @@ void wxFileDialog::MSWOnTypeChange(WXHWND WXUNUSED(hDlg), int nFilterIndex)
// circumstances, so take care before decrementing it. // circumstances, so take care before decrementing it.
m_currentlySelectedFilterIndex = nFilterIndex ? nFilterIndex - 1 : 0; m_currentlySelectedFilterIndex = nFilterIndex ? nFilterIndex - 1 : 0;
if ( m_extraControl ) UpdateExtraControlUI();
m_extraControl->UpdateWindowUI(wxUPDATE_UI_RECURSE);
} }
// helper used below in ShowCommFileDialog(): style is used to determine // helper used below in ShowCommFileDialog(): style is used to determine