summaryrefslogtreecommitdiff
path: root/serverbrowser/FriendsGames.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /serverbrowser/FriendsGames.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'serverbrowser/FriendsGames.cpp')
-rw-r--r--serverbrowser/FriendsGames.cpp88
1 files changed, 88 insertions, 0 deletions
diff --git a/serverbrowser/FriendsGames.cpp b/serverbrowser/FriendsGames.cpp
new file mode 100644
index 0000000..daa14be
--- /dev/null
+++ b/serverbrowser/FriendsGames.cpp
@@ -0,0 +1,88 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================
+
+#include "pch_serverbrowser.h"
+
+using namespace vgui;
+
+//-----------------------------------------------------------------------------
+// Purpose: Constructor
+//-----------------------------------------------------------------------------
+CFriendsGames::CFriendsGames(vgui::Panel *parent) :
+ CBaseGamesPage(parent, "FriendsGames", eFriendsServer )
+{
+ m_iServerRefreshCount = 0;
+
+ if ( !IsSteamGameServerBrowsingEnabled() )
+ {
+ m_pGameList->SetEmptyListText("#ServerBrowser_OfflineMode");
+ m_pConnect->SetEnabled( false );
+ m_pRefreshAll->SetEnabled( false );
+ m_pRefreshQuick->SetEnabled( false );
+ m_pAddServer->SetEnabled( false );
+ m_pFilter->SetEnabled( false );
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Destructor
+//-----------------------------------------------------------------------------
+CFriendsGames::~CFriendsGames()
+{
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose: returns true if the game list supports the specified ui elements
+//-----------------------------------------------------------------------------
+bool CFriendsGames::SupportsItem(InterfaceItem_e item)
+{
+ switch (item)
+ {
+ case FILTERS:
+ return true;
+
+ case GETNEWLIST:
+ default:
+ return false;
+ }
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose: called when the current refresh list is complete
+//-----------------------------------------------------------------------------
+void CFriendsGames::RefreshComplete( HServerListRequest hReq, EMatchMakingServerResponse response )
+{
+ SetRefreshing(false);
+ m_pGameList->SortList();
+ m_iServerRefreshCount = 0;
+
+ if ( IsSteamGameServerBrowsingEnabled() )
+ {
+ // set empty message
+ m_pGameList->SetEmptyListText("#ServerBrowser_NoFriendsServers");
+ }
+
+ BaseClass::RefreshComplete( hReq, response );
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: opens context menu (user right clicked on a server)
+//-----------------------------------------------------------------------------
+void CFriendsGames::OnOpenContextMenu(int itemID)
+{
+ // get the server
+ int serverID = GetSelectedServerID();
+
+ if ( serverID == -1 )
+ return;
+
+ // Activate context menu
+ CServerContextMenu *menu = ServerBrowserDialog().GetContextMenu(GetActiveList());
+ menu->ShowMenu(this, serverID, true, true, true, true);
+}