2003-08-01 22:23:50 +00:00
|
|
|
/* =============================================================================
|
|
|
|
PROJECT: ResKnife
|
|
|
|
FILE: ResKnifeResourceProtocol.h
|
|
|
|
|
|
|
|
PURPOSE: This protocol wraps up whatever implementation the host
|
|
|
|
application (i.e. ResKnife) uses for resources in a way that
|
|
|
|
every editor can get enough information about the resource
|
|
|
|
being edited.
|
|
|
|
|
|
|
|
Or in Nick's immortal words (which I found only *after* I had
|
|
|
|
written the stuff above):
|
|
|
|
|
|
|
|
This protocol allows your plug to interrogate a resource to
|
|
|
|
find out information about it.
|
|
|
|
|
|
|
|
AUTHORS: Nick Shanks, nick(at)nickshanks.com, (c) ~2001.
|
|
|
|
M. Uli Kusterer, witness(at)zathras.de, (c) 2003.
|
|
|
|
|
|
|
|
REVISIONS:
|
2003-08-05 04:08:19 +00:00
|
|
|
2003-08-05 UK Added nameForEditorWindow.
|
2003-08-01 22:23:50 +00:00
|
|
|
2003-07-31 UK Added document accessor, commented.
|
|
|
|
========================================================================== */
|
|
|
|
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
Headers:
|
|
|
|
-------------------------------------------------------------------------- */
|
|
|
|
|
2002-04-29 00:05:34 +00:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2002-02-02 11:48:54 +00:00
|
|
|
|
2003-08-01 22:23:50 +00:00
|
|
|
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
Protocol:
|
|
|
|
-------------------------------------------------------------------------- */
|
2002-02-02 11:48:54 +00:00
|
|
|
|
|
|
|
@protocol ResKnifeResourceProtocol
|
|
|
|
|
2003-08-01 22:23:50 +00:00
|
|
|
-(void) touch;
|
|
|
|
-(BOOL) isDirty;
|
|
|
|
|
|
|
|
-(NSString*) name;
|
|
|
|
-(void) setName: (NSString*)newName;
|
2003-08-05 04:08:19 +00:00
|
|
|
-(NSString*) nameForEditorWindow;
|
2003-08-01 22:23:50 +00:00
|
|
|
|
|
|
|
-(NSString*) type;
|
|
|
|
-(void) setType: (NSString*)newType;
|
|
|
|
-(NSNumber*) resID;
|
|
|
|
-(void) setResID: (NSNumber*)newResID;
|
|
|
|
|
|
|
|
-(NSNumber*) attributes;
|
|
|
|
-(void) setAttributes: (NSNumber*)newAttributes;
|
|
|
|
|
|
|
|
-(NSNumber*) size;
|
|
|
|
-(NSData*) data;
|
|
|
|
-(void) setData: (NSData*)newData;
|
|
|
|
|
|
|
|
-(NSDocument*) document; // Owner of this resource. Useful for looking for resources in same file as yours.
|
2002-02-02 11:48:54 +00:00
|
|
|
|
2002-04-29 00:05:34 +00:00
|
|
|
// These methods are used to retrieve resources other than the one you're editing.
|
|
|
|
// Passing a document of nil will indicate to search in all open documents.
|
|
|
|
// There is currently no way to search in files which haven't been opened.
|
|
|
|
// All returned objects are auoreleased. Retain if you want to keep them.
|
|
|
|
|
|
|
|
// This method may return an empty array
|
|
|
|
+ (NSArray *)allResourcesOfType:(NSString *)typeValue inDocument:(NSDocument *)document;
|
|
|
|
// The next two return the first matching resource found, or nil.
|
|
|
|
+ (id)resourceOfType:(NSString *)typeValue andID:(NSNumber *)resIDValue inDocument:(NSDocument *)document;
|
|
|
|
+ (id)resourceOfType:(NSString *)typeValue withName:(NSString *)nameValue inDocument:(NSDocument *)document;
|
|
|
|
|
2002-02-06 20:57:56 +00:00
|
|
|
@end
|
|
|
|
|
2003-08-01 22:23:50 +00:00
|
|
|
/* -----------------------------------------------------------------------------
|
|
|
|
Resource Notifications:
|
|
|
|
See note in Notifications.m about usage.
|
|
|
|
-------------------------------------------------------------------------- */
|
|
|
|
|
2002-02-14 23:24:53 +00:00
|
|
|
extern NSString *ResourceWillChangeNotification;
|
|
|
|
extern NSString *ResourceNameWillChangeNotification;
|
|
|
|
extern NSString *ResourceTypeWillChangeNotification;
|
|
|
|
extern NSString *ResourceIDWillChangeNotification;
|
|
|
|
extern NSString *ResourceAttributesWillChangeNotification;
|
|
|
|
extern NSString *ResourceDataWillChangeNotification;
|
2002-12-31 19:06:40 +00:00
|
|
|
extern NSString *ResourceWillBeSavedNotification;
|
2002-02-14 23:24:53 +00:00
|
|
|
|
|
|
|
extern NSString *ResourceNameDidChangeNotification;
|
|
|
|
extern NSString *ResourceTypeDidChangeNotification;
|
|
|
|
extern NSString *ResourceIDDidChangeNotification;
|
|
|
|
extern NSString *ResourceAttributesDidChangeNotification;
|
|
|
|
extern NSString *ResourceDataDidChangeNotification;
|
2002-12-31 19:06:40 +00:00
|
|
|
extern NSString *ResourceDidChangeNotification;
|
|
|
|
extern NSString *ResourceWasSavedNotification;
|