home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Examples / AppKit / Yap / YapDocument.m < prev    next >
Text File  |  1996-04-10  |  873b  |  39 lines

  1. /*
  2.  *  YapDocument.m
  3.  *  Author: Ali Ozer
  4.  *  Created: Mar 89 for 0.9
  5.  *  Modified: Jan 96 for 4.0
  6.  *
  7.  *  You may freely copy, distribute and reuse the code in this example.
  8.  *  NeXT disclaims any warranty of any kind, expressed or implied,
  9.  *  as to its fitness for any particular use.
  10.  */
  11.  
  12. #import "YapDocument.h"
  13. #import "YapOutput.h"
  14.  
  15. @implementation YapDocument
  16.  
  17. - (void)setOutputView:(YapOutput *)view {
  18.     outputView = view;
  19. }
  20.  
  21. - (YapOutput *)outputView {
  22.     return outputView;
  23. }
  24.  
  25. - (void)execute:(id)sender {
  26.     NSData *psData = [[[self textView] string] dataUsingEncoding:[NSString defaultCStringEncoding]];
  27.     if (psData) {
  28.         [[self outputView] executePostScriptData:psData];
  29.     }
  30. }
  31.  
  32. + (NSArray *)fileTypes {
  33.     static NSArray *types = nil;
  34.     if (types == nil) types = [[NSArray alloc] initWithObjects:@"ps", @"eps", nil];
  35.     return types;
  36. }
  37.  
  38. @end
  39.