#include "sigc++/sigc++.h"
#include "ControlSuper.h"
#include "GLRect.h"
#include "OpenGLUtils.h"

#ifndef _Button_H_
#define _Button_H_


namespace touchcontrols
{

class Button : public ControlSuper
{
	bool pressed;

	int id;

	std::string image;

	GLuint glTex;

	GLRect glRect;

	int value;
public:
	sigc::signal<void, int> signal_buttonDown;
	sigc::signal<void, int> signal_buttonUp;
	sigc::signal<void, int, int> signal_button;

	Button(std::string tag,RectF pos,std::string image_filename,int value);

	void setEnabled(bool v);


	bool processPointer(int action, int pid, float x, float y);

	bool drawGL();

	bool initGL();

	void updateSize();

	void saveXML(TiXmlDocument &doc);

	void loadXML(TiXmlDocument &doc);
};

}

#endif
