#pragma once

#include "ui.h"

namespace kek {

class UIWindow: public UIElement {

	UIWindow(UIValue x, UIValue y);

	virtual ~UIWindow();

	virtual UIElementType getType();

	virtual void draw(UIPoint screenPos, glm::mat4 projection);

};

enum class TextMode {
	// Draw with y as baseline, disables vertical offset from the origin position specified using setOrigin()
	BASELINE,
	// Draw from the set origin
	ORIGIN
};

enum class TextBounds {
	SMALLEST,
	LINE
};

class TextElement: public UIElement {

protected:
	TextObject *text;

public:
	int sizePixels;
	Color color;
	TextMode textMode;
	TextBounds textBounds;

	TextElement(UIValue x, UIValue y, Font *font);

	TextElement(UIValue x, UIValue y);

	virtual ~TextElement();

	virtual UIElementType getType();

	virtual UIBounds getBounds();

	void setText(std::string text);

	std::string getText();

	virtual void draw(UIPoint screenPos, glm::mat4 projection);

};

class RectangleElement: public UIElement {

protected:
	UIValue w, h;

	unsigned int vao;
	unsigned int vbo;

public:
	Color color;

	RectangleElement(UIValue x, UIValue y, UIValue w, UIValue h);

	virtual ~RectangleElement();

	virtual UIElementType getType();

	virtual UIBounds getBounds();

	virtual void draw(UIPoint screenPos, glm::mat4 projection);

};

class ButtonElement: public RectangleElement {

public:
	TextElement *text;
	Color color;
	Color hoverColor;
	Callable onClick;

	ButtonElement(UIValue x, UIValue y, UIValue w, UIValue h);

	virtual ~ButtonElement();

	virtual UIElementType getType();

	virtual void click(UIPoint pos, UIPoint screenPos, GLFWMouseButton button);

	virtual void draw(UIPoint screenPos, glm::mat4 projection);

};

}
