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.

196 lines
5.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // The copyright to the contents herein is the property of Valve, L.L.C.
  4. // The contents may be used and/or copied only with the written permission of
  5. // Valve, L.L.C., or in accordance with the terms and conditions stipulated in
  6. // the agreement/contract under which the contents have been supplied.
  7. //
  8. // Purpose:
  9. //
  10. // $Workfile: $
  11. // $Date: $
  12. //
  13. //-----------------------------------------------------------------------------
  14. // $Log: $
  15. //
  16. // $NoKeywords: $
  17. //=============================================================================
  18. #if !defined( VINTERNETDLG_H )
  19. #define VINTERNETDLG_H
  20. #ifdef _WIN32
  21. #pragma once
  22. #endif
  23. #include <VGUI_Frame.h>
  24. #include <VGUI_ListPanel.h>
  25. #include <VGUI_PHandle.h>
  26. #include "utlvector.h"
  27. #include "netadr.h"
  28. #include "Server.h"
  29. //#include "serversession.h"
  30. //#include "trackerdoc.h"
  31. //#include "ITrackerUser.h"
  32. #include "../TrackerNET/TrackerNET_Interface.h"
  33. #include "../TrackerNET/NetAddress.h" // for CNetAddress
  34. #include "../TrackerNET/BinaryBuffer.h" // for IBinaryBuffer
  35. #include "IGameList.h"
  36. //#include "ClickableTabbedPanel.h"
  37. class CServerContextMenu;
  38. namespace vgui
  39. {
  40. class Label;
  41. class Font;
  42. class ListPanel;
  43. class Button;
  44. class ComboBox;
  45. class QueryBox;
  46. class ToggleButton;
  47. class TextEntry;
  48. class CheckButton;
  49. class PropertySheet;
  50. }
  51. extern class IRunGameEngine *g_pRunGameEngine;
  52. extern void v_strncpy(char *dest, const char *src, int bufsize);
  53. class CFavoriteGames;
  54. class CGamePanelInfo;
  55. class CDialogGameInfo;
  56. //-----------------------------------------------------------------------------
  57. // Purpose:
  58. //-----------------------------------------------------------------------------
  59. class VInternetDlg : public vgui::Frame
  60. {
  61. public:
  62. // Construction/destruction
  63. VInternetDlg( unsigned int userid );
  64. virtual ~VInternetDlg( void );
  65. virtual void Initialize( void );
  66. // displays the dialog, moves it into focus, updates if it has to
  67. virtual void Open( void );
  68. // gets server info
  69. serveritem_t &VInternetDlg::GetServer(unsigned int serverID);
  70. // setup
  71. virtual void PerformLayout();
  72. // updates status text at bottom of window
  73. virtual void UpdateStatusText(PRINTF_FORMAT_STRING const char *format, ...);
  74. // context menu access
  75. virtual CServerContextMenu *GetContextMenu();
  76. // returns a pointer to a static instance of this dialog
  77. // valid for use only in sort functions
  78. static VInternetDlg *GetInstance();
  79. // begins the process of joining a server from a game list
  80. // the game info dialog it opens will also update the game list
  81. virtual CDialogGameInfo *JoinGame(IGameList *gameList, unsigned int serverIndex);
  82. // joins a game by a specified IP, not attached to any game list
  83. virtual CDialogGameInfo *JoinGame(int serverIP, int serverPort, const char *titleName);
  84. // opens a game info dialog from a game list
  85. virtual CDialogGameInfo *OpenGameInfoDialog(IGameList *gameList, unsigned int serverIndex);
  86. // opens a game info dialog by a specified IP, not attached to any game list
  87. virtual CDialogGameInfo *OpenGameInfoDialog(int serverIP, int serverPort, const char *titleName);
  88. virtual vgui::PropertySheet *GetTabPanel();
  89. // called by the config panel to setup some global config values
  90. virtual void SetConfig(bool autorefresh,bool savercon,int refreshtime,bool graphs,int graphrefreshtime,bool getlogs);
  91. // passes the server info to the favorites panel to update the rconPassword
  92. virtual void UpdateServer(serveritem_t &server);
  93. // opens up the config dialog with the current config settings
  94. virtual void ConfigPanel();
  95. virtual void OnTick();
  96. void SearchForFriend(unsigned int uid, const char *email, const char *username, const char *firstname, const char *lastname);
  97. ISendMessage *VInternetDlg::CreateServerMessage(int msgID);
  98. CNetAddress GetServerAddress();
  99. void SendInitialLogin();
  100. bool CheckMessageValidity(IReceiveMessage *dataBlock);
  101. private:
  102. // menu handler for tabs
  103. void OnOpenContextMenu();
  104. // current game list change
  105. //virtual void OnGameListChanged();
  106. // password entry dialog for new servers
  107. void OnPlayerDialog(vgui::KeyValues *data);
  108. void OnDeleteServer(int chosenPanel);
  109. // load/saves filter settings from disk
  110. virtual void LoadFilters();
  111. virtual void SaveFilters();
  112. // Load/saves position and window size of a dialog from disk
  113. virtual void LoadDialogState(vgui::Panel *dialog, const char *dialogName);
  114. virtual void SaveDialogState(vgui::Panel *dialog, const char *dialogName);
  115. // called when dialog is shut down
  116. virtual void OnClose();
  117. // catches the "manage server" menu option
  118. void OnManageServer(int serverID);
  119. // actually creates the new tab
  120. void ManageServer(int serverID,const char *pass);
  121. // pointer to current game list
  122. IGameList *m_pGameList;
  123. // Status text
  124. vgui::Label *m_pStatusLabel;
  125. // property sheet
  126. vgui::PropertySheet *m_pTabPanel;
  127. CFavoriteGames *m_pFavoriteGames;
  128. CGamePanelInfo *m_pGamePanelInfo;
  129. vgui::KeyValues *m_pSavedData;
  130. bool m_bAutoRefresh;
  131. bool m_bSaveRcon;
  132. int m_iRefreshTime;
  133. bool m_bGraphs;
  134. int m_iGraphsRefreshTime;
  135. bool m_bDoLogging; // whether to get server log messages
  136. ITrackerNET *m_pNet;
  137. unsigned int m_iSessionID; // the session ID from tracker
  138. unsigned int m_iUserID;
  139. int m_iRemoteUID;
  140. bool m_bLoggedIn;
  141. CNetAddress m_iServerAddr;
  142. // context menu
  143. CServerContextMenu *m_pContextMenu;
  144. typedef vgui::Frame BaseClass;
  145. DECLARE_PANELMAP();
  146. };
  147. #endif // VINTERNETDLG_H