home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Misc / RZToDoList / Source / objectLoadNib.m < prev    next >
Encoding:
Text File  |  1995-06-12  |  821 b   |  35 lines

  1. /* 
  2.  * objectLoadNib - category on Object for NIB loading
  3.  *
  4.  * You may freely copy, distribute and reuse the code in this example.
  5.  * This code is provided AS IS without warranty of any kind, expressed 
  6.  * or implied, as to its fitness for any particular use.
  7.  *
  8.  * Copyright 1995 Ralph Zazula (zazula@next.com).  All Rights Reserved.
  9.  *
  10.  */
  11.  
  12. #import "objectLoadNib.h"
  13. #import <appkit/appkit.h>
  14.  
  15. @implementation Object(LoadNib)
  16.  
  17. - loadNib:(const char *)name
  18. /*
  19.  * Loads the file 'name'.nib from the bundle for the current class.
  20.  */
  21. {
  22.     NXBundle *bundle;
  23.     char path[MAXPATHLEN+1];
  24.         
  25.     bundle = [NXBundle bundleForClass:[self class]];
  26.     if([bundle getPath:path forResource:name ofType:"nib"]) {
  27.         [NXApp loadNibFile:path owner:self];
  28.         return self;
  29.     }
  30.     fprintf(stderr, "couldn't load nib %s.\n",name);
  31.     return nil;
  32. }
  33.  
  34. @end
  35.