#ifndef __THEME_H
#define __THEME_H

#ifdef __cplusplus
extern "C" {
#endif

#define MAX_ELEMENT_LENGTH 127

#include <unistd.h>
#include <stdint.h>

typedef struct
{
	int x;
	int y;
	int width;
	int height;
} Rect;

class Theme
{
	public:
		Theme();
		~Theme();
		
		int loadTheme(const char *url);
		
		int getLong(const char *element, int *value);
		int getLong(const char *element, int *value, int defaultValue);
		int getLongHex(const char *element, uint32_t *value);
		int getLongHex(const char *element, uint32_t *value, uint32_t defaultValue);
		int getString(const char *element, char *output);
		int getString(const char *element, char *output, const char *defaultValue);
		int getRect(const char *element, Rect *rect);
		int getRect(const char *element, Rect *rect, Rect defaultValue);
		
		void getThemePath(char *url);
		void getThemeAttributes(char *name, char *designer, char *description, char *homepage, char *email);
	protected:
		int whichVars;
		
		static char skinPath[2][MAXPATHLEN];
		static void *_document[2];
		static int _instance[2];
	private:
		int getStringInternal(const char *rootElement, const char *element, char *output);
};

#ifdef __cplusplus
}
#endif

#endif


