X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6dc2e8233023023f7e3ced53be717bc61e9888ca..1f2f732921b6456c87ab8d180c5bd14456a5b35f:/src/common/fldlgcmn.cpp diff --git a/src/common/fldlgcmn.cpp b/src/common/fldlgcmn.cpp index 71c0a977ce..e57a244cb3 100644 --- a/src/common/fldlgcmn.cpp +++ b/src/common/fldlgcmn.cpp @@ -35,8 +35,10 @@ IMPLEMENT_DYNAMIC_CLASS(wxFileDialogBase, wxDialog) void wxFileDialogBase::Init() { - m_filterIndex = + m_filterIndex = 0; m_windowStyle = 0; + m_extraControl = NULL; + m_extraControlCreator = NULL; } bool wxFileDialogBase::Create(wxWindow *parent, @@ -149,6 +151,35 @@ wxString wxFileDialogBase::AppendExtension(const wxString &filePath, return filePath + ext; } +bool wxFileDialogBase::SetExtraControlCreator(ExtraControlCreatorFunction creator) +{ + wxCHECK_MSG( !m_extraControlCreator, false, + "wxFileDialog::SetExtraControl() called second time" ); + + m_extraControlCreator = creator; + return SupportsExtraControl(); +} + +bool wxFileDialogBase::CreateExtraControl() +{ + if (!m_extraControlCreator || m_extraControl) + return false; + m_extraControl = (*m_extraControlCreator)(this); + return true; +} + +wxSize wxFileDialogBase::GetExtraControlSize() +{ + if ( !m_extraControlCreator ) + return wxDefaultSize; + + // create the extra control in an empty dialog just to find its size: this + // is not terribly efficient but we do need to know the size before + // creating the native dialog and this seems to be the only way + wxDialog dlg(NULL, wxID_ANY, ""); + return (*m_extraControlCreator)(&dlg)->GetSize(); +} + //---------------------------------------------------------------------------- // wxFileDialog convenience functions //----------------------------------------------------------------------------