mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 22:40:48 +00:00
* Headers/AppKit/NSSavePanel.h,
* Source/NSSavePanel.m: beginSheetModalForWindow: and beginWithCompletionHander: implementations git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36968 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
24829740bc
commit
c209f41c6a
3 changed files with 50 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2013-08-12 Lubos Dolezel <lubos@dolezel.info>
|
||||||
|
|
||||||
|
* Headers/AppKit/NSSavePanel.h,
|
||||||
|
* Source/NSSavePanel.m: beginSheetModalForWindow: and
|
||||||
|
beginWithCompletionHander: implementations
|
||||||
|
|
||||||
2013-08-08 16:27-EDT Gregory John Casamento <greg.casamento@gmail.com>
|
2013-08-08 16:27-EDT Gregory John Casamento <greg.casamento@gmail.com>
|
||||||
|
|
||||||
* Headers/AppKit/AppKit.h: Add new header for NSStatusItem.h
|
* Headers/AppKit/AppKit.h: Add new header for NSStatusItem.h
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#ifndef _GNUstep_H_NSSavePanel
|
#ifndef _GNUstep_H_NSSavePanel
|
||||||
#define _GNUstep_H_NSSavePanel
|
#define _GNUstep_H_NSSavePanel
|
||||||
#import <GNUstepBase/GSVersionMacros.h>
|
#import <GNUstepBase/GSVersionMacros.h>
|
||||||
|
#import <GNUstepBase/GSBlocks.h>
|
||||||
|
|
||||||
#import <AppKit/NSPanel.h>
|
#import <AppKit/NSPanel.h>
|
||||||
|
|
||||||
|
@ -81,6 +82,7 @@ enum {
|
||||||
- (BOOL)panel:(id)sender shouldShowFilename:(NSString*)filename;
|
- (BOOL)panel:(id)sender shouldShowFilename:(NSString*)filename;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
DEFINE_BLOCK_TYPE(GSSavePanelCompletionHandler, void, NSInteger);
|
||||||
|
|
||||||
@interface NSSavePanel : NSPanel
|
@interface NSSavePanel : NSPanel
|
||||||
{
|
{
|
||||||
|
@ -117,6 +119,7 @@ enum {
|
||||||
BOOL _OKButtonPressed;
|
BOOL _OKButtonPressed;
|
||||||
|
|
||||||
NSMenu *_showsHiddenFilesMenu;
|
NSMenu *_showsHiddenFilesMenu;
|
||||||
|
GSSavePanelCompletionHandler _completionHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -206,6 +209,12 @@ enum {
|
||||||
contextInfo: (void *)contextInfo;
|
contextInfo: (void *)contextInfo;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||||
|
- (void) beginSheetModalForWindow:(NSWindow *)window
|
||||||
|
completionHandler:(GSSavePanelCompletionHandler)handler;
|
||||||
|
- (void) beginWithCompletionHandler:(GSSavePanelCompletionHandler)handler;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reading Save Information
|
* Reading Save Information
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
#import "AppKit/NSDragging.h"
|
#import "AppKit/NSDragging.h"
|
||||||
#import "AppKit/NSSavePanel.h"
|
#import "AppKit/NSSavePanel.h"
|
||||||
#import "AppKit/NSTextField.h"
|
#import "AppKit/NSTextField.h"
|
||||||
|
#import "AppKit/NSWindowController.h"
|
||||||
#import "AppKit/NSWorkspace.h"
|
#import "AppKit/NSWorkspace.h"
|
||||||
|
|
||||||
#import "GSGuiPrivate.h"
|
#import "GSGuiPrivate.h"
|
||||||
|
@ -1110,6 +1111,20 @@ selectCellWithString: (NSString*)title
|
||||||
return [self runModalForDirectory: [self directory] file: [self filename]];
|
return [self runModalForDirectory: [self directory] file: [self filename]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) beginSheetModalForWindow:(NSWindow *)window
|
||||||
|
completionHandler:(GSSavePanelCompletionHandler)handler
|
||||||
|
{
|
||||||
|
NSInteger result = [NSApp runModalForWindow: self
|
||||||
|
relativeToWindow: window];
|
||||||
|
CALL_BLOCK(handler, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) beginWithCompletionHandler:(GSSavePanelCompletionHandler)handler
|
||||||
|
{
|
||||||
|
self->_completionHandler = Block_copy(handler);
|
||||||
|
[self makeKeyAndOrderFront: self];
|
||||||
|
}
|
||||||
|
|
||||||
/**<p> Initializes the panel to the directory specified by path and,
|
/**<p> Initializes the panel to the directory specified by path and,
|
||||||
optionally, the file specified by filename, then displays it and
|
optionally, the file specified by filename, then displays it and
|
||||||
begins its modal event loop; path and filename can be empty
|
begins its modal event loop; path and filename can be empty
|
||||||
|
@ -1218,7 +1233,16 @@ selectCellWithString: (NSString*)title
|
||||||
{
|
{
|
||||||
ASSIGN(_directory, pathToColumn(_browser, [_browser lastColumn]));
|
ASSIGN(_directory, pathToColumn(_browser, [_browser lastColumn]));
|
||||||
[self _updateDefaultDirectory];
|
[self _updateDefaultDirectory];
|
||||||
[NSApp stopModalWithCode: NSCancelButton];
|
|
||||||
|
if (self->_completionHandler == NULL)
|
||||||
|
[NSApp stopModalWithCode: NSCancelButton];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CALL_BLOCK(self->_completionHandler, NSCancelButton);
|
||||||
|
Block_release(self->_completionHandler);
|
||||||
|
self->_completionHandler = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
[_okButton setEnabled: NO];
|
[_okButton setEnabled: NO];
|
||||||
[self close];
|
[self close];
|
||||||
}
|
}
|
||||||
|
@ -1389,7 +1413,16 @@ selectCellWithString: (NSString*)title
|
||||||
return;
|
return;
|
||||||
|
|
||||||
[self _updateDefaultDirectory];
|
[self _updateDefaultDirectory];
|
||||||
[NSApp stopModalWithCode: NSOKButton];
|
|
||||||
|
if (self->_completionHandler == NULL)
|
||||||
|
[NSApp stopModalWithCode: NSOKButton];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CALL_BLOCK(self->_completionHandler, NSOKButton);
|
||||||
|
Block_release(self->_completionHandler);
|
||||||
|
self->_completionHandler = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
[_okButton setEnabled: NO];
|
[_okButton setEnabled: NO];
|
||||||
[self close];
|
[self close];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue