From 3bf9df6b2785fa6d951086978a3e66f49427166a Mon Sep 17 00:00:00 2001 From: FluorescentCIAAfricanAmerican <0934gj3049fk@protonmail.com> Date: Wed, 22 Apr 2020 12:56:21 -0400 Subject: 1 --- gameui/CustomTabExplanationDialog.cpp | 93 +++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 gameui/CustomTabExplanationDialog.cpp (limited to 'gameui/CustomTabExplanationDialog.cpp') diff --git a/gameui/CustomTabExplanationDialog.cpp b/gameui/CustomTabExplanationDialog.cpp new file mode 100644 index 0000000..f58c1cb --- /dev/null +++ b/gameui/CustomTabExplanationDialog.cpp @@ -0,0 +1,93 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#include "CustomTabExplanationDialog.h" +#include "BasePanel.h" +#include "convar.h" +#include "EngineInterface.h" +#include "GameUI_Interface.h" +#include "vgui/ISurface.h" +#include "vgui/IInput.h" +#include "ModInfo.h" +#include + +using namespace vgui; + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +CCustomTabExplanationDialog::CCustomTabExplanationDialog(vgui::Panel *parent) : BaseClass(parent, "CustomTabExplanationDialog") +{ + SetDeleteSelfOnClose(true); + SetSizeable( false ); + + input()->SetAppModalSurface(GetVPanel()); + + LoadControlSettings("Resource/CustomTabExplanationDialog.res"); + + MoveToCenterOfScreen(); + + GameUI().PreventEngineHideGameUI(); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +CCustomTabExplanationDialog::~CCustomTabExplanationDialog() +{ +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CCustomTabExplanationDialog::ApplySchemeSettings( vgui::IScheme *pScheme ) +{ + BaseClass::ApplySchemeSettings( pScheme ); + + SetDialogVariable( "game", ModInfo().GetGameName() ); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CCustomTabExplanationDialog::OnKeyCodePressed(KeyCode code) +{ + if (code == KEY_ESCAPE) + { + Close(); + } + else + { + BaseClass::OnKeyCodePressed(code); + } +} + +//----------------------------------------------------------------------------- +// Purpose: handles button commands +//----------------------------------------------------------------------------- +void CCustomTabExplanationDialog::OnCommand( const char *command ) +{ + if ( !stricmp( command, "ok" ) || !stricmp( command, "cancel" ) || !stricmp( command, "close" ) ) + { + Close(); + } + else + { + BaseClass::OnCommand( command ); + } +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CCustomTabExplanationDialog::OnClose( void ) +{ + BaseClass::OnClose(); + GameUI().AllowEngineHideGameUI(); +} -- cgit v1.2.3