home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.mdf / SourceCode / Inspectors / AIInspector / AIInspector.m < prev    next >
Encoding:
Text File  |  1992-10-11  |  1.3 KB  |  61 lines

  1.  
  2. /*
  3.  * AIInspector.m
  4.  *
  5.  * AIInspector is a subclass of WMInspector responsible for handling
  6.  * the new and revert: messages from the Workspace Manager.
  7.  *
  8.  *
  9.  * You may freely copy, distribute, and reuse the code in this example.
  10.  * Both Terrence Talbot and Digital Tool Works disclaim any warranty
  11.  * of any kind, expressed or implied, as to its fitness for any particular use.
  12.  *
  13.  * Written by:  Terrence Talbot 
  14.  *    Created:  Oct/92
  15.  *
  16.  */
  17.  
  18. #import <appkit/appkit.h>
  19. #import <objc/NXBundle.h>
  20.  
  21. #import "AIInspector.h"
  22. #import "AIView.h"
  23.  
  24. @implementation AIInspector
  25.  
  26. static id aiInspector = nil;
  27.  
  28. + new
  29. {
  30.    if ( aiInspector == nil ) {
  31.       char path[MAXPATHLEN + 1];
  32.       NXBundle *bundle = [NXBundle bundleForClass:self];
  33.       
  34.       self = aiInspector = [super new];
  35.       if ( [bundle getPath:path 
  36.                forResource:"AIInspector"
  37.                     ofType:"nib"] ) {
  38.          [NXApp loadNibFile:path owner:aiInspector];
  39.       }
  40.       else {
  41.          NXLogError("Couldn't load AIInspector.nib.");
  42.          aiInspector = nil;
  43.       }      
  44.    }
  45.    
  46.    return aiInspector;
  47. }
  48.  
  49. - revert:sender
  50. {
  51.    char fullPath[MAXPATHLEN + 1];
  52.    [self selectionPathsInto:fullPath separator:'\0'];
  53.    [myAIView setImageToFilename:fullPath];
  54.    
  55.    [super revert:sender];
  56.    
  57.    return self;
  58. }
  59.  
  60. @end
  61.