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:
parent
93fac60414
commit
ce9462d21d
@ -1540,50 +1540,98 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const
|
||||
// global functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxString
|
||||
wxFileSelectorEx(const wxChar *message,
|
||||
const wxChar *default_path,
|
||||
const wxChar *default_filename,
|
||||
int *WXUNUSED(indexDefaultExtension),
|
||||
const wxChar *wildcard,
|
||||
int flags,
|
||||
wxWindow *parent,
|
||||
int x, int y)
|
||||
// common part of both wxFileSelectorEx() and wxFileSelector()
|
||||
static wxString
|
||||
DoSelectFile(const wxChar *title,
|
||||
const wxChar *defaultDir,
|
||||
const wxChar *defaultFileName,
|
||||
const wxChar *defaultExtension,
|
||||
int *indexDefaultExtension,
|
||||
const wxChar *filter,
|
||||
int flags,
|
||||
wxWindow *parent,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
// TODO: implement this somehow
|
||||
return wxFileSelector(message, default_path, default_filename, wxT(""),
|
||||
wildcard, flags, parent, x, y);
|
||||
}
|
||||
// the filter may be either given explicitly or created automatically from
|
||||
// the default extension
|
||||
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,
|
||||
const wxChar *defaultDir, const wxChar *defaultFileName,
|
||||
const wxChar *defaultExtension, const wxChar *filter, int flags,
|
||||
wxWindow *parent, int x, int y )
|
||||
{
|
||||
wxString filter2;
|
||||
if ( defaultExtension && !filter )
|
||||
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) );
|
||||
wxFileDialog fileDialog(parent,
|
||||
title,
|
||||
defaultDir,
|
||||
defaultFileName,
|
||||
filterReal,
|
||||
flags,
|
||||
wxPoint(x, y));
|
||||
|
||||
wxString path;
|
||||
if ( fileDialog.ShowModal() == wxID_OK )
|
||||
{
|
||||
return fileDialog.GetPath();
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxEmptyString;
|
||||
path = fileDialog.GetPath();
|
||||
if ( indexDefaultExtension )
|
||||
{
|
||||
*indexDefaultExtension = fileDialog.GetFilterIndex();
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user