Skip to content

Commit

Permalink
Allows to set the chooser's type at construction time without calling…
Browse files Browse the repository at this point in the history
… the type(int) function.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8692 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed May 19, 2011
1 parent a64c0dc commit 422a257
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/Fl_Native_File_Chooser_MAC.mm
Expand Up @@ -372,18 +372,6 @@
// SET THE TYPE OF BROWSER
void Fl_Native_File_Chooser::type(int val) {
_btype = val;
switch (_btype) {
case BROWSE_FILE:
case BROWSE_MULTI_FILE:
case BROWSE_DIRECTORY:
case BROWSE_MULTI_DIRECTORY:
_panel = [NSOpenPanel openPanel];
break;
case BROWSE_SAVE_DIRECTORY:
case BROWSE_SAVE_FILE:
_panel = [NSSavePanel savePanel];
break;
}
}

@interface FLopenDelegate : NSObject
Expand Down Expand Up @@ -481,6 +469,18 @@ - (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirme
}
NSAutoreleasePool *localPool;
localPool = [[NSAutoreleasePool alloc] init];
switch (_btype) {
case BROWSE_FILE:
case BROWSE_MULTI_FILE:
case BROWSE_DIRECTORY:
case BROWSE_MULTI_DIRECTORY:
_panel = [NSOpenPanel openPanel];
break;
case BROWSE_SAVE_DIRECTORY:
case BROWSE_SAVE_FILE:
_panel = [NSSavePanel savePanel];
break;
}
int retval;
NSString *nstitle = [NSString stringWithUTF8String: (_title ? _title : "No Title")];
[(NSSavePanel*)_panel setTitle:nstitle];
Expand All @@ -490,6 +490,7 @@ - (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirme
break;
case BROWSE_MULTI_DIRECTORY:
[(NSOpenPanel*)_panel setAllowsMultipleSelection:YES];
/* FALLTHROUGH */
case BROWSE_DIRECTORY:
[(NSOpenPanel*)_panel setCanChooseDirectories:YES];
break;
Expand Down

0 comments on commit 422a257

Please sign in to comment.