#import <IconKit/IKShelf.h>
#import <IconKit/IKCell.h>

#import "IKShelfInspector.h"

@implementation IKShelfInspector: IBInspector
{
    id classToHold;
    id dynamic;
}

- init
{
    [super init];
    [NSBundle loadNibNamed:@"IKShelfInspector" owner:self];
    return self;
}

- updateClassToHold: sender
{
    [[self object]  setClassToHold:[classToHold stringValue]];
    [self  ok: sender];

    return self;
}


- updateDynamic: sender
{
        [[self object]  setDynamic: [sender  state]];	
	[self  ok: sender];
	
	return self;
}


- matchCells: sender
{
	int i;
	id  prototype = [[self object]  prototype],
            cellList = [[self object] cells];
	
	i = [cellList  count];
	while (i--) [[cellList objectAtIndex:i]  initFromCopy: prototype];
	[self  ok: sender];
	
	return self;
}



- (void)ok:(id)sender
{
	[self  touch: self];
	[super  ok: sender];
}


- (void)revert:(id)sender
{
	NSString *s = [[self object]  classToHold];
	[classToHold  setStringValue: s ? s : @""];
        [dynamic  setState: [[self object]  isDynamic]];
	[super revert: sender];
}


- (BOOL) wantsButtons
{
    return NO;
}


@end
