AppGroupTab.prototype = Object.create(BasicTab.prototype);
AppGroupTab.constructor = AppGroupTab;

function AppGroupTab(clickEvent) {
	BasicTab.call(this);

	this.reservedClickEvent = clickEvent;

	this.tabLayout = null;
	this.reservedMainText = "";
	this.reservedSubText = "";
	this.reservedIconName = "";
}

AppGroupTab.prototype.setTabLayout = function(tabLayout) {
	this.tabLayout = tabLayout;
}

AppGroupTab.prototype.reserveMainText = function(text) {
	this.reservedMainText = text;
}

AppGroupTab.prototype.reserveIcon = function(iconName) {
	this.reservedIconName = iconName;
}

AppGroupTab.prototype.reserveSubText = function(text) {
	this.reservedSubText = text;
}

AppGroupTab.prototype.createTab = function(index) {
	var width = this.tabLayout.getTabWidth();
	var height = this.tabLayout.getTabHeight();
	var x = this.tabLayout.getX() + width / 2 + width * index;
	var y = this.tabLayout.getY() + height / 2;

	var setting = new TabSetting(x, y, width, height);
	// setting.setFont("Nanum Pen Script");
	setting.setFont("Nanum Gothic");
	setting.setMainFontSize(16);
	setting.setSubFontSize(16);
	setting.setButtonColor(
		AppGroupTab.BUTTON_COLOR_OUT_HEX,
		AppGroupTab.BUTTON_COLOR_OVER_HEX,
		AppGroupTab.BUTTON_COLOR_DOWN_HEX,
		AppGroupTab.BUTTON_COLOR_DISABLED_HEX
	);
	setting.setActiveLineColor(
		AppGroupTab.ACTIVE_LINE_COLOR_OUT_HEX,
		AppGroupTab.ACTIVE_LINE_COLOR_OVER_HEX,
		AppGroupTab.ACTIVE_LINE_COLOR_DOWN_HEX,
		AppGroupTab.ACTIVE_LINE_COLOR_DISABLED_HEX
	);
	setting.setIconColor(
		AppGroupTab.ICON_COLOR_OUT_HEX,
		AppGroupTab.ICON_COLOR_OVER_HEX,
		AppGroupTab.ICON_COLOR_DOWN_HEX,
		AppGroupTab.ICON_COLOR_DISABLED_HEX
	);
	setting.setTextColor(
		AppGroupTab.TEXT_COLOR_OUT_STRING,
		AppGroupTab.TEXT_COLOR_OVER_STRING,
		AppGroupTab.TEXT_COLOR_DOWN_STRING,
		AppGroupTab.TEXT_COLOR_DISABLED_STRING
	);


	this.createButton(
		setting,
		(function() {
			this.tabLayout.selectedTab(this);
			this.reservedClickEvent();
		}).bind(this)
	);

	if(this.reservedMainText.length > 0)
		this.setMainText(this.reservedMainText);

	if(this.reservedIconName.length > 0)
		this.addIcon(this.reservedIconName);

	if(this.reservedSubText.length > 0)
		this.setSubText(this.reservedSubText);
}

AppGroupTab.loadResources = function() {
	game.load.image('keyboard',	'../../../resources/image/icon/keyboard.png');
	game.load.image('mouse',	'../../../resources/image/icon/mouse.png');
}


AppGroupTab.BUTTON_COLOR_OUT_HEX			= MainColor.CHOCO_HEX;
AppGroupTab.BUTTON_COLOR_OVER_HEX			= MainColor.DARK_CHOCO_HEX;
AppGroupTab.BUTTON_COLOR_DOWN_HEX			= MainColor.LIGHTER_CHOCO_HEX;
AppGroupTab.BUTTON_COLOR_DISABLED_HEX		= MainColor.CHOCO_HEX;

AppGroupTab.ACTIVE_LINE_COLOR_OUT_HEX		= MainColor.DARKER_CHOCO_HEX;
AppGroupTab.ACTIVE_LINE_COLOR_OVER_HEX		= MainColor.CHOCO_HEX;
AppGroupTab.ACTIVE_LINE_COLOR_DOWN_HEX		= MainColor.LIGHTER_CHOCO_HEX;
AppGroupTab.ACTIVE_LINE_COLOR_DISABLED_HEX	= MainColor.BLACK_HEX;

AppGroupTab.ICON_COLOR_OUT_HEX				= MainColor.PAPAYA_WHIP_HEX;	// MainColor.LIGHT_CHOCO_HEX;
AppGroupTab.ICON_COLOR_OVER_HEX				= MainColor.CHOCO_HEX;
AppGroupTab.ICON_COLOR_DOWN_HEX				= MainColor.LIGHT_CHOCO_HEX;
AppGroupTab.ICON_COLOR_DISABLED_HEX			= MainColor.LIGHT_CHOCO_HEX;

AppGroupTab.TEXT_COLOR_OUT_STRING			= MainColor.BLACK_STRING;
AppGroupTab.TEXT_COLOR_OVER_STRING			= MainColor.DARKER_CHOCO_STRING;
AppGroupTab.TEXT_COLOR_DOWN_STRING			= MainColor.CHOCO_STRING;
AppGroupTab.TEXT_COLOR_DISABLED_STRING		= MainColor.DARK_CHOCO_STRING;