home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / Rhapsody / Graphics / Morph-2.0a / Document.m < prev    next >
Encoding:
Text File  |  1998-01-25  |  1.2 KB  |  74 lines

  1.  
  2. #import "Document.h"
  3.  
  4. @implementation Document
  5.  
  6. + (NSSet *) readableFileTypes
  7. {
  8.     return nil;
  9. }
  10.  
  11. - initWithContentsOfFile:(NSString *)file
  12. {
  13.     self = [super init];
  14.     [self setFilePath:file];
  15.     return self;
  16. }
  17.  
  18. - init
  19. {
  20.     return [self initWithContentsOfFile:nil];
  21. }
  22.  
  23. - (void) dealloc
  24. {
  25.     [super dealloc];
  26. }
  27.  
  28. - (NSString *) filePath
  29. {
  30.     return filePath;
  31. }
  32.  
  33. - (void) setFilePath:(NSString *)path
  34. {
  35.     [filePath release];
  36.     filePath = [path retain];
  37.     if (filePath != nil)
  38.         [window setTitleWithRepresentedFilename:filePath];
  39. }
  40.  
  41. - (void)show
  42. {
  43.     NSPoint position;
  44.     NSWindow *mainWin;
  45.     
  46.     // Cascade from current window, if any.
  47.     mainWin = [[NSApplication sharedApplication] mainWindow];
  48.     if ( mainWin == nil )
  49.     {
  50.         position.x = position.y = 80.0;
  51.     }
  52.     else
  53.     {
  54.         position.x = position.y = 10.0;
  55.         position = [mainWin cascadeTopLeftFromPoint:position];
  56.     }
  57.     [window cascadeTopLeftFromPoint:position];
  58.     [window makeKeyAndOrderFront:self];
  59. }
  60.  
  61. /* Window delegate methods */
  62. - (void)windowWillClose:(NSNotification *)note
  63. {
  64.     if ([note object] != window)
  65.             return;
  66.         
  67.     [window setDelegate:nil];
  68.         // Our window is closing. Time for us to go, too.
  69. //    [self autorelease];
  70. }
  71.  
  72.  
  73. @end
  74.