Make wxFileDialog::Set/SetPath() behave consistently.
wxFileDialog::GetPath() didn't return the value set by a previous call to SetPath() in wxMSW version. Fix this and also implement SetPath() and SetDirectory() methods in the generic versions in the same way as SetFilename(). Closes #3672. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62722 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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
|
||||
//----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user