// Copyright (C) 1995
// Use is governed by the MiscKit license

#import <misckit/MiscSwapViewItem.h>
#import "MiscSVIInspector.h"


@implementation MiscSVIInspector

- init
/*"
    Initializes the object by loading the NIB file to set up all references.
 "*/
{
    self = [super init];
    if( !self ) return nil;

    // <<HACK>> This propably would suit a lot better into the -window method...but since there is no docu
    // it is hard to tell if window will be called  before we get any revert/ok messages.
    // Until we know...we'll just leave it here. Since inspectors are loaded on demand it might not make
    // a big difference anyway.

    [NSBundle loadNibNamed:@"MiscSVIInspector" owner:self];

    return self;
}

- (void)revert:sender
/*"
    Ask our object for its attributes and update the inspector controls accordingly.
"*/
{
    [tagForm setIntValue:[[self object] tag]];
}

- (void)tagChanged:sender
{
    [[self object] setTag:[tagForm intValue]];

    // I don't know what ok does...but its not bad idea to call it since usually that is the place where you
    // registered that some changes have happened.
    
    [self ok:sender];
}

- (BOOL)wantsButtons
{
    return NO;
}

@end


@implementation MiscSwapViewItem (IBInspector)

- (NSString *)inspectorClassName
/*"
    Returns the name of the inspecotr class which is MiscSVIInspector.
"*/
{
    return @"MiscSVIInspector";
}

- (NSImage *)imageForViewer
/*"
    Returns the name of the inspector class which is MiscSVIInspector.
"*/
{
    id	theImage;
    id	bundle;
    id	bundlePath;

    bundle = [NSBundle bundleForClass:[MiscSVIInspector class]];
    bundlePath = [bundle pathForResource:@"MiscSVIIcon" ofType:@"tiff"];
    theImage = [[NSImage alloc] initByReferencingFile:bundlePath];

    return [theImage autorelease];
}

@end
	
	