NSDocument

From GNUstepWiki

(Difference between revisions)
Revision as of 19:50, 20 March 2005
Stefan Urbanek (Talk | contribs)

← Previous diff
Revision as of 06:22, 5 July 2005
Quineska (Talk | contribs)
Defined NSDocument more completely
Next diff →
Line 1: Line 1:
-NSDocument is ...+NSDocument is an AppKit class used to implement document-based applications. It is subclassed so that instances represent specific "document" types.
== Code chunks == == Code chunks ==

Revision as of 06:22, 5 July 2005

NSDocument is an AppKit class used to implement document-based applications. It is subclassed so that instances represent specific "document" types.

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];
       }
   }
}