summaryrefslogtreecommitdiff
path: root/serverbrowser/QuickListPanel.h
blob: 5672b2bac11946ce9f03753e9c7a4e419bc71bd0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================

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

//-----------------------------------------------------------------------------
// Purpose: Spectator games list
//-----------------------------------------------------------------------------
class CQuickListPanel : public vgui::EditablePanel
{
	DECLARE_CLASS_SIMPLE( CQuickListPanel, vgui::EditablePanel );

public:
	CQuickListPanel( vgui::Panel *parent, const char *panelName );

	virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
	void SetMapName( const char *pMapName );
	void SetImage( const char *pMapName );
	void SetGameType( const char *pGameType );
	const char *GetMapName( void ) { return m_szMapName; }
	void	SetRefreshing( void );

	virtual void OnMousePressed( vgui::MouseCode code );
	virtual void OnMouseDoublePressed( vgui::MouseCode code );
	void	SetServerInfo ( KeyValues *pKV, int iListID, int iTotalServers );
	int		GetListID( void ) { return m_iListID; }


	MESSAGE_FUNC_INT( OnPanelSelected, "PanelSelected", state )
	{
		if ( state )
		{
			vgui::IScheme *pScheme = vgui::scheme()->GetIScheme( GetScheme() );

			if ( pScheme && m_pBGroundPanel )
			{
				m_pBGroundPanel->SetBgColor( pScheme->GetColor("QuickListBGSelected", Color(255, 255, 255, 0 ) ) );
			}
		}
		else
		{
			vgui::IScheme *pScheme = vgui::scheme()->GetIScheme( GetScheme() );

			if ( pScheme && m_pBGroundPanel )
			{
				m_pBGroundPanel->SetBgColor( pScheme->GetColor("QuickListBGDeselected", Color(255, 255, 255, 0 ) ) );
			}
		}

		PostMessage( GetParent()->GetVParent(), new KeyValues("PanelSelected") );
	}

private:

	char m_szMapName[128];

	vgui::ImagePanel *m_pLatencyImage;
	vgui::Label	*m_pLatencyLabel;
	vgui::Label	*m_pPlayerCountLabel;
	vgui::Label	*m_pOtherServersLabel;
	vgui::Label	*m_pServerNameLabel;
	vgui::Panel *m_pBGroundPanel;
	vgui::ImagePanel *m_pMapImage;

	vgui::Panel *m_pListPanelParent;
	vgui::Label *m_pGameTypeLabel;
	vgui::Label *m_pMapNameLabel;

	vgui::ImagePanel *m_pReplayImage;

	int m_iListID;
};


#endif // QUICKLISTPANEL