- 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