#pragma once

#include <Widgets/Panel.h>
#include <Widgets/Label.h>
#include "../Mechanics/PlayerGame.h"
#include <sstream>
#include <Widgets/Organizers/LinearOrganizer.h>
#include "../Mechanics/Townsfolk.h"
#include "../Mechanics/Soldier.h"
#include <Widgets/Window.h>
#include <Widgets/DialogWindow.h>
#include <Widgets/Listbox.h>
#include "../Assets/Buildings.h"
#include "../Mechanics/Artisan.h"
#include "Actions.h"
#include "Credits.h"

//for vs
#undef interface

namespace interface {

	class IngameMenu : public gge::widgets::Window {
	public:
		IngameMenu() {
			SetOrganizer(organizer);
			organizer.SetDistance(5);

			SetWidth(160);

			Title="Game menu";

			newgame.Text="New game";
			newgame.SetContainer(this);
			newgame.ClickEvent.RegisterLambda(showIngameMapSelection);

			options.Text="Options";
			options.SetContainer(this);
			options.Disable();

			credits.Text="Credits";
			credits.SetContainer(this);
			credits.ClickEvent.RegisterLambda(showIngameCredits);

			quit.Text="Quit";
			quit.SetContainer(this);
			quit.ClickEvent.Register(&askQuit);

			resume.Text="Resume";
			resume.SetContainer(this);
			resume.ClickEvent.Register(this, &IngameMenu::Close);

			SetHeight(resume.GetBounds().Bottom+40);

			Hide();

			ClosingEvent.RegisterLambda([&] {
				closeCredits();
				closeMapSelection();
				
				mechanics::PlayerGame::current().resume();
			});
		}

		virtual void Show() {
			gge::widgets::Window::Show(true);
			MoveToCenter();

			mechanics::PlayerGame::current().pause();
		}

	protected:
		gge::widgets::ListOrganizer organizer;

		gge::widgets::Button
			newgame,
			options,
			credits,
			quit,
			resume
		;

	};

}
