Difference between revisions of "NSDocument"

From GNUstepWiki
Jump to navigation Jump to search
 
(Added categories)
 
(7 intermediate revisions by 5 users not shown)
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 ==
Line 22: Line 22:
 
     }
 
     }
 
  }
 
  }
 +
 +
 +
[[Category:AppKit]]
 +
[[Category:Snippets]]

Latest revision as of 15:50, 21 April 2006

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