Added header, replaced import with include

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6653 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2000-06-10 16:17:13 +00:00
parent 8aeb8af007
commit db0f58f235
3 changed files with 267 additions and 169 deletions

View file

@ -1,134 +1,165 @@
/*
#import <Foundation/Foundation.h> NSDocument.h
#import <AppKit/NSNibDeclarations.h>
The abstract document class
@class NSArray, NSMutableArray, NSData;
@class NSURL, NSUndoManager; Copyright (C) 1999 Free Software Foundation, Inc.
@class NSWindow, NSView, NSSavePanel, NSMenuItem, NSPrintInfo, NSPopUpButton, NSFileWrapper; Author: Carl Lindberg <Carl.Lindberg@hbo.com>
@class NSDocumentController, NSWindowController; Date: 1999
This file is part of the GNUstep GUI Library.
typedef enum _NSDocumentChangeType {
NSChangeDone = 0, This library is free software; you can redistribute it and/or
NSChangeUndone = 1, modify it under the terms of the GNU Library General Public
NSChangeCleared = 2 License as published by the Free Software Foundation; either
} NSDocumentChangeType; version 2 of the License, or (at your option) any later version.
typedef enum _NSSaveOperationType { This library is distributed in the hope that it will be useful,
NSSaveOperation = 0, but WITHOUT ANY WARRANTY; without even the implied warranty of
NSSaveAsOperation = 1, MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
NSSaveToOperation = 2 Library General Public License for more details.
} NSSaveOperationType;
You should have received a copy of the GNU Library General Public
@interface NSDocument : NSObject License along with this library; see the file COPYING.LIB.
{ If not, write to the Free Software Foundation,
@private 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
NSWindow *_window; // Outlet for the single window case */
NSMutableArray *_windowControllers; // WindowControllers for this document
NSString *_fileName; // Save location #ifndef _GNUstep_H_NSDocument
NSString *_fileType; // file/document type #define _GNUstep_H_NSDocument
NSPrintInfo *_printInfo; // print info record
long _changeCount; // number of time the document has been changed #include <Foundation/Foundation.h>
NSView *savePanelAccessory; // outlet for the accessory save-panel view #include <AppKit/NSNibDeclarations.h>
NSPopUpButton *spaButton; // outlet for "the File Format:" button in the save panel.
int _documentIndex; // Untitled index
NSUndoManager *_undoManager; // Undo manager for this document @class NSURL, NSUndoManager;
struct __docFlags { @class NSWindow, NSView, NSSavePanel, NSMenuItem;
unsigned int inClose:1; @class NSPrintInfo, NSPopUpButton, NSFileWrapper;
unsigned int hasUndoManager:1; @class NSDocumentController, NSWindowController;
unsigned int RESERVED:30;
} _docFlags;
void *_reserved1; typedef enum _NSDocumentChangeType {
} NSChangeDone = 0,
NSChangeUndone = 1,
/*" Initialization "*/ NSChangeCleared = 2
- (id)init; } NSDocumentChangeType;
- (id)initWithContentsOfFile:(NSString *)fileName ofType:(NSString *)fileType;
- (id)initWithContentsOfURL:(NSURL *)url ofType:(NSString *)fileType; typedef enum _NSSaveOperationType {
NSSaveOperation = 0,
/*" Window management "*/ NSSaveAsOperation = 1,
- (NSArray *)windowControllers; NSSaveToOperation = 2
- (void)addWindowController:(NSWindowController *)windowController; } NSSaveOperationType;
- (BOOL)shouldCloseWindowController:(NSWindowController *)windowController;
- (void)showWindows; @interface NSDocument : NSObject
{
/*" Window controller creation "*/ @private
- (void)makeWindowControllers; // Manual creation NSWindow *_window; // Outlet for the single window case
- (NSString *)windowNibName; // Automatic creation (Document will be the nib owner) NSMutableArray *_windowControllers; // WindowControllers for this document
NSString *_fileName; // Save location
/*" Window loading notifications "*/ NSString *_fileType; // file/document type
// Only called if the document is the owner of the nib NSPrintInfo *_printInfo; // print info record
- (void)windowControllerWillLoadNib:(NSWindowController *)windowController; long _changeCount; // number of time the document has been changed
- (void)windowControllerDidLoadNib:(NSWindowController *)windowController; NSView *savePanelAccessory; // outlet for the accessory save-panel view
NSPopUpButton *spaButton; // outlet for "the File Format:" button in the save panel.
/*" Edited flag "*/ int _documentIndex; // Untitled index
- (BOOL)isDocumentEdited; NSUndoManager *_undoManager; // Undo manager for this document
- (void)updateChangeCount:(NSDocumentChangeType)change; struct __docFlags {
unsigned int inClose:1;
/*" Display Name (window title) "*/ unsigned int hasUndoManager:1;
- (NSString *)displayName; unsigned int RESERVED:30;
} _docFlags;
/*" Backup file "*/ void *_reserved1;
- (BOOL)keepBackupFile; }
/*" Closing "*/ /*" Initialization "*/
- (void)close; - (id)init;
- (BOOL)canCloseDocument; - (id)initWithContentsOfFile:(NSString *)fileName ofType:(NSString *)fileType;
- (id)initWithContentsOfURL:(NSURL *)url ofType:(NSString *)fileType;
/*" Type and location "*/
- (NSString *)fileName; /*" Window management "*/
- (void)setFileName:(NSString *)fileName; - (NSArray *)windowControllers;
- (NSString *)fileType; - (void)addWindowController:(NSWindowController *)windowController;
- (void)setFileType:(NSString *)type; - (BOOL)shouldCloseWindowController:(NSWindowController *)windowController;
+ (NSArray *)readableTypes; - (void)showWindows;
+ (NSArray *)writableTypes;
+ (BOOL)isNativeType:(NSString *)type; /*" Window controller creation "*/
- (void)makeWindowControllers; // Manual creation
/*" Read/Write/Revert "*/ - (NSString *)windowNibName; // Automatic creation (Document will be the nib owner)
- (NSData *)dataRepresentationOfType:(NSString *)type; /*" Window loading notifications "*/
- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)type; // Only called if the document is the owner of the nib
- (void)windowControllerWillLoadNib:(NSWindowController *)windowController;
- (NSFileWrapper *)fileWrapperRepresentationOfType:(NSString *)type; - (void)windowControllerDidLoadNib:(NSWindowController *)windowController;
- (BOOL)loadFileWrapperRepresentation:(NSFileWrapper *)wrapper ofType:(NSString *)type;
/*" Edited flag "*/
- (BOOL)writeToFile:(NSString *)fileName ofType:(NSString *)type; - (BOOL)isDocumentEdited;
- (BOOL)readFromFile:(NSString *)fileName ofType:(NSString *)type; - (void)updateChangeCount:(NSDocumentChangeType)change;
- (BOOL)revertToSavedFromFile:(NSString *)fileName ofType:(NSString *)type;
/*" Display Name (window title) "*/
- (BOOL)writeToURL:(NSURL *)url ofType:(NSString *)type; - (NSString *)displayName;
- (BOOL)readFromURL:(NSURL *)url ofType:(NSString *)type;
- (BOOL)revertToSavedFromURL:(NSURL *)url ofType:(NSString *)type; /*" Backup file "*/
- (BOOL)keepBackupFile;
/*" Save panel "*/
- (BOOL)shouldRunSavePanelWithAccessoryView; /*" Closing "*/
- (NSString *)fileNameFromRunningSavePanelForSaveOperation:(NSSaveOperationType)saveOperation; - (void)close;
- (int)runModalSavePanel:(NSSavePanel *)savePanel withAccessoryView:(NSView *)accessoryView; - (BOOL)canCloseDocument;
/*" Printing "*/ /*" Type and location "*/
- (NSPrintInfo *)printInfo; - (NSString *)fileName;
- (void)setPrintInfo:(NSPrintInfo *)printInfo; - (void)setFileName:(NSString *)fileName;
- (BOOL)shouldChangePrintInfo:(NSPrintInfo *)newPrintInfo; - (NSString *)fileType;
- (IBAction)runPageLayout:(id)sender; - (void)setFileType:(NSString *)type;
- (int)runModalPageLayoutWithPrintInfo:(NSPrintInfo *)printInfo; + (NSArray *)readableTypes;
- (IBAction)printDocument:(id)sender; + (NSArray *)writableTypes;
- (void)printShowingPrintPanel:(BOOL)flag; + (BOOL)isNativeType:(NSString *)type;
/*" IB Actions "*/ /*" Read/Write/Revert "*/
- (IBAction)saveDocument:(id)sender;
- (IBAction)saveDocumentAs:(id)sender; - (NSData *)dataRepresentationOfType:(NSString *)type;
- (IBAction)saveDocumentTo:(id)sender; - (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)type;
- (IBAction)revertDocumentToSaved:(id)sender;
- (NSFileWrapper *)fileWrapperRepresentationOfType:(NSString *)type;
/*" Menus "*/ - (BOOL)loadFileWrapperRepresentation:(NSFileWrapper *)wrapper ofType:(NSString *)type;
- (BOOL)validateMenuItem:(NSMenuItem *)anItem;
- (BOOL)writeToFile:(NSString *)fileName ofType:(NSString *)type;
/*" Undo "*/ - (BOOL)readFromFile:(NSString *)fileName ofType:(NSString *)type;
- (NSUndoManager *)undoManager; - (BOOL)revertToSavedFromFile:(NSString *)fileName ofType:(NSString *)type;
- (void)setUndoManager:(NSUndoManager *)undoManager;
- (BOOL)hasUndoManager; - (BOOL)writeToURL:(NSURL *)url ofType:(NSString *)type;
- (void)setHasUndoManager:(BOOL)flag; - (BOOL)readFromURL:(NSURL *)url ofType:(NSString *)type;
- (BOOL)revertToSavedFromURL:(NSURL *)url ofType:(NSString *)type;
@end
/*" Save panel "*/
- (BOOL)shouldRunSavePanelWithAccessoryView;
- (NSString *)fileNameFromRunningSavePanelForSaveOperation:(NSSaveOperationType)saveOperation;
- (int)runModalSavePanel:(NSSavePanel *)savePanel withAccessoryView:(NSView *)accessoryView;
/*" Printing "*/
- (NSPrintInfo *)printInfo;
- (void)setPrintInfo:(NSPrintInfo *)printInfo;
- (BOOL)shouldChangePrintInfo:(NSPrintInfo *)newPrintInfo;
- (IBAction)runPageLayout:(id)sender;
- (int)runModalPageLayoutWithPrintInfo:(NSPrintInfo *)printInfo;
- (IBAction)printDocument:(id)sender;
- (void)printShowingPrintPanel:(BOOL)flag;
/*" IB Actions "*/
- (IBAction)saveDocument:(id)sender;
- (IBAction)saveDocumentAs:(id)sender;
- (IBAction)saveDocumentTo:(id)sender;
- (IBAction)revertDocumentToSaved:(id)sender;
/*" Menus "*/
- (BOOL)validateMenuItem:(NSMenuItem *)anItem;
/*" Undo "*/
- (NSUndoManager *)undoManager;
- (void)setUndoManager:(NSUndoManager *)undoManager;
- (BOOL)hasUndoManager;
- (void)setHasUndoManager:(BOOL)flag;
@end
#endif // _GNUstep_H_NSDocument

View file

@ -1,6 +1,35 @@
/*
NSDocumentController.h
#import <Foundation/Foundation.h> The document controller class
#import <AppKit/NSNibDeclarations.h>
Copyright (C) 1999 Free Software Foundation, Inc.
Author: Carl Lindberg <Carl.Lindberg@hbo.com>
Date: 1999
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,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _GNUstep_H_NSDocumentController
#define _GNUstep_H_NSDocumentController
#include <Foundation/Foundation.h>
#include <AppKit/NSNibDeclarations.h>
@class NSArray, NSMutableArray; @class NSArray, NSMutableArray;
@class NSURL; @class NSURL;
@ -11,6 +40,7 @@
{ {
@private @private
NSMutableArray *_documents; NSMutableArray *_documents;
NSMutableArray *_recentDocuments;
struct __controllerFlags { struct __controllerFlags {
unsigned int shouldCreateUI:1; unsigned int shouldCreateUI:1;
unsigned int RESERVED:31; unsigned int RESERVED:31;
@ -30,10 +60,8 @@
- (id)openUntitledDocumentOfType:(NSString*)type display:(BOOL)display; - (id)openUntitledDocumentOfType:(NSString*)type display:(BOOL)display;
- (id)openDocumentWithContentsOfFile:(NSString *)fileName display:(BOOL)display; - (id)openDocumentWithContentsOfFile:(NSString *)fileName display:(BOOL)display;
#if NS_URL - (id)makeDocumentWithContentsOfURL:(NSURL *)url ofType:(NSString *)type;
//- (id)makeDocumentWithContentsOfURL:(NSURL *)url ofType:(NSString *)type; - (id)openDocumentWithContentsOfURL:(NSURL *)url display:(BOOL)display;
//- (id)openDocumentWithContentsOfURL:(NSURL *)url display:(BOOL)display;
#endif
/*" With or without UI "*/ /*" With or without UI "*/
- (BOOL)shouldCreateUI; - (BOOL)shouldCreateUI;
@ -43,15 +71,20 @@
- (IBAction)saveAllDocuments:(id)sender; - (IBAction)saveAllDocuments:(id)sender;
- (IBAction)openDocument:(id)sender; - (IBAction)openDocument:(id)sender;
- (IBAction)newDocument:(id)sender; - (IBAction)newDocument:(id)sender;
- (IBAction)clearRecentDocuments:(id)sender;
/*" Recent Documents "*/
- (void)noteNewRecentDocumentURL:(NSURL *)anURL;
- (NSArray *)recentDocumentURLs;
/*" Open panel "*/ /*" Open panel "*/
#if NS_URL - (NSArray *)URLsFromRunningOpenPanel;
//- (NSArray *)URLsFromRunningOpenPanel;
#endif
- (NSArray *)fileNamesFromRunningOpenPanel; - (NSArray *)fileNamesFromRunningOpenPanel;
- (int)runModalOpenPanel:(NSOpenPanel *)openPanel forTypes:(NSArray *)openableFileExtensions; - (int)runModalOpenPanel:(NSOpenPanel *)openPanel forTypes:(NSArray *)openableFileExtensions;
/*" Document management "*/ /*" Document management "*/
- (void)addDocument:(NSDocument *)document;
- (void)removeDocument:(NSDocument *)document;
- (BOOL)closeAllDocuments; - (BOOL)closeAllDocuments;
- (BOOL)reviewUnsavedDocumentsWithAlertTitle:(NSString *)title cancellable:(BOOL)cancellable; - (BOOL)reviewUnsavedDocumentsWithAlertTitle:(NSString *)title cancellable:(BOOL)cancellable;
- (NSArray *)documents; - (NSArray *)documents;
@ -61,6 +94,7 @@
- (id)documentForWindow:(NSWindow *)window; - (id)documentForWindow:(NSWindow *)window;
- (id)documentForFileName:(NSString *)fileName; - (id)documentForFileName:(NSString *)fileName;
/*" Menu validation "*/ /*" Menu validation "*/
- (BOOL)validateMenuItem:(NSMenuItem *)anItem; - (BOOL)validateMenuItem:(NSMenuItem *)anItem;
@ -72,3 +106,5 @@
@end @end
#endif // _GNUstep_H_NSDocumentController

View file

@ -1,26 +1,57 @@
/*
#import "NSDocumentController.h" NSDocumentFramworkPrivate.h
@interface NSDocumentController (Private) The private methods of all the classes of the document framework
- (NSArray *)_editorAndViewerTypesForClass:(Class)documentClass;
- (NSArray *)_editorTypesForClass:(Class)fp12; Copyright (C) 1999 Free Software Foundation, Inc.
- (NSArray *)_exportableTypesForClass:(Class)documentClass;
- (void)_removeDocument:(NSDocument *)document; Author: Carl Lindberg <Carl.Lindberg@hbo.com>
@end Date: 1999
This file is part of the GNUstep GUI Library.
#import "NSDocument.h"
This library is free software; you can redistribute it and/or
@interface NSDocument (Private) modify it under the terms of the GNU Library General Public
- (void)_removeWindowController:(NSWindowController *)controller; License as published by the Free Software Foundation; either
- (NSWindow *)_transferWindowOwnership; version 2 of the License, or (at your option) any later version.
@end
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
#import "NSWindowController.h" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
@interface NSWindowController (Private)
- (void)_windowDidLoad; You should have received a copy of the GNU Library General Public
- (void)_synchronizeWindowTitleWithDocumentName; License along with this library; see the file COPYING.LIB.
- (void)setWindow:(NSWindow *)window; If not, write to the Free Software Foundation,
@end 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _GNUstep_H_NSDocumentFramworkPrivate
#define _GNUstep_H_NSDocumentFramworkPrivate
#include "NSDocumentController.h"
@interface NSDocumentController (Private)
- (NSArray *)_editorAndViewerTypesForClass:(Class)documentClass;
- (NSArray *)_editorTypesForClass:(Class)fp12;
- (NSArray *)_exportableTypesForClass:(Class)documentClass;
- (void)_removeDocument:(NSDocument *)document;
@end
#include "NSDocument.h"
@interface NSDocument (Private)
- (void)_removeWindowController:(NSWindowController *)controller;
- (NSWindow *)_transferWindowOwnership;
@end
#include "NSWindowController.h"
@interface NSWindowController (Private)
- (void)_windowDidLoad;
- (void)_synchronizeWindowTitleWithDocumentName;
- (void)setWindow:(NSWindow *)window;
@end
#endif // _GNUstep_H_NSDocumentFramworkPrivate