Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking to introduce tabs to document-based application, ideas?

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

like image 573
d11wtq Avatar asked Nov 06 '22 06:11

d11wtq


1 Answers

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.

like image 57
lemonmojo Avatar answered Nov 09 '22 14:11

lemonmojo