Re: NSWindowControllers and NSWindow
Re: NSWindowControllers and NSWindow
- Subject: Re: NSWindowControllers and NSWindow
- From: Graham Cox <email@hidden>
- Date: Tue, 17 Feb 2015 10:48:22 +1100
> On 17 Feb 2015, at 1:17 am, Dave <email@hidden> wrote:
>
> My initial thought were to have a WindowController:
>
> LTWMainWindowController that looks after a number of Windows. Initial there is just one window LTWWindowX (but I want to add others in the future, LTWWindowY, LTWWindowZ, etc.), each window looks after a different aspect of the application.
>
> I was planning on having a separate Class for LTWMainWindowController and LTWWindowX, LTWWindowY and LTWWindowZ.
>
> Does this sounds like a reasonable approach?
>
This sounds very, very similar to the standard document architecture, except instead of a "master" window controller, you have a NSDocument subclass. That manages the data model, and keeps a list of any number of window controllers, each of which manages the particular window kind dsiplaying one aspect of the data model. Though normally NSDocument only has a single window controller, it is designed to have any number, for exactly the sort of scenario you have outlined.
Of course NSDocument has become something of a complicated class in recent years, and it may be that it's just too much for your needs, but it's still well worth looking at, simply because it fits your outline and for all its complexity, works, has been debugged already.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden