summaryrefslogtreecommitdiff
path: root/serverbrowser/CustomGames.h
blob: 279b586dba2d3576f8cd6041bd269f15e878b5af (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================

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

#define MAX_TAG_CHARACTERS			128

class TagInfoLabel : public vgui::URLLabel
{
	DECLARE_CLASS_SIMPLE( TagInfoLabel, vgui::URLLabel );
public:
	TagInfoLabel(Panel *parent, const char *panelName);
	TagInfoLabel(Panel *parent, const char *panelName, const char *text, const char *pszURL);

	virtual void	OnMousePressed(vgui::MouseCode code);

	MESSAGE_FUNC( DoOpenCustomServerInfoURL, "DoOpenCustomServerInfoURL" );
};

class TagMenuButton : public vgui::MenuButton
{
	DECLARE_CLASS_SIMPLE( TagMenuButton, vgui::MenuButton );
public:
	TagMenuButton( Panel *parent, const char *panelName, const char *text);

	virtual void OnShowMenu(vgui::Menu *menu);
};

//-----------------------------------------------------------------------------
// Purpose: Internet games with tags
//-----------------------------------------------------------------------------

class CCustomGames : public CInternetGames
{
	DECLARE_CLASS_SIMPLE( CCustomGames, CInternetGames );
public:
	CCustomGames(vgui::Panel *parent);
	~CCustomGames();

	virtual void	UpdateDerivedLayouts( void ) OVERRIDE;
	virtual void	OnLoadFilter(KeyValues *filter) OVERRIDE;
	virtual void	OnSaveFilter(KeyValues *filter) OVERRIDE;
	bool	CheckTagFilter( gameserveritem_t &server ) OVERRIDE;
	bool	CheckWorkshopFilter( gameserveritem_t &server ) OVERRIDE;
	virtual void	SetRefreshing(bool state) OVERRIDE;
	virtual void	ServerResponded( int iServer, gameserveritem_t *pServerItem ) OVERRIDE;

	MESSAGE_FUNC_PARAMS( OnAddTag, "AddTag", params );
	MESSAGE_FUNC( OnTagMenuButtonOpened, "TagMenuButtonOpened" );

	void			RecalculateCommonTags( void );
	void			AddTagToFilterList( const char *pszTag );

private:
	TagInfoLabel	*m_pTagInfoURL;
	TagMenuButton	*m_pAddTagList;
	vgui::Menu		*m_pTagListMenu;
	vgui::TextEntry	*m_pTagFilter;
	char			m_szTagFilter[MAX_TAG_CHARACTERS];
};


#endif // CUSTOMGAMES_H