summaryrefslogtreecommitdiff
path: root/game/client/tf/vgui/tf_ping_panel.h
blob: e9e6102b536ba395f634acdadd6f30dcb21eb184 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

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

#include <vgui_controls/EditablePanel.h>
#include <../common/GameUI/cvarslider.h>

using namespace vgui;

class CTFPingPanel : public EditablePanel, public CGameEventListener
{
	DECLARE_CLASS_SIMPLE( CTFPingPanel, EditablePanel )
public:
	CTFPingPanel( Panel* pPanel, const char *pszName, EMatchGroup eMatchGroup );
	~CTFPingPanel();

	virtual void ApplySchemeSettings( IScheme *pScheme ) OVERRIDE;
	virtual void PerformLayout() OVERRIDE;
	virtual void OnCommand( const char *command ) OVERRIDE;

	virtual void FireGameEvent( IGameEvent *event ) OVERRIDE;

private:
	void CleanupPingPanels();
	void UpdateCurrentPing();

	MESSAGE_FUNC_PTR( OnCheckButtonChecked, "CheckButtonChecked", panel );
	MESSAGE_FUNC( OnSliderMoved, "SliderMoved" );

	CPanelAnimationVarAliasType( int, m_iDataCenterY, "datacenter_y", "0", "proportional_int" );
	CPanelAnimationVarAliasType( int, m_iDataCenterYSpace, "datacenter_y_space", "0", "proportional_int" );

	EditablePanel *m_pMainContainer;
	CheckButton *m_pCheckButton;
	Label *m_pCurrentPingLabel;
	CCvarSlider *m_pPingSlider;

	struct PingPanelInfo
	{
		EditablePanel *m_pPanel;
		float m_flPopulationRatio;
		int m_nPing;
	};
	CUtlVector< PingPanelInfo > m_vecDataCenterPingPanels;

	EMatchGroup m_eMatchGroup;
};

#endif // TF_PING_PANEL_H