#ifndef MENU_H
#define MENU_H

#include <string>
#include <vector>
#include "SDL.h"

class Game;
#include "List.h"
class Sprite;

class Menu
{
public:
	Menu();
	Menu(std::string filename);
	Menu(List * MenuInfo);
	void mainLoop();
	
	void drawTitle(int x, int y, bool selected);
	
	virtual void draw();

	virtual bool control(SDL_Event event);
	
	// return true if we're "done" with this menu given the selection made by the user
	virtual bool select();

	~Menu();
protected:
	static int _textHeight;
	static int _leftMargin;
	static int _topMargin;
	Sprite * _background;
	std::string _title;
	std::vector<std::string> _subtitles;
	size_t _selected;
	size_t _selectedMax;
	std::vector<Menu *> _options;

private:
	void load(List * MenuInfo);
	
	
};

class SelectKeyMenu: public Menu
{
public:
	SelectKeyMenu(List * menuInfo);
	void draw();
	bool select();
private:
	std::string _text[9];
	std::string _keys[9];
};

class NewGameMenu: public Menu
{
public:
	NewGameMenu(List * menuInfo);
	void draw();
	bool select();
private:
	Game * _game;
	bool _won;
	std::vector<std::string> _levelFile;
	std::vector<std::string> _levelName;
	std::vector<bool> _levelUnLocked;
	std::vector<bool> _levelInMenu;
	int _totalLevels;
};

class TitleScreenMenu: public Menu
{
public:
	TitleScreenMenu(List * menuInfo);
	bool select();
	void draw();
};

#endif