Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
3.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef CSBASESTATSPAGE_H
  8. #define CSBASESTATSPAGE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "vgui_controls/PanelListPanel.h"
  13. #include "vgui_controls/Label.h"
  14. #include "tier1/KeyValues.h"
  15. #include "vgui_controls/PropertyPage.h"
  16. #include "vgui_controls/Button.h"
  17. #include "vgui_controls/ImagePanel.h"
  18. #include "GameEventListener.h"
  19. struct PlayerStatData_t;
  20. class IScheme;
  21. class CBaseStatGroupPanel;
  22. class StatCard;
  23. struct StatsCollection_t;
  24. struct RoundStatsDirectAverage_t;
  25. class CBaseStatsPage : public vgui::PropertyPage, public CGameEventListener
  26. {
  27. DECLARE_CLASS_SIMPLE ( CBaseStatsPage, vgui::PropertyPage );
  28. public:
  29. CBaseStatsPage( vgui::Panel *parent, const char *name );
  30. ~CBaseStatsPage();
  31. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  32. virtual void MoveToFront();
  33. virtual void OnSizeChanged(int wide, int tall);
  34. virtual void OnThink();
  35. void UpdateStatsData();
  36. void SetActiveStatGroup (CBaseStatGroupPanel* groupPanel);
  37. virtual void FireGameEvent( IGameEvent * event );
  38. protected:
  39. void UpdateGroupPanels();
  40. CBaseStatGroupPanel* AddGroup( const wchar_t* name, const char* title_tag, const wchar_t* def = NULL );
  41. const wchar_t* TranslateWeaponKillIDToAlias( int statKillID );
  42. const wchar_t* LocalizeTagOrUseDefault( const char* tag, const wchar_t* def = NULL );
  43. virtual void RepopulateStats() = 0;
  44. vgui::SectionedListPanel *m_statsList;
  45. vgui::HFont m_listItemFont;
  46. private:
  47. vgui::PanelListPanel *m_pGroupsList;
  48. vgui::ImagePanel* m_bottomBar;
  49. StatCard* m_pStatCard;
  50. bool m_bStatsDirty;
  51. };
  52. class CBaseStatGroupButton : public vgui::Button
  53. {
  54. DECLARE_CLASS_SIMPLE( CBaseStatGroupButton, vgui::Button );
  55. public:
  56. CBaseStatGroupButton( vgui::Panel *pParent, const char *pName, const char *pText );
  57. virtual void DoClick( void );
  58. };
  59. class CBaseStatGroupPanel : public vgui::EditablePanel
  60. {
  61. DECLARE_CLASS_SIMPLE( CBaseStatGroupPanel, vgui::EditablePanel );
  62. public:
  63. CBaseStatGroupPanel( vgui::PanelListPanel *parent, CBaseStatsPage *owner, const char* name, int iListItemID );
  64. ~CBaseStatGroupPanel();
  65. void SetGroupInfo ( const wchar_t* name, const wchar_t* title);
  66. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  67. void Update( vgui::IScheme* pScheme );
  68. vgui::PanelListPanel* GetParent() { return m_pParent; }
  69. CBaseStatsPage* GetOwner() { return m_pOwner; }
  70. void SetGroupActive(bool active) { m_bActiveButton = active; }
  71. bool IsGroupActive() { return m_bActiveButton; }
  72. protected:
  73. // Loads an icon into a specified image panel, or turns the panel off if no icon was found.
  74. bool LoadIcon( const char* pFilename);
  75. private:
  76. void PreloadResourceFile( void );
  77. vgui::PanelListPanel *m_pParent;
  78. CBaseStatsPage *m_pOwner;
  79. vgui::Label *m_pBaseStatGroupLabel;
  80. CBaseStatGroupButton *m_pGroupButton;
  81. vgui::ImagePanel *m_pGroupIcon;
  82. vgui::IScheme *m_pSchemeSettings;
  83. bool m_bActiveButton;
  84. wchar_t *m_pGroupName;
  85. wchar_t *m_pGroupTitle;
  86. };
  87. #endif // CSBASESTATSPAGE_H