aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public/vgui_controls/MessageDialog.h
blob: 191bb2b6bc196d0a342d2d58422223d53d5213d4 (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Contains the CMessageDialog declaration
//
// $NoKeywords: $
//=============================================================================//

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

// styles
#define MD_WARNING				0x0001
#define MD_ERROR				0x0002

// button configurations
#define MD_OK					0x0004	// 1 button - OK
#define MD_CANCEL				0x0008	// 1 button - CANCEL
#define MD_OKCANCEL				0x0010	// 2 buttons - OK and CANCEL
#define MD_YESNO				0x0020	// 2 buttons - YES and NO

// behavior
#define MD_SIMPLEFRAME			0x0100	// legacy corners
#define MD_COMMANDAFTERCLOSE	0x0200	// send command at dialog termination (i.e. after fade)
#define MD_RESTRICTPAINT		0x0400	// only paint this dialog (hide any other ui elements)
#define MD_COMMANDONFORCECLOSE	0x0800	// send command when the dialog is closed assuming A input

// dialog type
enum EDialogType
{
	MD_SAVE_BEFORE_QUIT,
	MD_QUIT_CONFIRMATION,
	MD_QUIT_CONFIRMATION_TF,
	MD_KICK_CONFIRMATION,
	MD_CLIENT_KICKED,
	MD_LOST_HOST,
	MD_LOST_SERVER,
	MD_SEARCHING_FOR_GAMES,
	MD_CREATING_GAME,
	MD_MODIFYING_SESSION,
	MD_SESSION_SEARCH_FAILED,
	MD_SESSION_CREATE_FAILED,
	MD_SESSION_CONNECTING,
	MD_SESSION_CONNECT_NOTAVAILABLE,
	MD_SESSION_CONNECT_SESSIONFULL,
	MD_SESSION_CONNECT_FAILED,
	MD_EXIT_SESSION_CONFIRMATION,
	MD_STORAGE_DEVICES_NEEDED,
	MD_STORAGE_DEVICES_CHANGED,
	MD_STORAGE_DEVICES_TOO_FULL,
	MD_NOT_ONLINE_ENABLED,
	MD_NOT_ONLINE_SIGNEDIN,
	MD_DEFAULT_CONTROLS_CONFIRM,
	MD_AUTOSAVE_EXPLANATION,
	MD_COMMENTARY_EXPLANATION,
	MD_COMMENTARY_EXPLANATION_MULTI,
	MD_COMMENTARY_CHAPTER_UNLOCK_EXPLANATION,
	MD_SAVE_BEFORE_LANGUAGE_CHANGE,
	MD_SAVE_BEFORE_NEW_GAME,
	MD_SAVE_BEFORE_LOAD,
	MD_DELETE_SAVE_CONFIRM,
	MD_SAVE_OVERWRITE,
	MD_SAVING_WARNING,
	MD_SAVE_COMPLETE,
	MD_STANDARD_SAMPLE,
	MD_WARNING_SAMPLE,
	MD_ERROR_SAMPLE,
	MD_PROMPT_SIGNIN,
	MD_PROMPT_SIGNIN_REQUIRED,
	MD_PROMPT_STORAGE_DEVICE,
	MD_PROMPT_STORAGE_DEVICE_REQUIRED,
	MD_DISCONNECT_CONFIRMATION,
	MD_DISCONNECT_CONFIRMATION_HOST,
	MD_LOAD_FAILED_WARNING,
	MD_OPTION_CHANGE_FROM_X360_DASHBOARD,
	MD_STORAGE_DEVICES_CORRUPT,
	MD_CHECKING_STORAGE_DEVICE
};

#include "vgui_controls/Frame.h"
#include "vgui_controls/Label.h"
#include "vgui_controls/AnimatingImagePanel.h"
#include "vgui_controls/ImagePanel.h"

//-----------------------------------------------------------------------------
// Purpose: Simple modal dialog box for Xbox 360 warnings and messages
//-----------------------------------------------------------------------------
class CMessageDialog : public vgui::Frame
{
	DECLARE_CLASS_SIMPLE( CMessageDialog, vgui::Frame ); 

public:
	CMessageDialog( vgui::Panel *parent, const uint nType, const char *pTitle, const char *pMsg, const char *pCmdA, const char *pCmdB, vgui::Panel *pParent, bool bShowActivity );
	~CMessageDialog();

	enum
	{
		BTN_INVALID = -1,
		BTN_B,
		BTN_A,
		MAX_BUTTONS,
	};

	struct ButtonLabel_s
	{
		vgui::Label *pIcon;
		vgui::Label *pText;
		int			nWide;
		bool		bCreated;
	};

	virtual void		OnKeyCodePressed( vgui::KeyCode code );
	virtual void		ApplySchemeSettings( vgui::IScheme *pScheme );
	virtual void		ApplySettings( KeyValues *inResourceData );
	virtual void		PaintBackground();
	uint				GetType( void );
	void				SetControlSettingsKeys( KeyValues *pKeys );

private:	
	void				CreateButtonLabel( ButtonLabel_s *pButton, const char *pIcon, const char *pText );
	void				DoCommand( int button );

	vgui::Panel			*m_pCreator;

	vgui::Label			*m_pTitle;
	vgui::Label			*m_pMsg;
	vgui::ImagePanel	*m_pBackground;

	vgui::AnimatingImagePanel	*m_pAnimatingPanel;

	vgui::HFont			m_hButtonFont;
	vgui::HFont			m_hTextFont;
	uint				m_nType;
	Color				m_ButtonTextColor;
	int					m_ButtonPressed;
	KeyValues			*m_pControlSettings;

	int					m_FooterTall;
	int					m_ButtonMargin;
	Color				m_clrNotSimpleBG;
	Color				m_clrNotSimpleBGBlack;
	int					m_ButtonIconLabelSpace;

	int					m_ActivityIndent;

	bool				m_bShowActivity; // should we show an animating image panel?

	ButtonLabel_s		m_Buttons[MAX_BUTTONS];
	char				*m_pCommands[MAX_BUTTONS];
};

#endif	// MESSAGEDIALOG_H