package speiger.src.coreengine.rendering.guiOld.components;

import speiger.src.coreengine.rendering.guiOld.GuiComponent;

public class PanelComponent extends GuiComponent
{	
	public static final int FLAG_ENABLE_SCISSORS = 1 << 20;

	public PanelComponent()
	{
		super(0F, 0F, 0F, 0F);
	}
	
	public PanelComponent(float x, float y, float width, float height)
	{
		super(x, y, width, height);
	}
	
	@Override
	public void init()
	{	
	}
	
	public PanelComponent setScissors(boolean value)
	{
		setFlag(FLAG_ENABLE_SCISSORS, value);
		return this;
	}
	
	public boolean isScissoring()
	{
		return isFlagSet(FLAG_ENABLE_SCISSORS);
	}
	
	@Override
	public void renderChildren(int mouseX, int mouseY, float particalTicks)
	{
		if(isFlagSet(FLAG_ENABLE_SCISSORS))
		{
			enableScissors(getBox());
			super.renderChildren(mouseX, mouseY, particalTicks);
			disableScissors();
			return;
		}
		super.renderChildren(mouseX, mouseY, particalTicks);
	}
}
