wxParseWildcard added instead of methods hidden under wxUSE_FILEDLG and wxUSE_DIRDLG.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27811 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-06-15 15:25:33 +00:00
parent f5f3247dcc
commit 9e152a5578
9 changed files with 90 additions and 52 deletions

View File

@@ -80,59 +80,17 @@ wxFileDialogBase::wxFileDialogBase(wxWindow *parent,
}
}
#if WXWIN_COMPATIBILITY_2_4
// Parses the filterStr, returning the number of filters.
// Returns 0 if none or if there's a problem.
// filterStr is in the form: "All files (*.*)|*.*|JPEG Files (*.jpeg)|*.jpg"
int wxFileDialogBase::ParseWildcard(const wxString& filterStr,
wxArrayString& descriptions,
wxArrayString& filters)
{
descriptions.Clear();
filters.Clear();
wxString str(filterStr);
wxString description, filter;
for ( int pos = 0; pos != wxNOT_FOUND; )
{
pos = str.Find(wxT('|'));
if ( pos == wxNOT_FOUND )
{
// if there are no '|'s at all in the string just take the entire
// string as filter
if ( filters.IsEmpty() )
{
descriptions.Add(filterStr);
filters.Add(filterStr);
}
else
{
wxFAIL_MSG( _T("missing '|' in the wildcard string!") );
}
break;
}
description = str.Left(pos);
str = str.Mid(pos + 1);
pos = str.Find(wxT('|'));
if ( pos == wxNOT_FOUND )
{
filter = str;
}
else
{
filter = str.Left(pos);
str = str.Mid(pos + 1);
}
descriptions.Add(description);
filters.Add(filter);
}
return filters.GetCount();
return ::wxParseWildcard(filterStr, descriptions, filters);
}
#endif // WXWIN_COMPATIBILITY_2_4
wxString wxFileDialogBase::AppendExtension(const wxString &filePath,
const wxString &extensionList)
@@ -217,7 +175,7 @@ wxString wxFileSelector(const wxChar *title,
wxArrayString descriptions, filters;
// don't care about errors, handled already by wxFileDialog
(void)wxFileDialogBase::ParseWildcard(filter2, descriptions, filters);
(void)wxParseWildcard(filter2, descriptions, filters);
for (size_t n=0; n<filters.GetCount(); n++)
{
if (filters[n].Contains(defaultExtension))