Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.9 KiB

//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
9 years ago
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef VGUI_CHECKBUTTON2_H
3 years ago
#define VGUI_CHECKBUTTON2_H
#ifdef _WIN32
#pragma once
#endif
9 years ago
#include "VGUI_Label.h"
#include "VGUI_ImagePanel.h"
9 years ago
#include "vgui_defaultinputsignal.h"
namespace vgui
{
class CCheckButton2;
class ICheckButton2Handler
{
public:
virtual void StateChanged( CCheckButton2 *pButton ) = 0;
9 years ago
};
// VGUI checkbox class.
// - Provides access to the checkbox images.
// - Provides an easy callback mechanism for state changes.
// - Default background is invisible, and default text color is white.
class CCheckButton2 : public Panel, public CDefaultInputSignal
{
public:
CCheckButton2();
~CCheckButton2();
9 years ago
// Initialize the button with these.
void SetImages( char const *pChecked, char const *pUnchecked );
void SetImages( Image *pChecked, Image *pUnchecked ); // If you use this, the button will never delete the images.
9 years ago
void DeleteImages();
// The checkbox can be to the left or the right of the text (default is left).
void SetCheckboxLeft( bool bLeftAlign );
9 years ago
bool GetCheckboxLeft();
9 years ago
// Set the label text.
void SetText( char const *pText, ... );
void SetTextColor( int r, int g, int b, int a );
9 years ago
// You can register for change notification here.
void SetHandler( ICheckButton2Handler *pHandler );
9 years ago
// Get/set the check state.
bool IsChecked();
void SetChecked( bool bChecked );
9 years ago
// Panel overrides.
virtual void internalMousePressed( MouseCode code );
9 years ago
protected:
void SetupControls();
// InputSignal overrides.
virtual void mousePressed( MouseCode code, Panel *panel );
9 years ago
public:
ICheckButton2Handler *m_pHandler;
bool m_bCheckboxLeft;
Label m_Label;
ImagePanel m_CheckboxPanel;
Image *m_pChecked;
Image *m_pUnchecked;
bool m_bOwnImages;
bool m_bChecked;
};
}
#endif // VGUI_CHECKBUTTON2_H