Author: manolo
Date: 2011-05-19 08:40:43 -0700 (Thu, 19 May 2011)
New Revision: 8692
Log:
Allows to set the chooser's type at construction time without calling the 
type(int) function.

Modified:
   branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm

Modified: branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm
===================================================================
--- branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm       2011-05-19 
12:24:29 UTC (rev 8691)
+++ branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm       2011-05-19 
15:40:43 UTC (rev 8692)
@@ -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 
@@ -481,6 +469,18 @@
   }
   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 @@
       break;
     case BROWSE_MULTI_DIRECTORY:
       [(NSOpenPanel*)_panel setAllowsMultipleSelection:YES];
+      /* FALLTHROUGH */
     case BROWSE_DIRECTORY:
       [(NSOpenPanel*)_panel setCanChooseDirectories:YES];
       break;

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to