Counter Strike : Global Offensive Source Code
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.

88 lines
2.6 KiB

  1. //========= Copyright � 1996-2001, Valve LLC, All rights reserved. ============
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #include "pch_serverbrowser.h"
  8. using namespace vgui;
  9. //-----------------------------------------------------------------------------
  10. // Purpose: Constructor
  11. //-----------------------------------------------------------------------------
  12. CFriendsGames::CFriendsGames(vgui::Panel *parent) :
  13. CBaseGamesPage(parent, "FriendsGames", eFriendsServer )
  14. {
  15. m_iServerRefreshCount = 0;
  16. if ( !IsSteamGameServerBrowsingEnabled() )
  17. {
  18. m_pGameList->SetEmptyListText("#ServerBrowser_OfflineMode");
  19. m_pConnect->SetEnabled( false );
  20. m_pRefreshAll->SetEnabled( false );
  21. m_pRefreshQuick->SetEnabled( false );
  22. m_pAddServer->SetEnabled( false );
  23. m_pFilter->SetEnabled( false );
  24. }
  25. }
  26. //-----------------------------------------------------------------------------
  27. // Purpose: Destructor
  28. //-----------------------------------------------------------------------------
  29. CFriendsGames::~CFriendsGames()
  30. {
  31. }
  32. //-----------------------------------------------------------------------------
  33. // Purpose: returns true if the game list supports the specified ui elements
  34. //-----------------------------------------------------------------------------
  35. bool CFriendsGames::SupportsItem(InterfaceItem_e item)
  36. {
  37. switch (item)
  38. {
  39. case FILTERS:
  40. return true;
  41. case GETNEWLIST:
  42. default:
  43. return false;
  44. }
  45. }
  46. //-----------------------------------------------------------------------------
  47. // Purpose: called when the current refresh list is complete
  48. //-----------------------------------------------------------------------------
  49. void CFriendsGames::RefreshComplete( HServerListRequest hReq, EMatchMakingServerResponse response )
  50. {
  51. SetRefreshing(false);
  52. m_pGameList->SortList();
  53. m_iServerRefreshCount = 0;
  54. if ( IsSteamGameServerBrowsingEnabled() )
  55. {
  56. // set empty message
  57. m_pGameList->SetEmptyListText("#ServerBrowser_NoFriendsServers");
  58. }
  59. BaseClass::RefreshComplete( hReq, response );
  60. }
  61. //-----------------------------------------------------------------------------
  62. // Purpose: opens context menu (user right clicked on a server)
  63. //-----------------------------------------------------------------------------
  64. void CFriendsGames::OnOpenContextMenu(int itemID)
  65. {
  66. // get the server
  67. int serverID = GetSelectedServerID();
  68. if ( serverID == -1 )
  69. return;
  70. // Activate context menu
  71. CServerContextMenu *menu = ServerBrowserDialog().GetContextMenu(GetActiveList());
  72. menu->ShowMenu(this, serverID, true, true, true, true);
  73. }