package client.gui.element;

import client.renderer.Drawing;
import common.util.Util;

public class SelectableButton extends ActButton {
	private boolean selected;
	
	public SelectableButton(int x, int y, int w, int h, ButtonCallback callback, String text, boolean selected) {
		super(x, y, w, h, callback, text);
		this.selected = selected;
	}
	
	protected void drawBackground() {
		if(this.selected) {
			if(this.enabled)
				Drawing.drawGradientBorder(this.pos_x, this.pos_y, this.size_x, this.size_y, this.gm.style.fill_btm, this.gm.style.fill_top, 0xff000000, this.gm.style.brdr_top, this.gm.style.brdr_btm);
			else
				Drawing.drawGradientBorder(this.pos_x, this.pos_y, this.size_x, this.size_y, Util.mulColor(this.gm.style.fill_btm, 0.5f), Util.mulColor(this.gm.style.fill_top, 0.5f), 0xff000000, Util.mulColor(this.gm.style.brdr_top, 0.5f), Util.mulColor(this.gm.style.brdr_btm, 0.5f));
		}
		else
			super.drawBackground();
	}
	
	public void setSelected(boolean selected) {
		this.selected = selected;
	}
}
