summaryrefslogtreecommitdiff
path: root/game/client/tf/vgui/tf_lobby_container_frame.h
blob: a97002ede3ec0582865158cb11d551279d6bc743 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//

#ifndef TF_LOBBY_CONTAINER_FRAME_H
#define TF_LOBBY_CONTAINER_FRAME_H


#include "cbase.h"
#include "vgui_controls/PropertyDialog.h"
#include "GameEventListener.h"

// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>

bool BIsPartyLeader();
bool BIsPartyInUIState();
CSteamID SteamIDFromDecimalString( const char *pszUint64InDecimal );

class CBaseLobbyPanel;

// This is a big fat kludge so I can use the PropertyPage
class CBaseLobbyContainerFrame : public vgui::PropertyDialog, public CGameEventListener
{
	DECLARE_CLASS_SIMPLE( CBaseLobbyContainerFrame, PropertyDialog );
public:
	CBaseLobbyContainerFrame( const char *pszPanelName );
	virtual ~CBaseLobbyContainerFrame();

	//
	// PropertyDialog overrides
	//
	virtual void ApplySchemeSettings( vgui::IScheme *pScheme ) OVERRIDE;
	virtual void PerformLayout( void ) OVERRIDE;
	virtual void OnKeyCodeTyped(vgui::KeyCode code) OVERRIDE;
	virtual void OnKeyCodePressed(vgui::KeyCode code) OVERRIDE;
	virtual void OnCommand( const char *command ) OVERRIDE;

	//
	// CGameEventListener overrides
	//
	virtual void FireGameEvent( IGameEvent *event ) OVERRIDE;

	void StartSearch( void );
	virtual void ShowPanel(bool bShow);
	void SetNextButtonEnabled( bool bValue );

	virtual void OnThink() OVERRIDE;

	static void LeaveLobbyPanel( bool bConfirmed, void *pContext )
	{
		CBaseLobbyContainerFrame* pCaller = (CBaseLobbyContainerFrame*)pContext;
		if ( bConfirmed && pCaller )
		{
			pCaller->OnCommand( "back" );
		}
	}

	MESSAGE_FUNC( OpenPingOptions, "Context_Ping" );

protected:
	
	bool ShouldShowPartyButton() const;
	virtual void WriteControls();
	virtual void HandleBackPressed();
	void OpenOptionsContextMenu();

	CBaseLobbyPanel *m_pContents;
	vgui::Button *m_pNextButton;
	vgui::Button *m_pBackButton;

private:
	
	virtual const char* GetResFile() const = 0;
	virtual TF_MatchmakingMode GetHandledMode() const = 0;
	virtual bool VerifyPartyAuthorization() const = 0;

	vgui::Button *m_pStartPartyButton;
	vgui::Menu *m_pContextMenu;

	bool m_bNextButtonEnabled;

	vgui::DHANDLE< vgui::Panel > m_hPingPanel;
};

#endif //TF_LOBBY_CONTAINER_FRAME_H