Re: Adding Document Types Programmatically
Re: Adding Document Types Programmatically
- Subject: Re: Adding Document Types Programmatically
- From: Glenn Andreas <email@hidden>
- Date: Thu, 6 May 2004 09:59:03 -0500
I'm looking for suggestions. I need to dynamically add document
types to a NSDocument-based application that I'm developing. [...]
The document types are used by LaunchServices/Finder to learn which
applications can open a given filetype and by
NSApplication/NSDocumentController to know which class it should
instantiate to the document type.
That's true, but the document type is also passed in the call to
loadDataRepresentation:ofType: and dataRepresentationOfType:. I'd
like to do some processing based on the type and I'd also like the
user to be able to configure the program to handle different types
of documents.
Since you're already getting all the documents, you can subclass
NSDocumentController to provide different types dynamically based on
the file extension via overriding -typeFromFileExtensions: (to
dynamically map different file extensions to different types), and/or
-documentClassForType: (to dynamically map different types to
document classes).
--
Glenn Andreas email@hidden
mondo blobbo, Cythera, Theldrow, oh my!
Mad, Bad, and Dangerous to Know
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.