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 --- tracker/AdminServer/DialogCvarChange.cpp | 151 +++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 tracker/AdminServer/DialogCvarChange.cpp (limited to 'tracker/AdminServer/DialogCvarChange.cpp') diff --git a/tracker/AdminServer/DialogCvarChange.cpp b/tracker/AdminServer/DialogCvarChange.cpp new file mode 100644 index 0000000..3c94d3a --- /dev/null +++ b/tracker/AdminServer/DialogCvarChange.cpp @@ -0,0 +1,151 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#include +#include "DialogCvarChange.h" + +#include +#include +#include + +#include +#include +#include +#include + +using namespace vgui; + +//----------------------------------------------------------------------------- +// Purpose: Constructor +//----------------------------------------------------------------------------- +CDialogCvarChange::CDialogCvarChange(vgui::Panel *parent) : Frame(parent, "DialogCvarChange") +{ + SetSize(320, 200); + + m_bAddCvarText = true; + + m_pInfoLabel = new Label(this, "InfoLabel", ""); + m_pCvarLabel = new Label(this, "CvarLabel", ""); + m_pCvarEntry = new TextEntry(this, "CvarEntry"); + m_pOkayButton = new Button(this, "OkayButton", "#Okay_Button"); + + LoadControlSettings("Admin/DialogCvarChange.res", "PLATFORM"); + + SetTitle("#Cvar_Title", true); + + SetSizeable(false); + // set our initial position in the middle of the workspace + MoveToCenterOfScreen(); +} + +//----------------------------------------------------------------------------- +// Purpose: Destructor +//----------------------------------------------------------------------------- +CDialogCvarChange::~CDialogCvarChange() +{ +} + +//----------------------------------------------------------------------------- +// Purpose: Hides value text +//----------------------------------------------------------------------------- +void CDialogCvarChange::MakePassword() +{ + m_pCvarEntry->SetTextHidden(true); + m_bAddCvarText = false; // this isn't asking about a cvar +} + +//----------------------------------------------------------------------------- +// Purpose: initializes the dialog and brings it to the foreground +//----------------------------------------------------------------------------- +void CDialogCvarChange::Activate(const char *cvarName, const char *curValue, const char *type, const char *question) +{ + m_pCvarLabel->SetText(cvarName); + if (!m_bAddCvarText) + { + m_pCvarLabel->SetVisible(false); // hide this + } + + m_pInfoLabel->SetText(question); + + m_cType=type; + + m_pOkayButton->SetAsDefaultButton(true); + MakePopup(); + MoveToFront(); + + m_pCvarEntry->SetText(curValue); + m_pCvarEntry->RequestFocus(); + RequestFocus(); + + // make it modal + input()->SetAppModalSurface(GetVPanel()); + SetVisible(true); + + BaseClass::Activate(); +} + +//----------------------------------------------------------------------------- +// Purpose: Sets the text of a labell by name +//----------------------------------------------------------------------------- +void CDialogCvarChange::SetLabelText(const char *textEntryName, const char *text) +{ + Label *entry = dynamic_cast