#ifndef HANGAR_SELECTOR_BUTTON_H
#define HANGAR_SELECTOR_BUTTON_H

#include <QtGui>
#include "softProj\commonTypes.h"
#include <cassert>

class HangarSelectorButton : public QPushButton
{
	Q_OBJECT
private:
	QString selectedStyle_;
	QString notSelectedStyle_;
	id_t hangarId_;
signals:
	void clickedSignal(id_t hangarId);
private slots:
	void clickedSlot(bool checked) {
		emit clickedSignal(hangarId_);
	}
public:
	HangarSelectorButton(QWidget * parent) : QPushButton(parent) {
		selectedStyle_ = 
			"QPushButton {"
			"	background-color:rgba(91, 124, 65, 230);"
			"	padding: 5px;"
			"	color: #ffffff;"
			"	font-weight: bold;"
			"	border: none;"
			"	text-align: center;"
			"	}"

			"QPushButton:hover {"
			"	background-color:rgba(91, 124, 65, 255);"
			"	padding: 5px;"
			"	color: #ffffff;"
			"	font-weight: bold;"
			"	border: none;"
			"	text-align: center;"
			"	}";

		notSelectedStyle_ = 
			"QPushButton {"
			"	background-color: rgb(48, 66, 35, 230);"
			"	padding: 5px;"
			"	color: #ffffff;"
			"	font-weight: bold;"
			"	border: none;"
			"	text-align: center;"
			"	}"

			"QPushButton:hover {"
			"	background-color:rgba(91, 124, 65, 255);"
			"	padding: 5px;"
			"	color: #ffffff;"
			"	font-weight: bold;"
			"	border: none;"
			"	text-align: center;"
			"	}";

		setStyleSheet(notSelectedStyle_);

		bool connected = true;
			
		connected = connected && connect(this, SIGNAL(clicked(bool)), this, SLOT(clickedSlot(bool)));

		assert(connected && "Signals not connected");
	}

	void setActive(bool active) {
		if (active) {
			setStyleSheet(selectedStyle_);
		}
		else {
			setStyleSheet(notSelectedStyle_);
		}
	}

	void setShownNumber(int number) {
		this->setText(QString::number(number));
	}

	void setHangarId(id_t hangarId) {
		this->hangarId_ = hangarId;
	}
};

#endif