implemented wxFileSelectorEx() (this fixes docview behaviour when multiple selections are specified in doc template)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19051 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1540,50 +1540,98 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const
|
|||||||
// global functions
|
// global functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxString
|
// common part of both wxFileSelectorEx() and wxFileSelector()
|
||||||
wxFileSelectorEx(const wxChar *message,
|
static wxString
|
||||||
const wxChar *default_path,
|
DoSelectFile(const wxChar *title,
|
||||||
const wxChar *default_filename,
|
const wxChar *defaultDir,
|
||||||
int *WXUNUSED(indexDefaultExtension),
|
const wxChar *defaultFileName,
|
||||||
const wxChar *wildcard,
|
const wxChar *defaultExtension,
|
||||||
int flags,
|
int *indexDefaultExtension,
|
||||||
wxWindow *parent,
|
const wxChar *filter,
|
||||||
int x, int y)
|
int flags,
|
||||||
|
wxWindow *parent,
|
||||||
|
int x,
|
||||||
|
int y)
|
||||||
{
|
{
|
||||||
// TODO: implement this somehow
|
// the filter may be either given explicitly or created automatically from
|
||||||
return wxFileSelector(message, default_path, default_filename, wxT(""),
|
// the default extension
|
||||||
wildcard, flags, parent, x, y);
|
wxString filterReal;
|
||||||
}
|
if ( filter )
|
||||||
|
{
|
||||||
|
// the user has specified the filter explicitly, use it
|
||||||
|
filterReal = filter;
|
||||||
|
}
|
||||||
|
else if ( !wxIsEmpty(defaultExtension) )
|
||||||
|
{
|
||||||
|
// create the filter to match the given extension
|
||||||
|
filterReal << wxT("*.") << defaultExtension;
|
||||||
|
}
|
||||||
|
|
||||||
wxString wxFileSelector( const wxChar *title,
|
wxFileDialog fileDialog(parent,
|
||||||
const wxChar *defaultDir, const wxChar *defaultFileName,
|
title,
|
||||||
const wxChar *defaultExtension, const wxChar *filter, int flags,
|
defaultDir,
|
||||||
wxWindow *parent, int x, int y )
|
defaultFileName,
|
||||||
{
|
filterReal,
|
||||||
wxString filter2;
|
flags,
|
||||||
if ( defaultExtension && !filter )
|
wxPoint(x, y));
|
||||||
filter2 = wxString(wxT("*.")) + wxString(defaultExtension) ;
|
|
||||||
else if ( filter )
|
|
||||||
filter2 = filter;
|
|
||||||
|
|
||||||
wxString defaultDirString;
|
|
||||||
if (defaultDir)
|
|
||||||
defaultDirString = defaultDir;
|
|
||||||
|
|
||||||
wxString defaultFilenameString;
|
|
||||||
if (defaultFileName)
|
|
||||||
defaultFilenameString = defaultFileName;
|
|
||||||
|
|
||||||
wxFileDialog fileDialog( parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y) );
|
|
||||||
|
|
||||||
|
wxString path;
|
||||||
if ( fileDialog.ShowModal() == wxID_OK )
|
if ( fileDialog.ShowModal() == wxID_OK )
|
||||||
{
|
{
|
||||||
return fileDialog.GetPath();
|
path = fileDialog.GetPath();
|
||||||
}
|
if ( indexDefaultExtension )
|
||||||
else
|
{
|
||||||
{
|
*indexDefaultExtension = fileDialog.GetFilterIndex();
|
||||||
return wxEmptyString;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString
|
||||||
|
wxFileSelectorEx(const wxChar *title,
|
||||||
|
const wxChar *defaultDir,
|
||||||
|
const wxChar *defaultFileName,
|
||||||
|
int *indexDefaultExtension,
|
||||||
|
const wxChar *filter,
|
||||||
|
int flags,
|
||||||
|
wxWindow *parent,
|
||||||
|
int x,
|
||||||
|
int y)
|
||||||
|
{
|
||||||
|
return DoSelectFile(title,
|
||||||
|
defaultDir,
|
||||||
|
defaultFileName,
|
||||||
|
wxT(""), // def ext determined by index
|
||||||
|
indexDefaultExtension,
|
||||||
|
filter,
|
||||||
|
flags,
|
||||||
|
parent,
|
||||||
|
x,
|
||||||
|
y);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString
|
||||||
|
wxFileSelector(const wxChar *title,
|
||||||
|
const wxChar *defaultDir,
|
||||||
|
const wxChar *defaultFileName,
|
||||||
|
const wxChar *defaultExtension,
|
||||||
|
const wxChar *filter,
|
||||||
|
int flags,
|
||||||
|
wxWindow *parent,
|
||||||
|
int x,
|
||||||
|
int y)
|
||||||
|
{
|
||||||
|
return DoSelectFile(title,
|
||||||
|
defaultDir,
|
||||||
|
defaultFileName,
|
||||||
|
defaultExtension,
|
||||||
|
NULL, // not interested in filter index
|
||||||
|
filter,
|
||||||
|
flags,
|
||||||
|
parent,
|
||||||
|
x,
|
||||||
|
y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static wxString GetWildcardString(const wxChar *ext)
|
static wxString GetWildcardString(const wxChar *ext)
|
||||||
|
Reference in New Issue
Block a user