mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 22:21:00 +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
3905d62a8f
commit
fc1f564fbb
1 changed files with 70 additions and 22 deletions
|
@ -57,11 +57,8 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
||||||
@interface NSSavePanel (_PrivateMethods)
|
@interface NSSavePanel (_PrivateMethods)
|
||||||
- (void) _resetDefaults;
|
- (void) _resetDefaults;
|
||||||
- (void) _selectCellName: (NSString *)title;
|
- (void) _selectCellName: (NSString *)title;
|
||||||
@end
|
- (void) _selectTextInColumn: (int)column;
|
||||||
//
|
- (void) _setupForDirectory: (NSString *)path file: (NSString *)filename;
|
||||||
|
|
||||||
@interface NSOpenPanel (_PrivateMethods)
|
|
||||||
- (void) _resetDefaults;
|
|
||||||
- (BOOL) _shouldShowExtension: (NSString *)extension isDir: (BOOL *)isDir;
|
- (BOOL) _shouldShowExtension: (NSString *)extension isDir: (BOOL *)isDir;
|
||||||
@end
|
@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
|
@end
|
||||||
|
|
||||||
@implementation NSOpenPanel
|
@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
|
* Running the NSOpenPanel
|
||||||
*/
|
*/
|
||||||
|
@ -346,27 +381,40 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
|
||||||
{
|
{
|
||||||
ASSIGN (_fileTypes, fileTypes);
|
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
|
return [self runModalForDirectory: path
|
||||||
file: name];
|
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
|
- (void) ok: (id)sender
|
||||||
{
|
{
|
||||||
NSMatrix *matrix = nil;
|
NSMatrix *matrix = nil;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue