#include "hud.h"
#include "cl_util.h"
#include "const.h"
#include "entity_state.h"
#include "cl_entity.h"
#include "vgui_TeamFortressViewport.h"
#include "vgui_wishmenu.h"

#define BUTTONS WISHES+1
#define BUTTON_SPACE 2

char *sWishes[] =
{	"immortality",
	"strength",
	"wishpoint",
};

char *sWishNames[]=
{	"#immortality",
	"#strength",
	"#wishpoint",
};

CWishMenuPanel :: CWishMenuPanel(int iTrans, int iRemoveMe, int x, int y, int wide, int tall) : CMenuPanel(iTrans, iRemoveMe, x,y,wide,tall)
{	int iButtonHeight = (tall - BUTTON_SPACE * (BUTTONS+1))/(BUTTONS+2);
	int iButtonWidth = wide - BUTTON_SPACE * 2 - 2;
	int iButtonx = BUTTON_SPACE;
	
	m_pPanel = new CTransparentPanel( iTrans, 0, 0, wide, tall);
	m_pPanel->setParent( this );
	m_pPanel->setBorder( new LineBorder( Color(255 * 0.7,170 * 0.7,0,0) ) );
	
	m_pTitle = new Label( "", 0, 0, wide-2, iButtonHeight);
	m_pTitle->setParent( m_pPanel );
	m_pTitle->setBgColor( 200, 0, 0, 150 );
	m_pTitle->setFgColor( 200, 200, 200, 150 );
	m_pTitle->setContentAlignment( vgui::Label::a_center );
	m_pTitle->setText( "Make your wish" );

	int iButtony = 0;
	for (int n=0; n<WISHES;n++)
	{	iButtony += iButtonHeight + BUTTON_SPACE;
		m_pWishButton[n] = new CommandButton( gHUD.m_TextMessage.BufferedLocaliseTextString(sWishNames[n]), iButtonx, iButtony, iButtonWidth, iButtonHeight);
		m_pWishButton[n]->setContentAlignment(vgui::Label::a_center);
		m_pWishButton[n]->setParent( m_pPanel );
		m_pWishButton[n]->addActionSignal( new CMenuHandler_StringCommand( sWishes[n], true ));	
	}
	

	iButtony += iButtonHeight * 2 + BUTTON_SPACE;
	m_pCancelButton = new CommandButton( "Cancel", iButtonx, iButtony, iButtonWidth, iButtonHeight);
	m_pCancelButton->setContentAlignment(vgui::Label::a_center);
	m_pCancelButton->setParent( m_pPanel );
	m_pCancelButton->addActionSignal( new CMenuHandler_TextWindow(HIDE_TEXTWINDOW) );	
}