#ifndef HUD_RTS_ABILITYPANEL_H
#define HUD_RTS_ABILITYPANEL_H

#include <vgui_controls/Panel.h>
// for buttons
#include "hl2wars/vgui_bitmapbuttonrts.h"
#include "VGui_BitmapImage.h"
#include "hl2wars/hud_rts_unitpanel.h"
#include "hl2wars/hud_rts_infopanel.h"
#include "hl2wars/rts_shareddefs.h"
#include "vgui/mousecode.h"
#include "hl2wars/rts_parsedata.h"

class C_BuildingBrush;

class CHudRTSAbilityPanel : public vgui::Panel
{
	DECLARE_CLASS_SIMPLE( CHudRTSAbilityPanel, vgui::Panel);

public:
	CHudRTSAbilityPanel( );
	~CHudRTSAbilityPanel();
	virtual void Init( void );
	//virtual void LevelShutdown( void );
	virtual void OnThink();
	virtual void Update();
	virtual bool NeedsUpdate( void );
	bool CheckArmedButtons( void );
	void DrawAbilityImage( BitmapImage *image, int slot, int type, int infotype, color32 color );
	void DrawAbilityUnits( C_BasePlayer* pPlayer );
	void DrawAbilityBuildings( C_BasePlayer* pPlayer );
	void CreateButtonAbility( CBitmapButtonRTS *pSlot, const char *command);
	BitmapImage *GetImage( int i, bool enabled );
	bool IsImageLoaded( int i ) { return m_bIsImageLoaded[i];};
	const char *GetUnitType( void ); 
	int GetUnitIndex( void );
	int GetAbilityType( int i );
	int GetAbilityHandle( int i );
	//char *GetUnitType( int i );
	void SetUnitPanel( CHudRTSUnitPanel *pUnitPanel );
	void SetInfoPanel( CHudRTSInfoPanel *pInfoPanel );

	void CalculateSizePos( void );

	float GetRechargeTime( int ability );
	float GetMaxAbilityTime( int ability_button );

	virtual void OnMousePressed( vgui::MouseCode code);
	virtual void OnMouseReleased( vgui::MouseCode code);

	virtual void	AbilityStateUpdate( bf_read &msg );
	bool		IsAbilityAvailable( int teamid, ABILITY_FILE_INFO_HANDLE handle );
protected:
	virtual void OnCommand( const char *command);

private:
	CBitmapButtonRTS *m_pAbility[MAXABILITIESSLOTS];

	//CUtlMap < int, BitmapImage *> m_pImageAbilities;
	//CUtlVector < BitmapImage *> m_pImageAbilities;
	//CUtlVector < const char *> m_pImageAbilitiesTable;
	//BitmapImage *m_pImageAbilities[ABILITY_TYPES_COUNT];
	bool m_bIsImageLoaded[ABILITY_TYPES_COUNT];

	int m_iLastHighLightedUnit;
	int m_iLastHighLightedAbility;

	bool m_bActive;

	CHudRTSUnitPanel *m_pUnitPanel;
	CHudRTSInfoPanel *m_pInfoPanel;

	int m_iLastHighlightedUnit;
	int m_iLastSelectedAbility;
	C_BaseEntity *m_pLastSelectedBuilding;

	// tells if we can use this one
	CUtlMap < unsigned short, ability_state_t > m_AbilityStates[MAX_TEAMS_ID_RTS];
};
#endif  // HUD_RTS_ABILITYPANEL_H