]> git.saurik.com Git - wxWidgets.git/commitdiff
Use the common wxParseCommonDialogsFilter function
authorMattia Barbon <mbarbon@cpan.org>
Sat, 5 Mar 2005 17:16:44 +0000 (17:16 +0000)
committerMattia Barbon <mbarbon@cpan.org>
Sat, 5 Mar 2005 17:16:44 +0000 (17:16 +0000)
in wxMotif wxFileDialog.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32620 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/motif/filedlg.cpp

index 1f6746ce6c2975b1d3f3a4bc5f510be5a93da9dd..1945cadf3a7ed8c557bd64a23c4a631bad756729 100644 (file)
@@ -100,18 +100,19 @@ static wxString ParseWildCard( const wxString& wild )
         _T("wildcard syntax");
 #endif
 
-    wxStringTokenizer tok( wild, _T("|") );
-
-    wxCHECK_MSG( tok.CountTokens() <= 2, _T("*.*"), msg );
-
-    if( tok.CountTokens() == 1 ) return wild;
-
-    // CountTokens == 2
-    tok.GetNextToken();
-    wxStringTokenizer tok2( tok.GetNextToken(), _T(";") );
-
-    wxCHECK_MSG( tok2.CountTokens() == 1, tok2.GetNextToken(), msg );
-    return tok2.GetNextToken();
+    wxArrayString wildDescriptions, wildFilters;
+    const size_t count = wxParseCommonDialogsFilter(wild,
+                                                    wildDescriptions,
+                                                    wildFilters);
+    wxCHECK_MSG( count, _T("*.*"), wxT("wxFileDialog: bad wildcard string") );
+    wxCHECK_MSG( count == 1, _T("*.*"), msg );
+
+    // check for *.txt;*.rtf
+    wxStringTokenizer tok2( wildFilters[0], _T(";") );
+    wxString wildcard = tok2.GetNextToken();
+
+    wxCHECK_MSG( tok2.CountTokens() <= 1, wildcard, msg );
+    return wildcard;
 }
 
 wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,