X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/25fc812c7439ed77f8fb7a8b05fb12a7a11a6cd8..536732e4822cc89c41a3b753c2a7f83abf98793d:/src/os2/filedlg.cpp diff --git a/src/os2/filedlg.cpp b/src/os2/filedlg.cpp index cb87d850f1..6c3135b1b5 100644 --- a/src/os2/filedlg.cpp +++ b/src/os2/filedlg.cpp @@ -58,127 +58,6 @@ #endif 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; - } - - if( i - uIs - 1 > 0 && uIs + 1 < sFilter.Len() ) - { - if(sFilter.Mid(uIs + 1, i - uIs - 1).Contains(pzDefaultExtension)) - { - nFilterFind = nFilterIndex; - break; - } - } - nFilterIndex++; - } - } - vFileDialog.SetFilterIndex(nFilterFind); - } - if (vFileDialog.ShowModal() == wxID_OK) - { - return vFileDialog.GetPath(); - } - else - return wxEmptyString; -} // end of wxFileSelector - -wxString wxFileSelectorEx ( - const char* pzTitle -, const char* pzDefaultDir -, const char* pzDefaultFileName -, int* pnDefaultFilterIndex -, const char* pzFilter -, int nFlags -, wxWindow* pParent -, int nX -, int nY -) -{ - wxFileDialog vFileDialog( pParent - ,pzTitle ? pzTitle : "" - ,pzDefaultDir ? pzDefaultDir : "" - ,pzDefaultFileName ? pzDefaultFileName : "" - ,pzFilter ? pzFilter : "" - ,nFlags - ,wxPoint(nX, nY) - ); - - if (vFileDialog.ShowModal() == wxID_OK) - { - *pnDefaultFilterIndex = vFileDialog.GetFilterIndex(); - return vFileDialog.GetPath(); - } - else - return wxEmptyString; -} // end of wxFileSelectorEx - // ---------------------------------------------------------------------------- // CLASS wxFileDialog // ---------------------------------------------------------------------------- @@ -443,75 +322,3 @@ int wxFileDialog::ShowModal() return wxID_CANCEL; } // end of wxFileDialog::ShowModal -// -// Generic file load/save dialog -// -static wxString wxDefaultFileSelector ( - bool bLoad -, const char* pzWhat -, const char* pzExtension -, const char* pzDefaultName -, wxWindow* pParent -) -{ - char* pzExt = (char *)pzExtension; - char zPrompt[50]; - wxString sStr; - char zWild[60]; - - if (bLoad) - sStr = "Load %s file"; - else - sStr = "Save %s file"; - sprintf(zPrompt, wxGetTranslation(sStr), pzWhat); - - if (*pzExt == '.') - pzExt++; - sprintf(zWild, "*.%s", pzExt); - return wxFileSelector ( zPrompt - ,NULL - ,pzDefaultName - ,pzExt - ,zWild - ,0 - ,pParent - ); -} // end of wxDefaultFileSelector - -// -// Generic file load dialog -// -wxString wxLoadFileSelector ( - const char* pzWhat -, const char* pzExtension -, const char* pzDefaultName -, wxWindow* pParent -) -{ - return wxDefaultFileSelector( TRUE - ,pzWhat - ,pzExtension - ,pzDefaultName - ,pParent - ); -} // end of wxLoadFileSelector - - -// -// Generic file save dialog -// -wxString wxSaveFileSelector ( - const char* pzWhat -, const char* pzExtension -, const char* pzDefaultName -, wxWindow* pParent -) -{ - return wxDefaultFileSelector( FALSE - ,pzWhat - ,pzExtension - ,pzDefaultName - ,pParent - ); -} // end of wxSaveFileSelector -