mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 12:00:52 +00:00
Implemented [URLs]. New method [_setupForDirectory:file:]. Simplified
[runModalForDirectory:file:types:]. Implemented [runModalForDirectory:...relativeToWindow:] and [beginSheetForDirectory:...]. Declare all needed private methods from NSSavePanel. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10924 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6b2f41f67e
commit
37ebea42c2
1 changed files with 70 additions and 22 deletions
|
@ -57,11 +57,8 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
|||
@interface NSSavePanel (_PrivateMethods)
|
||||
- (void) _resetDefaults;
|
||||
- (void) _selectCellName: (NSString *)title;
|
||||
@end
|
||||
//
|
||||
|
||||
@interface NSOpenPanel (_PrivateMethods)
|
||||
- (void) _resetDefaults;
|
||||
- (void) _selectTextInColumn: (int)column;
|
||||
- (void) _setupForDirectory: (NSString *)path file: (NSString *)filename;
|
||||
- (BOOL) _shouldShowExtension: (NSString *)extension isDir: (BOOL *)isDir;
|
||||
@end
|
||||
|
||||
|
@ -200,6 +197,30 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (void) _setupForDirectory: (NSString *)path file: (NSString *)filename
|
||||
{
|
||||
if (path == nil)
|
||||
{
|
||||
if (_directory)
|
||||
path = _directory;
|
||||
else
|
||||
path = [[NSFileManager defaultManager] currentDirectoryPath];
|
||||
}
|
||||
|
||||
if (filename == nil)
|
||||
filename = @"";
|
||||
else if([filename isEqual: @""] == NO)
|
||||
[_okButton setEnabled: YES];
|
||||
|
||||
if (_canChooseDirectories == NO)
|
||||
{
|
||||
if([_browser allowsMultipleSelection] == YES)
|
||||
[_browser setAllowsBranchSelection:NO];
|
||||
}
|
||||
|
||||
[super _setupForDirectory: path file: filename];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSOpenPanel
|
||||
|
@ -330,6 +351,20 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (NSArray *) URLs
|
||||
{
|
||||
NSMutableArray *ret = [NSMutableArray new];
|
||||
NSEnumerator *enumerator = [[self filenames] objectEnumerator];
|
||||
NSString *filename;
|
||||
|
||||
while ((filename = [enumerator nextObject]) != nil)
|
||||
{
|
||||
[ret addObject: [NSURL fileURLWithPath: filename]];
|
||||
}
|
||||
|
||||
return AUTORELEASE(ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* Running the NSOpenPanel
|
||||
*/
|
||||
|
@ -346,27 +381,40 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
|||
{
|
||||
ASSIGN (_fileTypes, fileTypes);
|
||||
|
||||
if (path == nil)
|
||||
{
|
||||
if (_directory)
|
||||
path = _directory;
|
||||
else
|
||||
path= [[NSFileManager defaultManager] currentDirectoryPath];
|
||||
}
|
||||
|
||||
if (name == nil)
|
||||
name = @"";
|
||||
|
||||
if (_canChooseDirectories == NO)
|
||||
{
|
||||
if([_browser allowsMultipleSelection] == YES)
|
||||
[_browser setAllowsBranchSelection:NO];
|
||||
}
|
||||
|
||||
return [self runModalForDirectory: path
|
||||
file: name];
|
||||
}
|
||||
|
||||
- (int)runModalForDirectory:(NSString *)path
|
||||
file:(NSString *)name
|
||||
types:(NSArray *)fileTypes
|
||||
relativeToWindow:(NSWindow*)window
|
||||
{
|
||||
ASSIGN (_fileTypes, fileTypes);
|
||||
|
||||
return [self runModalForDirectory: path
|
||||
file: name
|
||||
relativeToWindow: window];
|
||||
}
|
||||
|
||||
- (void)beginSheetForDirectory:(NSString *)path
|
||||
file:(NSString *)name
|
||||
types:(NSArray *)fileTypes
|
||||
modalForWindow:(NSWindow *)docWindow
|
||||
modalDelegate:(id)delegate
|
||||
didEndSelector:(SEL)didEndSelector
|
||||
contextInfo:(void *)contextInfo
|
||||
{
|
||||
ASSIGN (_fileTypes, fileTypes);
|
||||
|
||||
[self beginSheetForDirectory: path
|
||||
file: name
|
||||
modalForWindow: docWindow
|
||||
modalDelegate: delegate
|
||||
didEndSelector: didEndSelector
|
||||
contextInfo: contextInfo];
|
||||
}
|
||||
|
||||
- (void) ok: (id)sender
|
||||
{
|
||||
NSMatrix *matrix = nil;
|
||||
|
|
Loading…
Reference in a new issue