home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / Rhapsody / Graphics / ImageBrowser-1.0 / DASubController.m < prev    next >
Encoding:
Text File  |  1997-12-27  |  1.3 KB  |  68 lines

  1. #import "DASubController.h"
  2.  
  3. @implementation DASubController
  4.  
  5. + (id)shared
  6. {
  7.     NSLog( @"Error: (+ shared) %@ %@\n", @"Subclasses of DASubController must implement their own shared object strategy\nCould not allocate shared instance of class", NSStringFromClass([self class]) );
  8.     return [self new];
  9. }
  10.  
  11. + new
  12. {
  13.     return [[[self allocDocumentZone:NSStringFromClass([self class])] init] autorelease];
  14. }
  15.  
  16. + allocDocumentZone:(NSString *)name
  17. {
  18.     NSZone    *zone = NSCreateZone(vm_page_size, vm_page_size, YES);
  19.     if ( zone && name )
  20.         NSSetZoneName( zone, name);
  21.     return [self allocWithZone:zone];
  22. }
  23.  
  24. - (id)init
  25. {
  26.     if ( [super init] )
  27.     {
  28.         if ( [NSBundle loadNibNamed:NSStringFromClass([self class]) owner:self] == NO )
  29.         {
  30.                 [self autorelease];
  31.                 self = nil;
  32.         }
  33.     }
  34.     return self;
  35. }
  36.  
  37. - (void)awakeFromNib;
  38. {
  39.     [window setDelegate:self];
  40.     [window setFrameAutosaveName:NSStringFromClass([self class])];
  41. }
  42.  
  43. - (void)dealloc
  44. {
  45.     NSLog( @"dealloc subcontroller" );
  46.     [[self window] setDelegate:nil];
  47.     [super dealloc];
  48. }
  49.  
  50. - (void)display
  51. {
  52.     [self display:self];
  53. }
  54.  
  55. - (void)display:sender
  56. {
  57.     [window makeKeyAndOrderFront:sender];
  58. }
  59.  
  60. - window
  61. {
  62.     return window;
  63. }
  64.  
  65. // should cover window delegate methods as an example to subclasses
  66.  
  67. @end
  68.