//
//  MPT_StatusView.m
//  MPT_Rubios
//
//  Created by Andrew Salamon on 2/22/08.
//  Copyright 2008 Machine Perception Laboratory, University of California San Diego.. All rights reserved.
//

#import "MPT_StatusView.h"


@implementation MPT_StatusView

- (id)initWithFrame:(NSRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code here.
    }
    return self;
}

- (void)awakeFromNib
{
	[statusTextView setFrameOrigin:NSMakePoint(8.0,4.0)];
}

- (void)drawRect:(NSRect)rect
{
	NSSize mySize = [self frame].size;
	float baseline = mySize.height - baselineOffset;
	NSRect aRect = NSMakeRect( 0.0, baseline, mySize.width, 1.0 );
	NSPoint center = NSMakePoint( 4.0, baseline );
	[[NSColor blackColor] setFill];
	NSRectFill( aRect );
	
	[[self AUDisplayString] drawAtPoint:center withAttributes:[self AUDisplayAttributes]];
	
	NSFrameRect( NSMakeRect( 0.0, 0.0, mySize.width, mySize.height ) );
}

- (void)setStatus:(NSString *)status
{
	//[statusTextView setStringValue:status];
	NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:status attributes:[self AUDisplayAttributes]];
	[attrStr setAlignment:NSCenterTextAlignment range:NSMakeRange(0,[attrStr length])];
	[statusTextView setAttributedStringValue:attrStr];
	[attrStr release];
}

@end
