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.

83 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef QUICKLISTPANEL
  8. #define QUICKLISTPANEL
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. //-----------------------------------------------------------------------------
  13. // Purpose: Spectator games list
  14. //-----------------------------------------------------------------------------
  15. class CQuickListPanel : public vgui::EditablePanel
  16. {
  17. DECLARE_CLASS_SIMPLE( CQuickListPanel, vgui::EditablePanel );
  18. public:
  19. CQuickListPanel( vgui::Panel *parent, const char *panelName );
  20. virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
  21. void SetMapName( const char *pMapName );
  22. void SetImage( const char *pMapName );
  23. void SetGameType( const char *pGameType );
  24. const char *GetMapName( void ) { return m_szMapName; }
  25. void SetRefreshing( void );
  26. virtual void OnMousePressed( vgui::MouseCode code );
  27. virtual void OnMouseDoublePressed( vgui::MouseCode code );
  28. void SetServerInfo ( KeyValues *pKV, int iListID, int iTotalServers );
  29. int GetListID( void ) { return m_iListID; }
  30. MESSAGE_FUNC_INT( OnPanelSelected, "PanelSelected", state )
  31. {
  32. if ( state )
  33. {
  34. vgui::IScheme *pScheme = vgui::scheme()->GetIScheme( GetScheme() );
  35. if ( pScheme && m_pBGroundPanel )
  36. {
  37. m_pBGroundPanel->SetBgColor( pScheme->GetColor("QuickListBGSelected", Color(255, 255, 255, 0 ) ) );
  38. }
  39. }
  40. else
  41. {
  42. vgui::IScheme *pScheme = vgui::scheme()->GetIScheme( GetScheme() );
  43. if ( pScheme && m_pBGroundPanel )
  44. {
  45. m_pBGroundPanel->SetBgColor( pScheme->GetColor("QuickListBGDeselected", Color(255, 255, 255, 0 ) ) );
  46. }
  47. }
  48. PostMessage( GetParent()->GetVParent(), new KeyValues("PanelSelected") );
  49. }
  50. private:
  51. char m_szMapName[128];
  52. vgui::ImagePanel *m_pLatencyImage;
  53. vgui::Label *m_pLatencyLabel;
  54. vgui::Label *m_pPlayerCountLabel;
  55. vgui::Label *m_pOtherServersLabel;
  56. vgui::Label *m_pServerNameLabel;
  57. vgui::Panel *m_pBGroundPanel;
  58. vgui::ImagePanel *m_pMapImage;
  59. vgui::Panel *m_pListPanelParent;
  60. vgui::Label *m_pGameTypeLabel;
  61. vgui::Label *m_pMapNameLabel;
  62. vgui::ImagePanel *m_pReplayImage;
  63. int m_iListID;
  64. };
  65. #endif // QUICKLISTPANEL