X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a83f860948059b0273b5cc6d9e43fadad3ebfca..17d98558b35b75e3cad68d96841b4fa5a0c7e6ee:/src/common/fldlgcmn.cpp diff --git a/src/common/fldlgcmn.cpp b/src/common/fldlgcmn.cpp index 1d68284280..f4b4e0a778 100644 --- a/src/common/fldlgcmn.cpp +++ b/src/common/fldlgcmn.cpp @@ -20,6 +20,7 @@ #include "wx/filedlg.h" #include "wx/dirdlg.h" +#include "wx/filename.h" #ifndef WX_PRECOMP #include "wx/string.h" @@ -180,6 +181,27 @@ wxSize wxFileDialogBase::GetExtraControlSize() return (*m_extraControlCreator)(&dlg)->GetSize(); } +void wxFileDialogBase::SetPath(const wxString& path) +{ + wxString ext; + wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext); + if ( !ext.empty() ) + m_fileName << _T('.') << ext; + m_path = path; +} + +void wxFileDialogBase::SetDirectory(const wxString& dir) +{ + m_dir = dir; + m_path = wxFileName(m_dir, m_fileName).GetFullPath(); +} + +void wxFileDialogBase::SetFilename(const wxString& name) +{ + m_fileName = name; + m_path = wxFileName(m_dir, m_fileName).GetFullPath(); +} + //---------------------------------------------------------------------------- // wxFileDialog convenience functions //----------------------------------------------------------------------------