I have a document based application, that so far simply edits documents with a new window for each document.
I'm now adding the ability to create a project, which is a document in itself. That project will contain a list of files that can be edited using (hopefully) the same code as my existing NSDocument
subclass, with the exception that the document editor will be embedded into the project window, not opened in a new window.
How does Xcode, for example, open each file in the editor pane, without using a new window per document? I assume it uses the document-based architecture since it behaves much like any other document-based application with the exception of the single window thing.
Since an NSDocument
must (according to the documentation) have it's own window controller, is it possible to "embed" that window inside another window (i.e. inside my project window), making the chrome invisible to give the effect of a single window?
EDIT: This discussion on CocoaDev looks really useful: Document Based App With One Window For All Documents
Obviously this is a long standing questions but because I recently was (and still am) in the same situation and couldn't find any useful solutions to the issue I started a testbed project myself and hosted it on Github: https://github.com/lemonmojo/NSDocumentSingleWindowTest
It's still a work in progress but the most important bits are there, waiting to be improved. You should be able to extract just the code you require for your project pretty easily.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With