import constants;
import java.lang.*;
import java.awt.*;

public class box extends constants{
	int xoffset = 2;
	int yoffset = 2;
	
	int xpos;
	int ypos;
	int scale;

	boolean solid;
	boolean emboss;

	Color hilight;
	Color normal;
	Color shadow;

	int boxcolor;

	box(int x, int y, int xoffset, int yoffset, int s){
		scale = s;

		xpos = (x - 1) * scale + xoffset; //-1 cause of slick bounding boxes!
		ypos = y * scale + yoffset;

		solid = false;
		boxcolor = EMPTY;
		
	}

	void setBox(int setting){

		boxcolor = setting;

		switch (boxcolor){

		case EMPTY:
			solid = false;
			normal = NULL_COLOR;
			hilight = NULL_HILIGHT;
			shadow = NULL_SHADOW;
			break;
		case BLUE:
			hilight = BLUE_HILIGHT;
			normal = BLUE_NORMAL;
			shadow = BLUE_SHADOW;
			break;
		case RED:
			hilight = RED_HILIGHT;
			normal = RED_NORMAL;
			shadow = RED_SHADOW;
			break;
		case GREEN:
			hilight = GREEN_HILIGHT;
			normal = GREEN_NORMAL;
			shadow = GREEN_SHADOW;
			break;
		case YELLOW:
			hilight = YELLOW_HILIGHT;
			normal = YELLOW_NORMAL;
			shadow = YELLOW_SHADOW;
			break;
		case ORANGE:
			hilight = ORANGE_HILIGHT;
			normal = ORANGE_NORMAL;
			shadow = ORANGE_SHADOW;
			break;
		case LTBLUE:
			hilight = LTBLUE_HILIGHT;
			normal = LTBLUE_NORMAL;
			shadow = LTBLUE_SHADOW;
			break;
		case PURPLE:
			hilight = PURPLE_HILIGHT;
			normal = PURPLE_NORMAL;
			shadow = PURPLE_SHADOW;
			break;
		}

	}

	public void paintBox(boolean emboss, boolean drawgrid, Graphics g){
		int x = xpos;
		int y = ypos;

		if (!drawgrid && boxcolor == EMPTY)
		{
			g.setColor(normal);
			g.fillRect(x, y, scale, scale);
		}

		else if (!emboss){
			g.setColor(normal);
			if (boxcolor == EMPTY){
				g.fillRect(x, y, scale, scale);
			}
			else {
				g.fillRect(x + 1, y + 1, scale - 2, scale - 2);
			}
		}

		else{
			g.setColor(hilight);
			g.drawLine(x ,y ,x , y + scale - 1);
			g.drawLine(x + 1, y, x + 1, y + scale - 2);
			g.drawLine(x , y, x + scale - 1, y);
			g.drawLine(x , y + 1, x + scale - 2, y + 1);
			g.setColor(normal);
			g.fillRect(x + 2, y + 2, scale - 4, scale - 4);
			g.setColor(shadow);
			g.drawLine(x + scale - 1, y + 1, x + scale - 1, y + scale - 1);
			g.drawLine(x + scale - 2, y + 2, x + scale - 2, y + scale - 1);
			g.drawLine(x + 2, y + scale - 2, x + scale - 3, y + scale - 2);
			g.drawLine(x + 1, y + scale - 1, x + scale - 3, y + scale - 1);

		}
	}	

	public boolean isSolid(){
		return solid;
	}

	public int getColor(){
		return boxcolor;
	}
}




