//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: // // $NoKeywords: $ //============================================================================= #include #include "DialogAddBan.h" #include #include #include #include #include #include #include using namespace vgui; //----------------------------------------------------------------------------- // Purpose: Constructor //----------------------------------------------------------------------------- CDialogAddBan::CDialogAddBan(vgui::Panel *parent) : Frame(parent, "DialogAddBan") { SetSize(320, 200); SetTitle("#Game_Ban_Add_Title", false); m_pIDTextEntry = new TextEntry(this, "IDTextEntry"); m_pOkayButton = new Button(this, "OkayButton", "#Okay_Button"); m_pPermBanRadio = new RadioButton(this, "PermBanRadio", "#Add_Ban_Time_Permanent"); m_pTempBanRadio = new RadioButton(this, "TempBanRadio", "#Add_Ban_Time_Temporary"); m_pPermBanRadio->SetSelected(true); m_pTimeTextEntry = new TextEntry(this, "TimeTextEntry"); m_pTimeCombo = new ComboBox(this, "TimeCombo",3,false); int defaultItem = m_pTimeCombo->AddItem("#Add_Ban_Period_Minutes", NULL); m_pTimeCombo->AddItem("#Add_Ban_Period_Hours", NULL); m_pTimeCombo->AddItem("#Add_Ban_Period_Days", NULL); m_pTimeCombo->ActivateItem(defaultItem); LoadControlSettings("Admin\\DialogAddBan.res", "PLATFORM"); SetTitle("#Add_Ban_Title", true); SetSizeable(false); // set our initial position in the middle of the workspace MoveToCenterOfScreen(); } //----------------------------------------------------------------------------- // Purpose: Destructor //----------------------------------------------------------------------------- CDialogAddBan::~CDialogAddBan() { } //----------------------------------------------------------------------------- // Purpose: initializes the dialog and brings it to the foreground //----------------------------------------------------------------------------- void CDialogAddBan::Activate(const char *type,const char *player,const char *authid) { m_cType=type; m_pOkayButton->SetAsDefaultButton(true); MakePopup(); MoveToFront(); RequestFocus(); m_pIDTextEntry->RequestFocus(); SetVisible(true); SetTextEntry("PlayerTextEntry",player); SetTextEntry("IDTextEntry",authid); BaseClass::Activate(); } //----------------------------------------------------------------------------- // Purpose: Sets the text of a labell by name //----------------------------------------------------------------------------- void CDialogAddBan::SetLabelText(const char *textEntryName, const char *text) { Label *entry = dynamic_cast