2003-05-23 02:25:34 +00:00
|
|
|
/* IBDocuments.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 2003 Free Software Foundation, Inc.
|
|
|
|
*
|
|
|
|
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
|
|
|
* Date: 2003
|
|
|
|
*
|
|
|
|
* This file is part of GNUstep.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-05-26 03:37:38 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
2003-05-23 02:25:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INCLUDED_IBDOCUMENTS_H
|
|
|
|
#define INCLUDED_IBDOCUMENTS_H
|
|
|
|
|
|
|
|
#include <Foundation/NSGeometry.h>
|
|
|
|
#include <InterfaceBuilder/IBEditors.h>
|
|
|
|
#include <InterfaceBuilder/IBConnectors.h>
|
2004-12-18 13:57:26 +00:00
|
|
|
#include <InterfaceBuilder/IBSystem.h>
|
2003-05-23 02:25:34 +00:00
|
|
|
|
2004-12-18 18:24:28 +00:00
|
|
|
IB_EXTERN NSString *IBDidOpenDocumentNotification;
|
|
|
|
IB_EXTERN NSString *IBWillSaveDocumentNotification;
|
|
|
|
IB_EXTERN NSString *IBDidSaveDocumentNotification;
|
|
|
|
IB_EXTERN NSString *IBWillCloseDocumentNotification;
|
2003-05-23 02:25:34 +00:00
|
|
|
|
|
|
|
@protocol IBDocuments <NSObject>
|
2005-01-01 07:39:12 +00:00
|
|
|
/**
|
|
|
|
* Add a connection
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (void) addConnector: (id<IBConnectors>)aConnector;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an array containing all connections for the receiver.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (NSArray*) allConnectors;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Attaches an object to the document and makes the association
|
|
|
|
* with the parent.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (void) attachObject: (id)anObject toParent: (id)aParent;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Iterates over anArray and attaches all objects in it to the
|
|
|
|
* receiver with aParent as the parent.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (void) attachObjects: (NSArray*)anArray toParent: (id)aParent;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an autoreleased array containing all connections for
|
|
|
|
* the given destination.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (NSArray*) connectorsForDestination: (id)destination;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an autoreleased array containing all connectors of
|
|
|
|
* the given class for the destination.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (NSArray*) connectorsForDestination: (id)destination
|
|
|
|
ofClass: (Class)aConnectorClass;
|
2005-01-01 07:39:12 +00:00
|
|
|
/**
|
|
|
|
* Returns an autoreleased array containing all connections for
|
|
|
|
* the given source.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (NSArray*) connectorsForSource: (id)source;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an autoreleased array containing all connectors of the
|
|
|
|
* given class for the source.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (NSArray*) connectorsForSource: (id)source
|
|
|
|
ofClass: (Class)aConnectorClass;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns YES, if the receiver contains anObject.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (BOOL) containsObject: (id)anObject;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns YES, if the receiver contains an object with the given name
|
|
|
|
* and parent.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (BOOL) containsObjectWithName: (NSString*)aName forParent: (id)parent;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Copies anObject to the pasteboard with the aType.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (BOOL) copyObject: (id)anObject
|
|
|
|
type: (NSString*)aType
|
|
|
|
toPasteboard: (NSPasteboard*)aPasteboard;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Copues an array of objects to aPasteboard with aType.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (BOOL) copyObjects: (NSArray*)anArray
|
|
|
|
type: (NSString*)aType
|
|
|
|
toPasteboard: (NSPasteboard*)aPasteboard;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Detaches anObject from the receiver.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (void) detachObject: (id)anObject;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Detaches an array of objects from the receiver.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (void) detachObjects: (NSArray*)anArray;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The path of the file which represents the document.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (NSString*) documentPath;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when an editor is closed.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (void) editor: (id<IBEditors>)anEditor didCloseForObject: (id)anObject;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the associated editor for anObject, if flag is YES, it will
|
|
|
|
* create an instance of the editor class if one does not already exist
|
|
|
|
* for the given object.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (id<IBEditors>) editorForObject: (id)anObject
|
|
|
|
create: (BOOL)flag;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the associated subeditor for anObject, if flag is YES, it will
|
|
|
|
* create an instance of the editor.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (id<IBEditors>) editorForObject: (id)anObject
|
|
|
|
inEditor: (id<IBEditors>)anEditor
|
|
|
|
create: (BOOL)flag;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the name associated with the object.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (NSString*) nameForObject: (id)anObject;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the object for the given aName.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (id) objectForName: (NSString*)aName;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns all objects in the receiver's name table.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (NSArray*) objects;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates an editor, if necessary using editorForObject:create:, opens it
|
|
|
|
* and brings the window containing the editor to the front.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (id<IBEditors>) openEditorForObject: (id)anObject;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the parent of the given editor.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (id<IBEditors, IBSelectionOwners>) parentEditorForEditor: (id<IBEditors>)anEditor;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
2006-06-05 02:12:00 +00:00
|
|
|
* Return the parent of anObject. The File's Owner is the root object in the
|
|
|
|
* hierarchy, if anObject's parent is the Files's Owner, this method should return
|
|
|
|
* nil.
|
2005-01-01 07:39:12 +00:00
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (id) parentOfObject: (id)anObject;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Pastes the given type from the aPasteboard.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (NSArray*) pasteType: (NSString*)aType
|
|
|
|
fromPasteboard: (NSPasteboard*)aPasteboard
|
|
|
|
parent: (id)parent;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove aConnector from the receiver.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (void) removeConnector: (id<IBConnectors>)aConnector;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The current editor wants to give up the selection, this method iterates
|
|
|
|
* over all editors and determines if any editors will take over the selection.
|
|
|
|
* If one is found it is activated.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (void) resignSelectionForEditor: (id<IBEditors>)editor;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set aName for object in the receiver. This replaces any name the object
|
|
|
|
* may have previously had.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (void) setName: (NSString*)aName forObject: (id)object;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the currently selected object from the given editor.
|
|
|
|
*/
|
2003-05-23 02:25:34 +00:00
|
|
|
- (void) setSelectionFromEditor: (id<IBEditors>)anEditor;
|
2005-01-01 07:39:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Mark document as having been changed.
|
|
|
|
*/
|
|
|
|
- (void) touch;
|
2003-05-23 02:25:34 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
#endif
|