2003-07-31 23:52:10 +00:00
|
|
|
/*
|
|
|
|
NSSavePanel.h
|
|
|
|
|
|
|
|
Standard save panel for saving files
|
|
|
|
|
|
|
|
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Author: Scott Christley <scottc@net-community.com>
|
|
|
|
Date: 1996
|
|
|
|
Author: Daniel B?hringer <boehring@biomed.ruhr-uni-bochum.de>
|
|
|
|
Date: August 1998
|
|
|
|
Source by Daniel B?hringer integrated into Scott Christley's preliminary
|
|
|
|
implementation by Felipe A. Rodriguez <far@ix.netcom.com>
|
|
|
|
|
|
|
|
This file is part of the GNUstep GUI Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; see the file COPYING.LIB.
|
|
|
|
If not, write to the Free Software Foundation,
|
2005-05-26 02:52:46 +00:00
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-07-31 23:52:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GNUstep_H_NSSavePanel
|
|
|
|
#define _GNUstep_H_NSSavePanel
|
|
|
|
|
|
|
|
#include <AppKit/NSPanel.h>
|
|
|
|
|
|
|
|
@class NSString;
|
|
|
|
@class NSURL;
|
|
|
|
@class NSBrowser;
|
|
|
|
@class NSButton;
|
|
|
|
@class NSForm;
|
|
|
|
@class NSTextField;
|
|
|
|
@class NSView;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
NSFileHandlingPanelCancelButton = NSCancelButton,
|
|
|
|
NSFileHandlingPanelOKButton = NSOKButton,
|
|
|
|
NSFileHandlingPanelImageButton,
|
|
|
|
NSFileHandlingPanelTitleField,
|
|
|
|
NSFileHandlingPanelBrowser,
|
|
|
|
NSFileHandlingPanelForm,
|
|
|
|
NSFileHandlingPanelHomeButton,
|
|
|
|
NSFileHandlingPanelDiskButton,
|
|
|
|
NSFileHandlingPanelDiskEjectButton
|
|
|
|
};
|
|
|
|
|
|
|
|
@interface NSSavePanel : NSPanel
|
|
|
|
{
|
|
|
|
NSView *_accessoryView;
|
|
|
|
NSView *_bottomView;
|
|
|
|
NSBrowser *_browser;
|
|
|
|
NSForm *_form;
|
|
|
|
NSButton *_okButton;
|
|
|
|
NSTextField *_titleField;
|
|
|
|
NSView *_topView;
|
|
|
|
|
|
|
|
NSSize _originalMinSize;
|
|
|
|
NSSize _originalSize;
|
|
|
|
|
|
|
|
NSString *_requiredFileType;
|
|
|
|
NSString *_directory;
|
|
|
|
NSString *_fullFileName;
|
|
|
|
|
|
|
|
BOOL _treatsFilePackagesAsDirectories;
|
2004-03-06 14:59:50 +00:00
|
|
|
BOOL _allowsOtherFileTypes;
|
|
|
|
BOOL _canCreateDirectories;
|
|
|
|
BOOL _canSelectHiddenExtension;
|
|
|
|
BOOL _isExtensionHidden;
|
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
BOOL _delegateHasCompareFilter;
|
|
|
|
BOOL _delegateHasShowFilenameFilter;
|
|
|
|
BOOL _delegateHasValidNameFilter;
|
|
|
|
BOOL _delegateHasUserEnteredFilename;
|
2004-03-06 14:59:50 +00:00
|
|
|
BOOL _delegateHasDirectoryDidChange;
|
|
|
|
BOOL _delegateHasSelectionDidChange;
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
// YES when we stopped because the user pressed 'OK'
|
|
|
|
BOOL _OKButtonPressed;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Getting the NSSavePanel shared instance
|
|
|
|
*/
|
|
|
|
+ (NSSavePanel *) savePanel;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Customizing the NSSavePanel
|
|
|
|
*/
|
|
|
|
- (void) setAccessoryView: (NSView *)aView;
|
|
|
|
- (NSView *) accessoryView;
|
|
|
|
- (void) setTitle: (NSString *)title;
|
|
|
|
- (NSString *) title;
|
|
|
|
- (void) setPrompt: (NSString *)prompt;
|
|
|
|
- (NSString *) prompt;
|
|
|
|
|
|
|
|
#ifndef STRICT_OPENSTEP
|
2004-03-02 22:20:36 +00:00
|
|
|
- (void) setNameFieldLabel: (NSString *)label;
|
|
|
|
- (NSString *) nameFieldLabel;
|
|
|
|
- (void) setMessage: (NSString *)message;
|
|
|
|
- (NSString *) message;
|
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
/*
|
|
|
|
* Hidding extensions
|
|
|
|
*/
|
|
|
|
- (void) setCanSelectHiddenExtension: (BOOL) flag;
|
2004-03-02 22:20:36 +00:00
|
|
|
- (BOOL) canSelectHiddenExtension;
|
2003-07-31 23:52:10 +00:00
|
|
|
- (BOOL) isExtensionHidden;
|
|
|
|
- (void) setExtensionHidden: (BOOL) flag;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Setting Directory and File Type
|
|
|
|
*/
|
|
|
|
- (NSString *) requiredFileType;
|
|
|
|
- (void) setDirectory: (NSString *)path;
|
|
|
|
- (void) setRequiredFileType: (NSString *)fileType;
|
|
|
|
|
2004-03-02 22:20:36 +00:00
|
|
|
#ifndef STRICT_OPENSTEP
|
|
|
|
- (void) setAllowedFileTypes: (NSArray *)types;
|
|
|
|
- (void) setAllowsOtherFileTypes: (BOOL)flag;
|
|
|
|
- (NSArray *) allowedFileTypes;
|
|
|
|
- (BOOL) allowsOtherFileTypes;
|
|
|
|
#endif
|
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
- (void) setTreatsFilePackagesAsDirectories: (BOOL)flag;
|
|
|
|
- (BOOL) treatsFilePackagesAsDirectories;
|
|
|
|
|
|
|
|
- (void) validateVisibleColumns;
|
|
|
|
|
2004-03-02 22:20:36 +00:00
|
|
|
#ifndef STRICT_OPENSTEP
|
|
|
|
- (void) setCanCreateDirectories: (BOOL)flag;
|
|
|
|
- (BOOL) canCreateDirectories;
|
|
|
|
#endif
|
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
/*
|
|
|
|
* Running the NSSavePanel
|
|
|
|
*/
|
|
|
|
- (int) runModalForDirectory: (NSString *)path file: (NSString *)filename;
|
|
|
|
- (int) runModal;
|
|
|
|
|
|
|
|
#ifndef STRICT_OPENSTEP
|
|
|
|
- (int) runModalForDirectory: (NSString *)path
|
|
|
|
file: (NSString *)filename
|
|
|
|
relativeToWindow: (NSWindow*)window;
|
|
|
|
- (void) beginSheetForDirectory: (NSString *)path
|
|
|
|
file: (NSString *)filename
|
|
|
|
modalForWindow: (NSWindow *)docWindow
|
|
|
|
modalDelegate: (id)delegate
|
|
|
|
didEndSelector: (SEL)didEndSelector
|
|
|
|
contextInfo: (void *)contextInfo;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reading Save Information
|
|
|
|
*/
|
|
|
|
- (NSString *) directory;
|
|
|
|
- (NSString *) filename;
|
|
|
|
#ifndef STRICT_OPENSTEP
|
|
|
|
- (NSURL *) URL;
|
|
|
|
- (BOOL) isExpanded;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Target and Action Methods
|
|
|
|
*/
|
|
|
|
- (void) ok: (id)sender; // target/action of panel's OK button.
|
|
|
|
- (void) cancel: (id)sender; // target/action of panel's cancel button
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Responding to User Input
|
|
|
|
*/
|
|
|
|
- (void) selectText: (id)sender;
|
|
|
|
@end
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Methods Implemented by the Delegate
|
|
|
|
*/
|
|
|
|
@interface NSObject (NSSavePanelDelegate)
|
|
|
|
/**
|
|
|
|
* The NSSavePanel sends this message just before the end of a
|
|
|
|
* modal session for each file name displayed or selected
|
|
|
|
* (including file names in multiple selections). The delegate
|
|
|
|
* determines whether it wants the file identified by filename;
|
|
|
|
* it returns YES if the file name is valid, or NO if the
|
|
|
|
* NSSavePanel should stay in its modal loop and wait for the
|
|
|
|
* user to type in or select a different file name or names. If
|
|
|
|
* the delegate refuses a file name in a multiple selection,
|
|
|
|
* none of the file names in the selection are accepted.
|
|
|
|
*/
|
|
|
|
- (BOOL) panel: (id)sender isValidFilename: (NSString*)filename;
|
|
|
|
- (NSComparisonResult) panel: (id)sender
|
|
|
|
compareFilename: (NSString *)filename1
|
|
|
|
with: (NSString *)filename2
|
|
|
|
caseSensitive: (BOOL)caseSensitive;
|
2005-01-14 15:15:54 +00:00
|
|
|
/** Sent by NSSavePanel to check whether a file should be displayed in
|
|
|
|
the panel or not. The filename argument is the complete path
|
|
|
|
to the file. */
|
2003-07-31 23:52:10 +00:00
|
|
|
- (BOOL) panel: (id)sender shouldShowFilename: (NSString *)filename;
|
|
|
|
- (NSString *)panel: (id)sender
|
|
|
|
userEnteredFilename: (NSString *)fileName
|
|
|
|
confirmed: (BOOL)okFlag;
|
2004-03-02 22:20:36 +00:00
|
|
|
|
|
|
|
#ifndef STRICT_OPENSTEP
|
|
|
|
- (void) panel: (id)sender willExpand: (BOOL)expanding;
|
|
|
|
- (void) panelSelectionDidChange: (id)sender;
|
|
|
|
- (void) panel: (id)sender directoryDidChange: (NSString *)path;
|
|
|
|
#endif
|
2003-07-31 23:52:10 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
#endif /* _GNUstep_H_NSSavePanel */
|