-IMPLEMENT_CLASS(wxFileDialog, wxDialog)
-
-// ----------------------------------------------------------------------------
-// global functions
-// ----------------------------------------------------------------------------
-
-wxString wxFileSelector(
- const char* pzTitle
-, const char* pzDefaultDir
-, const char* pzDefaultFileName
-, const char* pzDefaultExtension
-, const char* pzFilter
-, int nFlags
-, wxWindow* pParent
-, int nX
-, int nY
-)
-{
- wxString sFilter("");
- wxString sDefaultDirString;
- wxString sDefaultFilenameString;
-
- //
- // If there's a default extension specified but no filter, we create
- // a suitable filter.
- //
- if (pzDefaultExtension && !pzFilter)
- sFilter = wxString("*.") + wxString(pzDefaultExtension);
- else if (pzFilter)
- sFilter = pzFilter;
-
- if (pzDefaultDir)
- sDefaultDirString = pzDefaultDir;
- else
- sDefaultDirString = "";
-
- if (pzDefaultFileName)
- sDefaultFilenameString = pzDefaultFileName;
- else
- sDefaultFilenameString = "";
-
- wxFileDialog vFileDialog( pParent
- ,pzTitle
- ,sDefaultDirString
- ,sDefaultFilenameString
- ,sFilter
- ,nFlags
- ,wxPoint(nX, nY)
- );
-
- if (wxStrlen(pzDefaultExtension) != 0)
- {
- int nFilterFind = 0;
- int nFilterIndex = 0;
-
- for (unsigned int i = 0; i < sFilter.Len(); i++)
- {
- if (sFilter.GetChar(i) == wxT('|'))
- {
- //
- // Save the start index of the new filter
- unsigned int uIs = i++;
-
- //
- // Find the end of the filter
- //
- for(; i < sFilter.Len(); i++)
- {
- if(sFilter[i] == wxT('|'))
- break;
- }