summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2011-05-19 15:40:43 +0000
committerManolo Gouy <Manolo>2011-05-19 15:40:43 +0000
commit422a2570a8da01e2fc1bf15855db82b92e350aa3 (patch)
tree717161fd3ac10cef73c5d20c023b5923db7a5137 /src
parenta64c0dc9f3fef9ccf4406d4726cd662a74c8be00 (diff)
Allows to set the chooser's type at construction time without calling the type(int) function.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8692 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Native_File_Chooser_MAC.mm25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/Fl_Native_File_Chooser_MAC.mm b/src/Fl_Native_File_Chooser_MAC.mm
index 61bbc1eb8..c7594b03a 100644
--- a/src/Fl_Native_File_Chooser_MAC.mm
+++ b/src/Fl_Native_File_Chooser_MAC.mm
@@ -372,18 +372,6 @@ int Fl_Native_File_Chooser::get_saveas_basename(void) {
// 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
@@ -481,6 +469,18 @@ int Fl_Native_File_Chooser::post() {
}
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];
@@ -490,6 +490,7 @@ int Fl_Native_File_Chooser::post() {
break;
case BROWSE_MULTI_DIRECTORY:
[(NSOpenPanel*)_panel setAllowsMultipleSelection:YES];
+ /* FALLTHROUGH */
case BROWSE_DIRECTORY:
[(NSOpenPanel*)_panel setCanChooseDirectories:YES];
break;