//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#ifndef RTSOBJECTIVEDIALOG_H
#define RTSOBJECTIVEDIALOG_H
#ifdef _WIN32
#pragma once
#endif

#include <vgui_controls/Frame.h>
#include <game/client/iviewport.h>
#include <igameevents.h>

namespace vgui
{
	class TextEntry;
}

//-----------------------------------------------------------------------------
// Purpose: Game ScoreBoard
//-----------------------------------------------------------------------------
class CRTSObjectiveDialog : public vgui::Frame, public IViewPortPanel, public IGameEventListener2
{
private:
	DECLARE_CLASS_SIMPLE( CRTSObjectiveDialog, vgui::Frame );

protected:

public:
	CRTSObjectiveDialog( );
	virtual ~CRTSObjectiveDialog();

	virtual const char *GetName( void ) { return "objectives"; }
	virtual void SetData(KeyValues *data) {};
	virtual void Reset();
	virtual void Update();
	virtual bool NeedsUpdate( void );
	virtual bool HasInputElements( void ) { return true; }
	virtual void ShowPanel( bool bShow );

	// vgui overrides for rounded corner background
	virtual void PaintBackground();
	virtual void PaintBorder();
	virtual void Paint();

	// both vgui::Frame and IViewPortPanel define these, so explicitly define them here as passthroughs to vgui
	vgui::VPANEL GetVPanel( void ) { return BaseClass::GetVPanel(); }
  	virtual bool IsVisible() { return BaseClass::IsVisible(); }
  	virtual void SetParent( vgui::VPANEL parent ) { BaseClass::SetParent( parent ); }
 	
	// IGameEventListener interface:
	virtual void FireGameEvent( IGameEvent *event);
	void LoadObjectiveData( const char * levelname );
	void ClearObjectives( void );
	void AddObjectives( void );

	virtual void ApplySchemeSettings(vgui::IScheme *pScheme);

	void RebuildObjectiveBoard( void );


private:
	int			m_iDesiredHeight;
	//IViewPort	*m_pViewPort;
	float		m_fNextUpdateTime;

	// rounded corners
	Color					 m_bgColor;
	Color					 m_borderColor;

	// keyvalues objectives
	KeyValues * m_ObjectivesKeyValues; // keyvalues describing overview parameters
	int m_iNumObjectives;  // the number of objectives we got
	
	typedef struct objective_data_t 
	{
		bool m_bObjVisible;
		vgui::Label *m_pStatus;
		vgui::TextEntry *m_pText;

	};

	CUtlMap < int, objective_data_t > m_utlObjectiveData;
	vgui::Label *m_pObjectiveHeader;
};


#endif // RTSOBJECTIVEDIALOG_H
