aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/client/replay/vgui/replaybrowsermainpanel.h
blob: e34574b00a9658461e4aa1bacd5a8288443c1484 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#if defined( REPLAY_ENABLED )

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

#include "vgui_controls/PropertyDialog.h"
#include "replay/replayhandle.h"
#include "GameEventListener.h"
#include "replaybrowseritemmanager.h"

//-----------------------------------------------------------------------------

class CReplayBrowserBasePage;
class CConfirmDeleteDialog;
class CExButton;

//-----------------------------------------------------------------------------

class CReplayBrowserPanel : public vgui::PropertyDialog,
							public CGameEventListener
{
	DECLARE_CLASS_SIMPLE( CReplayBrowserPanel, vgui::PropertyDialog );
public:
	CReplayBrowserPanel( Panel *parent );
	virtual ~CReplayBrowserPanel();

	void			OnSaveReplay( ReplayHandle_t hNewReplay );
	void			OnDeleteReplay( ReplayHandle_t hDeletedReplay );
	
	void			DeleteReplay( ReplayHandle_t hReplay );

	virtual void	CleanupUIForReplayItem( ReplayItemHandle_t hReplay );	// After a replay has been deleted - deletes all UI (thumbnail, but maybe also row and/or collection as well)

	virtual void	ApplySchemeSettings( vgui::IScheme *pScheme );
	virtual void	PerformLayout( void );
	virtual void	OnCommand( const char *command );
	virtual void	ShowPanel( bool bShow, ReplayHandle_t hReplayDetails = REPLAY_HANDLE_INVALID, int iPerformance = -1 );
	virtual void	OnKeyCodeTyped(vgui::KeyCode code);
	virtual void	OnKeyCodePressed(vgui::KeyCode code);

	virtual void	FireGameEvent( IGameEvent *event );

	MESSAGE_FUNC_PARAMS( OnConfirmDelete, "ConfirmDlgResult", data );

	void			AttemptToDeleteReplayItem( Panel *pHandler, ReplayItemHandle_t hReplayItem, IReplayItemManager *pItemManager, int iPerformance );

	CReplayBrowserBasePage		*m_pReplaysPage;
	CConfirmDeleteDialog		*m_pConfirmDeleteDialog;

	struct DeleteInfo_t
	{
		ReplayItemHandle_t	m_hReplayItem;
		IReplayItemManager	*m_pItemManager;
		vgui::VPANEL		m_hHandler;
		int					m_iPerformance;
	};

	DeleteInfo_t			m_DeleteInfo;

	float GetTimeOpened( void ){ return m_flTimeOpened; }

private:
	void ShowDeleteReplayDenialDlg();
	void ConfirmReplayItemDelete( Panel *pHandler, ReplayItemHandle_t hReplayItem, IReplayItemManager *pItemManager, int iPerformance );

	float					m_flTimeOpened;
};

//-----------------------------------------------------------------------------

CReplayBrowserPanel		*ReplayUI_GetBrowserPanel();
void					ReplayUI_ReloadBrowser( ReplayHandle_t hReplay = REPLAY_HANDLE_INVALID, int iPerformance = -1 );
void					ReplayUI_CloseReplayBrowser();

//-----------------------------------------------------------------------------

#endif // REPLAYBROWSER_MAIN_PANEL_H

#endif