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.

121 lines
3.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef FAVORITEGAMES_H
  8. #define FAVORITEGAMES_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "BaseGamesPage.h"
  13. #include "IGameList.h"
  14. #include "IServerRefreshResponse.h"
  15. #include "server.h"
  16. class KeyValues;
  17. namespace vgui
  18. {
  19. class ListPanel;
  20. class MessageBox;
  21. };
  22. class CUtlBuffer;
  23. //-----------------------------------------------------------------------------
  24. // Purpose: Favorite games list
  25. //-----------------------------------------------------------------------------
  26. class CFavoriteGames : public CBaseGamesPage
  27. {
  28. public:
  29. CFavoriteGames(vgui::Panel *parent);
  30. ~CFavoriteGames();
  31. // favorites list, loads/saves into keyvalues
  32. void LoadFavoritesList(vgui::KeyValues *favoritesData,bool loadrcon);
  33. void SaveFavoritesList(vgui::KeyValues *favoritesData,bool savercon);
  34. // property page handlers
  35. // virtual void OnPageShow();
  36. // virtual void OnPageHide();
  37. // IGameList handlers
  38. // returns true if the game list supports the specified ui elements
  39. virtual bool SupportsItem(InterfaceItem_e item);
  40. // starts the servers refreshing
  41. virtual void StartRefresh();
  42. // gets a new server list
  43. virtual void GetNewServerList();
  44. // stops current refresh/GetNewServerList()
  45. virtual void StopRefresh();
  46. // returns true if the list is currently refreshing servers
  47. virtual bool IsRefreshing();
  48. // gets information about specified server
  49. // virtual serveritem_t &GetServer(unsigned int serverID);
  50. // adds a new server to list
  51. virtual void AddNewServer(serveritem_t &server);
  52. // marks that server list has been fully received
  53. virtual void ListReceived(bool moreAvailable, int lastUnique);
  54. // called when Connect button is pressed
  55. virtual void OnBeginConnect();
  56. // called to look at game info
  57. virtual void OnViewGameInfo();
  58. // reapplies filters (does nothing with this)
  59. virtual void ApplyFilters();
  60. // IServerRefreshResponse handlers
  61. // called when the server has successfully responded
  62. virtual void ServerResponded(serveritem_t &server);
  63. // called when a server response has timed out
  64. virtual void ServerFailedToRespond(serveritem_t &server);
  65. // called when the current refresh list is complete
  66. virtual void RefreshComplete();
  67. virtual void ImportFavorites();
  68. virtual void OnImportFavoritesFile();
  69. // updates the rconPassword field for this server
  70. void UpdateServer(serveritem_t &serverIn);
  71. private:
  72. // context menu message handlers
  73. void OnOpenContextMenu(int row);
  74. void OnRefreshServer(int serverID);
  75. void OnRemoveFromFavorites();
  76. void OnAddServerByName();
  77. void OnCommand(const char *command);
  78. bool LoadAFavoriteServer (CUtlBuffer &buf);
  79. bool CheckForCorruption(char *data, const char *checkString);
  80. int m_iServerRefreshCount; // number of servers refreshed
  81. bool m_bSaveRcon;
  82. DECLARE_PANELMAP();
  83. typedef CBaseGamesPage BaseClass;
  84. // message that favorites are being imported
  85. vgui::MessageBox *m_pImportFavoritesdlg;
  86. };
  87. #endif // FAVORITEGAMES_H