X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b2c47ad3f8175554fa87190fa027c2e6374a856d..d58526d55433162cef8ad2ed7f422689862c3019:/src/osx/cocoa/filedlg.mm diff --git a/src/osx/cocoa/filedlg.mm b/src/osx/cocoa/filedlg.mm index 83f341d005..0b34682a72 100644 --- a/src/osx/cocoa/filedlg.mm +++ b/src/osx/cocoa/filedlg.mm @@ -30,6 +30,7 @@ #endif #include "wx/filename.h" +#include "wx/tokenzr.h" #include "wx/osx/private.h" @@ -102,34 +103,38 @@ NSArray* GetTypesFromFilter( const wxString filter ) const size_t extCount = extensions.GetCount(); for ( size_t i = 0 ; i < extCount; i++ ) { - wxString extension = extensions[i]; - - // Remove leading '*' - if (extension.length() && (extension.GetChar(0) == '*')) - extension = extension.Mid( 1 ); - - // Remove leading '.' - if (extension.length() && (extension.GetChar(0) == '.')) - extension = extension.Mid( 1 ); - - if ( extension.IsEmpty() ) + wxString extensiongroup = extensions[i]; + wxStringTokenizer tokenizer( extensiongroup , wxT(";") ) ; + while ( tokenizer.HasMoreTokens() ) { - if ( types != nil ) - [types release]; - return nil; - } + wxString extension = tokenizer.GetNextToken() ; + // Remove leading '*' + if (extension.length() && (extension.GetChar(0) == '*')) + extension = extension.Mid( 1 ); + // Remove leading '.' + if (extension.length() && (extension.GetChar(0) == '.')) + extension = extension.Mid( 1 ); - if ( types == nil ) - types = [[NSMutableArray alloc] init]; + if ( extension.IsEmpty() ) + { + if ( types != nil ) + [types release]; + return nil; + } - wxCFStringRef cfext(extension); - [types addObject: (NSString*)cfext.AsNSString() ]; + if ( types == nil ) + types = [[NSMutableArray alloc] init]; + + wxCFStringRef cfext(extension); + [types addObject: (NSString*)cfext.AsNSString() ]; #if 0 - // add support for classic fileType / creator here - wxUint32 fileType, creator; - // extension -> mactypes + // add support for classic fileType / creator here + wxUint32 fileType, creator; + // extension -> mactypes #endif + } + } } return types; @@ -171,7 +176,8 @@ int wxFileDialog::ShowModal() if ( HasFlag(wxFD_OVERWRITE_PROMPT) ) { } - + +/* if (parentWindow) { NSWindow* nativeParent = parentWindow->GetWXWindow(); @@ -185,6 +191,7 @@ int wxFileDialog::ShowModal() [sheetDelegate release]; } else +*/ { returnCode = [sPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() ]; } @@ -211,6 +218,7 @@ int wxFileDialog::ShowModal() [oPanel setCanChooseFiles:YES]; [oPanel setMessage:cf.AsNSString()]; +/* if (parentWindow) { NSWindow* nativeParent = parentWindow->GetWXWindow(); @@ -225,6 +233,7 @@ int wxFileDialog::ShowModal() [sheetDelegate release]; } else +*/ { returnCode = [oPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() types:types];