summaryrefslogtreecommitdiff
path: root/game/client/cstrike/VGUI/base_stats_page.h
blob: e22ec3230b1a7178c2892da6d872e7cba840f2fd (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

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

#include "vgui_controls/PanelListPanel.h"
#include "vgui_controls/Label.h"
#include "tier1/KeyValues.h"
#include "vgui_controls/PropertyPage.h"
#include "vgui_controls/Button.h"
#include "vgui_controls/ImagePanel.h"
#include "GameEventListener.h"

struct PlayerStatData_t;
class IScheme;
class CBaseStatGroupPanel;
class StatCard;
struct StatsCollection_t;
struct RoundStatsDirectAverage_t;

class CBaseStatsPage : public vgui::PropertyPage, public CGameEventListener
{
    DECLARE_CLASS_SIMPLE ( CBaseStatsPage, vgui::PropertyPage );

public:
    CBaseStatsPage( vgui::Panel *parent, const char *name );
	
	~CBaseStatsPage();
	
    virtual void ApplySchemeSettings( vgui::IScheme *pScheme );    
    virtual void MoveToFront();
	virtual void OnSizeChanged(int wide, int tall);
	virtual void OnThink();

	void UpdateStatsData();
	void SetActiveStatGroup (CBaseStatGroupPanel* groupPanel);

	virtual void FireGameEvent( IGameEvent * event );

protected:

	void UpdateGroupPanels();
	CBaseStatGroupPanel* AddGroup( const wchar_t* name, const char* title_tag, const wchar_t* def = NULL );
	const wchar_t* TranslateWeaponKillIDToAlias( int statKillID );
	const wchar_t* LocalizeTagOrUseDefault( const char* tag, const wchar_t* def = NULL );
	
	virtual void RepopulateStats() = 0;	

	vgui::SectionedListPanel	*m_statsList;
	vgui::HFont					m_listItemFont;

private:

	vgui::PanelListPanel		*m_pGroupsList;
	vgui::ImagePanel* m_bottomBar;
	StatCard*	m_pStatCard;
	bool		m_bStatsDirty;
};




class CBaseStatGroupButton : public vgui::Button
{
	DECLARE_CLASS_SIMPLE( CBaseStatGroupButton, vgui::Button );

public:

	CBaseStatGroupButton(  vgui::Panel *pParent, const char *pName, const char *pText );

	virtual void DoClick( void );
};





class CBaseStatGroupPanel : public vgui::EditablePanel
{
	DECLARE_CLASS_SIMPLE( CBaseStatGroupPanel, vgui::EditablePanel );

public:
	CBaseStatGroupPanel( vgui::PanelListPanel *parent, CBaseStatsPage *owner, const char* name, int iListItemID );
	~CBaseStatGroupPanel();

	void SetGroupInfo ( const wchar_t* name, const wchar_t* title);
	
	virtual void ApplySchemeSettings( vgui::IScheme *pScheme );

	void Update( vgui::IScheme* pScheme );

	vgui::PanelListPanel* GetParent() { return m_pParent; }
	CBaseStatsPage* GetOwner() { return m_pOwner; }

	void SetGroupActive(bool active) { m_bActiveButton = active; }
	bool IsGroupActive() { return m_bActiveButton; }

protected:

	// Loads an icon into a specified image panel, or turns the panel off if no icon was found.
	bool LoadIcon( const char* pFilename);

private:
	void PreloadResourceFile( void );

	vgui::PanelListPanel    *m_pParent;
	CBaseStatsPage       *m_pOwner;

	vgui::Label             *m_pBaseStatGroupLabel;	

	CBaseStatGroupButton            *m_pGroupButton;

	vgui::ImagePanel        *m_pGroupIcon;

	vgui::IScheme           *m_pSchemeSettings;

	bool                    m_bActiveButton;

	wchar_t                 *m_pGroupName;
	wchar_t                 *m_pGroupTitle;
};





#endif // CSBASESTATSPAGE_H