2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-25 03:09:24 +01:00
hlsdk-xash3d/game_shared/vgui_checkbutton2.h
Roman Chistokhodov ba2cab60df
Get VGUI back (optionally) (#194)
* Get VGUI back (optionally)

* Add some missing VGUI invocations

* Update CMakeLists.txt to build with vgui for Windows

* Move windows.h inclusions only to those places where it's really needed

* Try fix mingw build

* Update hud_spectator

* Merge nekonomicon's vgui branch

* Don't include vgui panel and app in cdll_int.cpp if vgui is real

* Deduplicate scoreboard global variables

* Add options to prefer non-vgui motd and scoreboard when vgui is enabled

* Add vgui-dev as a submodule. Add building vith vgui to CI

* Fix artifact uploading

* Don't use global variable when not necessary

* char* to const char* in CMenuHandler_StringCommand constructor

* Fix 'format string is not a literal string' warnings

* Fix 'always evaluate to true' warnings

* Team Fortress classes to const char*

* CreateCommandMenu accepts const char*

* Fix printf formats. Turn some unsigned longs into unsigned ints since they use only 32 bits anyway

* Explicit assignment result as condition

* Prevent memory leak on menu reading

* Localize button text

* Create FileInputStream on stack avoiding the leak

* Remove Servers Browser code

* Arrow file names to const char*

* Fix assignment to the wrong variable
2021-10-27 01:35:11 +00:00

81 lines
1.9 KiB
C++
Raw Blame History

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