diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /common/GameUI/cvarslider.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'common/GameUI/cvarslider.h')
| -rw-r--r-- | common/GameUI/cvarslider.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/common/GameUI/cvarslider.h b/common/GameUI/cvarslider.h new file mode 100644 index 0000000..b03417a --- /dev/null +++ b/common/GameUI/cvarslider.h @@ -0,0 +1,63 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef CVARSLIDER_H +#define CVARSLIDER_H +#ifdef _WIN32 +#pragma once +#endif + +#include <vgui_controls/Slider.h> + +class CCvarSlider : public vgui::Slider +{ + DECLARE_CLASS_SIMPLE( CCvarSlider, vgui::Slider ); + +public: + + CCvarSlider( vgui::Panel *parent, const char *panelName ); + CCvarSlider( vgui::Panel *parent, const char *panelName, char const *caption, + float minValue, float maxValue, char const *cvarname, bool bAllowOutOfRange=false ); + ~CCvarSlider(); + + void SetupSlider( float minValue, float maxValue, const char *cvarname, bool bAllowOutOfRange ); + + void SetCVarName( char const *cvarname ); + void SetMinMaxValues( float minValue, float maxValue, bool bSetTickdisplay = true ); + void SetTickColor( Color color ); + + virtual void Paint(); + + virtual void ApplySettings( KeyValues *inResourceData ); + virtual void GetSettings( KeyValues *outResourceData ); + + void ApplyChanges(); + float GetSliderValue(); + void SetSliderValue(float fValue); + void Reset(); + bool HasBeenModified(); + +private: + MESSAGE_FUNC( OnSliderMoved, "SliderMoved" ); + MESSAGE_FUNC( OnSliderDragEnd, "SliderDragEnd" ); + + CPanelAnimationVar( bool, m_bUseConVarMinMax, "use_convar_minmax", "0" ); + + bool m_bAllowOutOfRange; + bool m_bModifiedOnce; + float m_fStartValue; + int m_iStartValue; + int m_iLastSliderValue; + float m_fCurrentValue; + char m_szCvarName[ 64 ]; + + bool m_bCreatedInCode; + float m_flMinValue; + float m_flMaxValue; +}; + +#endif // CVARSLIDER_H |