Team Fortress 2 Source Code as on 22/4/2020
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.

63 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef CVARSLIDER_H
  8. #define CVARSLIDER_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui_controls/Slider.h>
  13. class CCvarSlider : public vgui::Slider
  14. {
  15. DECLARE_CLASS_SIMPLE( CCvarSlider, vgui::Slider );
  16. public:
  17. CCvarSlider( vgui::Panel *parent, const char *panelName );
  18. CCvarSlider( vgui::Panel *parent, const char *panelName, char const *caption,
  19. float minValue, float maxValue, char const *cvarname, bool bAllowOutOfRange=false );
  20. ~CCvarSlider();
  21. void SetupSlider( float minValue, float maxValue, const char *cvarname, bool bAllowOutOfRange );
  22. void SetCVarName( char const *cvarname );
  23. void SetMinMaxValues( float minValue, float maxValue, bool bSetTickdisplay = true );
  24. void SetTickColor( Color color );
  25. virtual void Paint();
  26. virtual void ApplySettings( KeyValues *inResourceData );
  27. virtual void GetSettings( KeyValues *outResourceData );
  28. void ApplyChanges();
  29. float GetSliderValue();
  30. void SetSliderValue(float fValue);
  31. void Reset();
  32. bool HasBeenModified();
  33. private:
  34. MESSAGE_FUNC( OnSliderMoved, "SliderMoved" );
  35. MESSAGE_FUNC( OnSliderDragEnd, "SliderDragEnd" );
  36. CPanelAnimationVar( bool, m_bUseConVarMinMax, "use_convar_minmax", "0" );
  37. bool m_bAllowOutOfRange;
  38. bool m_bModifiedOnce;
  39. float m_fStartValue;
  40. int m_iStartValue;
  41. int m_iLastSliderValue;
  42. float m_fCurrentValue;
  43. char m_szCvarName[ 64 ];
  44. bool m_bCreatedInCode;
  45. float m_flMinValue;
  46. float m_flMaxValue;
  47. };
  48. #endif // CVARSLIDER_H