#ifndef __WIDGET_H
#define __WIDGET_H

#ifdef __cplusplus
extern "C" {
#endif

#include "theme.h"
#include "settings.h"
#include "drawable.h"

typedef enum
{
	BUTTON_NONE = 0,
	BUTTON_PRIMARY,
	BUTTON_SECONDARY,
	BUTTON_PLUS,
	BUTTON_MINUS
} Action;

class Widget;

class Widget
{
	public:
		Widget();
		virtual ~Widget();
		
		void setVisible(bool visible);
		bool getVisible();
		
		void setTouchable(bool touchable);
		bool getTouchable();
		
		void setEnabled(bool enabled);
		bool getEnabled();
		
		void setDimensions(Rect r);		
		Rect getDimensions();
		Rect getAbsoluteDimensions();
		void move(int x, int y);		
		virtual void resize(int width, int height);
		
		virtual void draw();
		
		virtual void cursorDown(int x, int y, Action a);
		virtual void cursorMove(int x, int y);
		virtual void cursorUp(int x, int y, Action a);
		virtual void cursorOut();
		
		bool isDragging();
		void setParent(Widget *parent);
	protected:
		Rect _rect;
		bool _visible;
		bool _enabled;
		bool _touchable;
		bool _dragging;
		
		Widget *_parent;
};

#ifdef __cplusplus
}
#endif

#endif


