This commit is contained in:
nephacks
2025-06-04 03:22:50 +02:00
parent f234f23848
commit f12416cffd
14243 changed files with 6446499 additions and 26 deletions

View File

@ -0,0 +1,45 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "commandcheckbutton.h"
#include "engineinterface.h"
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
using namespace vgui;
CCommandCheckButton::CCommandCheckButton( Panel *parent, const char *panelName, const char *text, const char *downcmd, const char *upcmd )
: CheckButton( parent, panelName, text )
{
m_pszDown = downcmd ? strdup( downcmd ) : NULL;
m_pszUp = upcmd ? strdup( upcmd ) : NULL;
}
CCommandCheckButton::~CCommandCheckButton()
{
free( m_pszDown );
free( m_pszUp );
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *panel -
//-----------------------------------------------------------------------------
void CCommandCheckButton::SetSelected( bool state )
{
BaseClass::SetSelected( state );
if ( IsSelected() && m_pszDown )
{
engine->ClientCmd_Unrestricted( m_pszDown );
}
else if ( !IsSelected() && m_pszUp )
{
engine->ClientCmd_Unrestricted( m_pszUp );
}
}