1 #import <AppKit/NSViewController.h>
2 #import <AppKit/NSNibLoading.h>
3 #import <AppKit/NSNib.h>
4 #import <AppKit/NSRaise.h>
6 @implementation NSViewController
8 -initWithNibName:(NSString *)name bundle:(NSBundle *)bundle {
10 _nibBundle=[bundle retain];
14 -initWithCoder:(NSCoder *)coder {
15 if([coder allowsKeyedCoding]){
16 _nibName=[[coder decodeObjectForKey:@"NSNibName"] copy];
17 _title=[[coder decodeObjectForKey:@"NSTitle"] copy];
18 NSString *bundleIdentifier=[coder decodeObjectForKey:@"NSNibBundleIdentifier"];
19 if(bundleIdentifier!=nil)
20 _nibBundle=[NSBundle bundleWithIdentifier:bundleIdentifier];
26 -(NSString *)nibName {
30 -(NSBundle *)nibBundle {
46 return _representedObject;
49 -(void)setRepresentedObject:object {
50 object=[object retain];
51 [_representedObject release];
52 _representedObject=object;
55 -(void)setTitle:(NSString *)value {
61 -(void)setView:(NSView *)value {
68 NSString *name=[self nibName];
69 NSBundle *bundle=[self nibBundle];
72 // should pathForResource assert name for non-nil?
73 [NSException raise:NSInvalidArgumentException format:@"-[%@ %s] nibName is nil",isa,_cmd];
78 bundle=[NSBundle mainBundle];
80 NSString *path=[bundle pathForResource:name ofType:@"nib"];
81 NSDictionary *nameTable=[NSDictionary dictionaryWithObject:self forKey:NSNibOwner];
84 NSLog(@"NSViewController unable to find nib named %@, bundle=%@",name,bundle);
86 [bundle loadNibFile:path externalNameTable:nameTable withZone:NULL];
89 -(void)discardEditing {
90 NSUnimplementedMethod();
93 -(BOOL)commitEditing {
94 NSUnimplementedMethod();
98 -(void)commitEditingWithDelegate:delegate didCommitSelector:(SEL)didCommitSelector contextInfo:(void *)contextInfo {
99 NSUnimplementedMethod();