package client.gui.element;

import client.Client;
import client.gui.Gui;
import client.renderer.Drawing;
import common.util.Util;

public class NavButton extends ActButton {
	private final Gui navGui;
	
	public NavButton(int x, int y, int w, int h, Gui gui, String text) {
		super(x, y, w, h, new ButtonCallback() {
			public void use(ActButton elem, PressType action) {
				Client.CLIENT.show(gui);
			}
		}, text);
		this.navGui = gui;
	}
	
	protected void drawBackground() {
		if(this.gm.open == this.navGui) {
			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();
	}
}
