
#import "ErgoApp.h"
#import <appkit/View.h>
#import <objc/List.h>

@implementation ErgoApp

- highlightedSquare {
    return highlightedSquare;
}

- (BOOL) isSomeoneSelected {
    return isSomeoneSelected;
}

- (BOOL) isWhiteMove {
    return isWhiteMove;
}

- letOtherColorMove {
    [self setIsWhiteMove: ![self isWhiteMove]];
    return [boardWindow display];
}

- makeSquaresPerform: (SEL) aMessage {
    return [[self viewList] makeObjectsPerform: aMessage];
}

- makeSquaresPerform: (SEL) aMessage with: sender {
    return [[self viewList] makeObjectsPerform: aMessage with: sender];
}

- setHighlightedSquare: aSquare {
    highlightedSquare = aSquare;
    return self;
}

- setIsSomeoneSelected: (BOOL) state {
    isSomeoneSelected = state;
    return self;
}

- setIsWhiteMove: (BOOL) state {
    isWhiteMove = state;
    return self;
}

/* Private methods: */

- appDidInit: sender {		/* our return value is ignored, so any is OK */
    isWhiteMove = YES;
    return [self makeSquaresPerform: @selector(appDidInit)];
}

- viewList {
    return [[boardWindow contentView] subviews];
}

@end
