/*************************************************
 * Author: 	Evelyn Lai-Tee Cheok
 *			Department of Electrical Engineering
 *			Center for Telecommunications Research
 *			Schapiro Research Building
 *			Columbia University
 *
 * Email: 	laitee@ctr.columbia.edu
 *
 **************************************************/
import java.lang.*;
import java.awt.*;

public class ColorPanel extends ChoiceBar
{
	int colSelected = 0;
 
    /**
     * Colors that will be displayed
     */
    final static Color[] baseColors =
    {
        Color.black, Color.darkGray, Color.gray, Color.lightGray, Color.white,
        Color.red, Color.magenta, Color.pink,
        Color.yellow, Color.orange,
        Color.blue, Color.cyan,
        Color.green
    };

	public Color[] getBaseColors() {
		return baseColors;
	}

    /**
     * Constructs a DrawContentBar with a WorkPanel
     * @param target : drawing place
     * @param direction : bars direction (VERTICAL, HORIZONTAL)
     * @see Bar
     */
    public ColorPanel(int direction)
    {
        super(baseColors.length, direction);
        //this.target = target;
        setSelectedItem(0);
    }
 
    /**
     * implement's abstract method in Bar
     * @param g : graphics
     * @param i : button index in Bar
     * @param rc : drawing area
     * @see Bar
     */
    void drawCell(Graphics g, int i, Rectangle rc)
    {
        g.setColor(baseColors[i]);
        g.fillRect(rc.x, rc.y, rc.width, rc.height);
    }
 
    /**
     * implement's abstract method in Bar
     * set target's color variable
     * @param i : pressed button index in Bar
     * @see Bar
     */
    void setSelectedItem(int i)
    {
		colSelected = i;
    }

	int getSelectedCol() {
		return colSelected;
	}

	public Dimension getColorPanelDim() {
		return getDimension();
	}

    /** Provides offset of the user panel from the boundary **/
    public Insets insets() {
        return (new Insets(0, 20, 0, 0));
    }

}

