summaryrefslogtreecommitdiff
path: root/tracker/AdminServer/BaseGamesPage.h
blob: b6e0eb61a153668f85b5740c36f5c79a76805fe7 (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
82
83
84
85
86
87
88
89
90
91
92
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================

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

#include <VGUI_Frame.h>
#include "ServerList.h"
#include "IServerRefreshResponse.h"
#include "server.h"
#include "IGameList.h"

namespace vgui
{
class ListPanel;
class ImagePanel;
class ComboBox;
class ToggleButton;
class CheckButton;
class TextEntry;
class MenuButton;
class Menu;
};

//-----------------------------------------------------------------------------
// Purpose: Base property page for all the games lists (internet/favorites/lan/etc.)
//-----------------------------------------------------------------------------
class CBaseGamesPage : public vgui2::Frame, public IServerRefreshResponse, public IGameList
{
public:
	CBaseGamesPage(vgui::Panel *parent, const char *name);
	~CBaseGamesPage();

	virtual void PerformLayout();
	virtual void ApplySchemeSettings(vgui::IScheme *pScheme);

	// gets information about specified server
	virtual serveritem_t &GetServer(unsigned int serverID);

	virtual void SetRefreshing(bool state);

protected:
	virtual void OnTick();
	virtual void OnCommand(const char *command);
//	virtual void OnOnMouseDoublePressed(enum vgui::MouseCode code); 

	// an inner class
	class OurListPanel: public vgui::ListPanel
	{
	public:
		OurListPanel(vgui::Panel *parent, const char *panelName): vgui::ListPanel(parent,panelName) { m_pParent=parent;};
		
		virtual void	OnMouseDoublePressed( vgui::MouseCode code );
	private:
		vgui::Panel *m_pParent;

	};

	// a list panel we grab the double click event from :)
	OurListPanel *m_pGameList;
	CServerList	m_Servers;
	vgui::ImagePanel *m_pPasswordIcon; // password icon

private:
	void OnButtonToggled(vgui::Panel *panel, int state);
	void OnTextChanged(vgui::Panel *panel, const char *text);
	void OnManage();

	// command buttons
	vgui::Button *m_pConnect;
	vgui::Button *m_pRefresh;
	vgui::Button *m_pManage;
	vgui::Button *m_pAddIP;

	vgui::Panel *m_pParent;

//	vgui::Menu *m_pRefreshMenu;

	typedef vgui::Frame BaseClass;

	DECLARE_PANELMAP();
};


#endif // BASEGAMESPAGE_H