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:
parent
aa926768a9
commit
7430a4bbf8
@ -107,9 +107,9 @@ public:
|
||||
bool HasFdFlag(int flag) const { return HasFlag(flag); }
|
||||
|
||||
virtual void SetMessage(const wxString& message) { m_message = message; }
|
||||
virtual void SetPath(const wxString& path) { m_path = path; }
|
||||
virtual void SetDirectory(const wxString& dir) { m_dir = dir; }
|
||||
virtual void SetFilename(const wxString& name) { m_fileName = name; }
|
||||
virtual void SetPath(const wxString& path);
|
||||
virtual void SetDirectory(const wxString& dir);
|
||||
virtual void SetFilename(const wxString& name);
|
||||
virtual void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
|
||||
virtual void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; }
|
||||
|
||||
|
@ -61,6 +61,10 @@ public:
|
||||
|
||||
virtual ~wxGenericFileDialog();
|
||||
|
||||
virtual void SetDirectory(const wxString& dir)
|
||||
{ m_filectrl->SetDirectory(dir); }
|
||||
virtual void SetFilename(const wxString& name)
|
||||
{ m_filectrl->SetFilename(name); }
|
||||
virtual void SetMessage(const wxString& message) { SetTitle(message); }
|
||||
virtual void SetPath(const wxString& path)
|
||||
{ m_filectrl->SetPath(path); }
|
||||
|
@ -29,7 +29,6 @@ public:
|
||||
const wxSize& sz = wxDefaultSize,
|
||||
const wxString& name = wxFileDialogNameStr);
|
||||
|
||||
virtual void SetPath(const wxString& path);
|
||||
virtual void GetPaths(wxArrayString& paths) const;
|
||||
virtual void GetFilenames(wxArrayString& files) const;
|
||||
#ifndef __WXWINCE__
|
||||
|
@ -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
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -174,14 +174,6 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const
|
||||
files = m_fileNames;
|
||||
}
|
||||
|
||||
void wxFileDialog::SetPath(const wxString& path)
|
||||
{
|
||||
wxString ext;
|
||||
wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext);
|
||||
if ( !ext.empty() )
|
||||
m_fileName << wxT('.') << ext;
|
||||
}
|
||||
|
||||
void wxFileDialog::DoGetPosition(int *x, int *y) const
|
||||
{
|
||||
if ( x )
|
||||
|
Loading…
Reference in New Issue
Block a user