summaryrefslogtreecommitdiff
path: root/serverbrowser/LanGames.h
blob: f1e3afaae67e685adc3957ecfc324b4dbea30025 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================

#ifndef LANGAMES_H
#define LANGAMES_H
#ifdef _WIN32
#pragma once
#endif

class CLanBroadcastMsgHandler;

//-----------------------------------------------------------------------------
// Purpose: Favorite games list
//-----------------------------------------------------------------------------
class CLanGames : public CBaseGamesPage
{
	DECLARE_CLASS_SIMPLE( CLanGames, CBaseGamesPage );

public:
	CLanGames(vgui::Panel *parent, bool bAutoRefresh=true, const char *pCustomResFilename=NULL);
	~CLanGames();

	// property page handlers
	virtual void OnPageShow();

	// IGameList handlers
	// returns true if the game list supports the specified ui elements
	virtual bool SupportsItem(InterfaceItem_e item);

	// Control which button are visible.
	void ManualShowButtons( bool bShowConnect, bool bShowRefreshAll, bool bShowFilter );

	// If you pass NULL for pSpecificAddresses, it will broadcast on certain points.
	// If you pass a non-null value, then it will send info queries directly to those ports.
	void InternalGetNewServerList( CUtlVector<netadr_t> *pSpecificAddresses );
 
	virtual void StartRefresh();

	// stops current refresh/GetNewServerList()
	virtual void StopRefresh();


	// IServerRefreshResponse handlers
	// called when a server response has timed out
	virtual void ServerFailedToRespond( HServerListRequest hReq, int iServer );

	// called when the current refresh list is complete
	virtual void RefreshComplete( HServerListRequest hReq, EMatchMakingServerResponse response );

	// Tell the game list what to put in there when there are no games found.
	virtual void SetEmptyListText();

private:
	// vgui message handlers
	virtual void OnTick();

	// lan timeout checking
	virtual void CheckRetryRequest();

	// context menu message handlers
	MESSAGE_FUNC_INT( OnOpenContextMenu, "OpenContextMenu", itemID );

	// number of servers refreshed
	int m_iServerRefreshCount;	

	// true if we're broadcasting for servers
	bool m_bRequesting;

	// time at which we last broadcasted
	double m_fRequestTime;

	bool m_bAutoRefresh;
};



#endif // LANGAMES_H