mirror of
https://github.com/fltk/fltk.git
synced 2026-06-05 16:12:13 +08:00
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
This commit is contained in:
@@ -372,18 +372,6 @@ int Fl_Native_File_Chooser::get_saveas_basename(void) {
|
|||||||
// SET THE TYPE OF BROWSER
|
// SET THE TYPE OF BROWSER
|
||||||
void Fl_Native_File_Chooser::type(int val) {
|
void Fl_Native_File_Chooser::type(int val) {
|
||||||
_btype = 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
|
@interface FLopenDelegate : NSObject
|
||||||
@@ -481,6 +469,18 @@ int Fl_Native_File_Chooser::post() {
|
|||||||
}
|
}
|
||||||
NSAutoreleasePool *localPool;
|
NSAutoreleasePool *localPool;
|
||||||
localPool = [[NSAutoreleasePool alloc] init];
|
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;
|
int retval;
|
||||||
NSString *nstitle = [NSString stringWithUTF8String: (_title ? _title : "No Title")];
|
NSString *nstitle = [NSString stringWithUTF8String: (_title ? _title : "No Title")];
|
||||||
[(NSSavePanel*)_panel setTitle:nstitle];
|
[(NSSavePanel*)_panel setTitle:nstitle];
|
||||||
@@ -490,6 +490,7 @@ int Fl_Native_File_Chooser::post() {
|
|||||||
break;
|
break;
|
||||||
case BROWSE_MULTI_DIRECTORY:
|
case BROWSE_MULTI_DIRECTORY:
|
||||||
[(NSOpenPanel*)_panel setAllowsMultipleSelection:YES];
|
[(NSOpenPanel*)_panel setAllowsMultipleSelection:YES];
|
||||||
|
/* FALLTHROUGH */
|
||||||
case BROWSE_DIRECTORY:
|
case BROWSE_DIRECTORY:
|
||||||
[(NSOpenPanel*)_panel setCanChooseDirectories:YES];
|
[(NSOpenPanel*)_panel setCanChooseDirectories:YES];
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user