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

import java.util.Map;
import java.util.UUID;

import speiger.src.coreengine.rendering.guiOld.GuiBase;
import speiger.src.coreengine.rendering.guiOld.GuiComponent;
import speiger.src.coreengine.rendering.guiOld.components.TextComponent;
import speiger.src.coreengine.rendering.guiOld.helper.Align;

public class SelectionEntry implements IListEntry
{
	TextComponent text = new TextComponent().limit(false).align(Align.LEFT_TOP, Align.LEFT_TOP);
	
	public SelectionEntry(){}
	
	public SelectionEntry(String s)
	{
		setText(s);
	}
	
	public SelectionEntry setText(String s)
	{
		text.setText(s);
		return this;
	}
	
	public SelectionEntry setTextScale(float scale)
	{
		text.setTextScale(scale);
		return this;
	}
	
	@Override
	public float getWidth()
	{
		return text.getMetadata().getMaxWidth();
	}

	@Override
	public void init(GuiComponent comp, GuiBase owner)
	{
		text.setOwner(owner);
		text.setScale(comp.getBox().getScale());
	}

	@Override
	public void updateState(GuiComponent comp, float scale)
	{
		text.setScale(scale);
	}

	@Override
	public void onClosed()
	{
		text.onClosed();
	}
	
	@Override
	public void onFixedUpdate()
	{
		
	}

	@Override
	public void onRender(GuiComponent comp, boolean enabled, int mouseX, int mouseY, float particalTicks)
	{
		text.render(mouseX, mouseY, particalTicks);
	}
	
	@Override
	public void collectTooltips(GuiComponent comp, int mouseX, int mouseY, float particalTicks, Map<UUID, GuiComponent> collector)
	{
		text.collectTooltips(mouseX, mouseY, particalTicks, collector);
	}
	
	public String getText()
	{
		return text.getText();
	}
}