Don't allow using GetPath/GetFilename() with wxFD_MULTIPLE

GetPaths/GetFilenames() must be used instead when more than one file
could be selected: document this and assert if the wrong functions are
called.

Closes https://github.com/wxWidgets/wxWidgets/pull/1883
This commit is contained in:
Ian McInerney
2020-06-02 10:34:37 +01:00
committed by Vadim Zeitlin
parent 284cf9a872
commit 4ac648901d
6 changed files with 35 additions and 4 deletions

View File

@@ -73,13 +73,19 @@ public:
{ m_filectrl->SetWildcard(wildCard); }
virtual wxString GetPath() const wxOVERRIDE
{ return m_filectrl->GetPath(); }
{
wxCHECK_MSG( !HasFlag(wxFD_MULTIPLE), wxString(), "When using wxFD_MULTIPLE, must call GetPaths() instead" );
return m_filectrl->GetPath();
}
virtual void GetPaths(wxArrayString& paths) const wxOVERRIDE
{ m_filectrl->GetPaths(paths); }
virtual wxString GetDirectory() const wxOVERRIDE
{ return m_filectrl->GetDirectory(); }
virtual wxString GetFilename() const wxOVERRIDE
{ return m_filectrl->GetFilename(); }
{
wxCHECK_MSG( !HasFlag(wxFD_MULTIPLE), wxString(), "When using wxFD_MULTIPLE, must call GetFilenames() instead" );
return m_filectrl->GetFilename();
}
virtual void GetFilenames(wxArrayString& files) const wxOVERRIDE
{ m_filectrl->GetFilenames(files); }
virtual wxString GetWildcard() const wxOVERRIDE