2021-10-27 03:35:11 +02:00
|
|
|
|
//========= Copyright <20> 1996-2002, Valve LLC, All rights reserved. ============
|
2016-06-04 15:24:23 +02:00
|
|
|
|
//
|
|
|
|
|
// Purpose:
|
|
|
|
|
//
|
|
|
|
|
// $NoKeywords: $
|
|
|
|
|
//=============================================================================
|
2021-10-27 03:35:11 +02:00
|
|
|
|
|
|
|
|
|
#ifndef VGUI_CHECKBUTTON2_H
|
2021-06-20 00:53:07 +02:00
|
|
|
|
#define VGUI_CHECKBUTTON2_H
|
2021-10-27 03:35:11 +02:00
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
#pragma once
|
|
|
|
|
#endif
|
2016-06-04 15:24:23 +02:00
|
|
|
|
|
2021-10-27 03:35:11 +02:00
|
|
|
|
#include "VGUI_Label.h"
|
|
|
|
|
#include "VGUI_ImagePanel.h"
|
2016-06-04 15:24:23 +02:00
|
|
|
|
#include "vgui_defaultinputsignal.h"
|
|
|
|
|
|
|
|
|
|
namespace vgui
|
|
|
|
|
{
|
|
|
|
|
class CCheckButton2;
|
|
|
|
|
class ICheckButton2Handler
|
|
|
|
|
{
|
|
|
|
|
public:
|
2021-10-27 03:35:11 +02:00
|
|
|
|
virtual void StateChanged( CCheckButton2 *pButton ) = 0;
|
2016-06-04 15:24:23 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 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:
|
2021-10-27 03:35:11 +02:00
|
|
|
|
CCheckButton2();
|
|
|
|
|
~CCheckButton2();
|
2016-06-04 15:24:23 +02:00
|
|
|
|
|
|
|
|
|
// Initialize the button with these.
|
2021-10-27 03:35:11 +02:00
|
|
|
|
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.
|
2016-06-04 15:24:23 +02:00
|
|
|
|
void DeleteImages();
|
|
|
|
|
|
|
|
|
|
// The checkbox can be to the left or the right of the text (default is left).
|
2021-10-27 03:35:11 +02:00
|
|
|
|
void SetCheckboxLeft( bool bLeftAlign );
|
2016-06-04 15:24:23 +02:00
|
|
|
|
bool GetCheckboxLeft();
|
2021-10-27 03:35:11 +02:00
|
|
|
|
|
2016-06-04 15:24:23 +02:00
|
|
|
|
// Set the label text.
|
2021-10-27 03:35:11 +02:00
|
|
|
|
void SetText( char const *pText, ... );
|
|
|
|
|
void SetTextColor( int r, int g, int b, int a );
|
2016-06-04 15:24:23 +02:00
|
|
|
|
|
|
|
|
|
// You can register for change notification here.
|
2021-10-27 03:35:11 +02:00
|
|
|
|
void SetHandler( ICheckButton2Handler *pHandler );
|
|
|
|
|
|
2016-06-04 15:24:23 +02:00
|
|
|
|
// Get/set the check state.
|
|
|
|
|
bool IsChecked();
|
2021-10-27 03:35:11 +02:00
|
|
|
|
void SetChecked( bool bChecked );
|
2016-06-04 15:24:23 +02:00
|
|
|
|
|
|
|
|
|
// Panel overrides.
|
2021-10-27 03:35:11 +02:00
|
|
|
|
virtual void internalMousePressed( MouseCode code );
|
2016-06-04 15:24:23 +02:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void SetupControls();
|
|
|
|
|
|
|
|
|
|
// InputSignal overrides.
|
2021-10-27 03:35:11 +02:00
|
|
|
|
virtual void mousePressed( MouseCode code, Panel *panel );
|
2016-06-04 15:24:23 +02:00
|
|
|
|
|
|
|
|
|
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
|