NSDocument

From GNUstepWiki
Revision as of 19:50, 20 March 2005 by Stefan Urbanek (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

NSDocument is ...

Code chunks

Multiple editors

If your document uses multiple editors and each is represented with a single NSWindowController, you can commit all edits like in the following (obvious) code. Requirement is, that each NSWindowController should implement commitEditing.

- (void)commitEdits
{
   NSWindowController *controller;
   NSEnumerator       *enumerator;
   
   enumerator = [[self windowControllers] objectEnumerator];
   
   while( (controller = [enumerator nextObject]) )
   {
       if([controller respondsToSelector:@selector(commitEditing)])
       {
           [controller commitEditing];
       }
   }
}