Counter Strike : Global Offensive Source Code
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.

61 lines
1.7 KiB

  1. //========= Copyright � 1996-2005, 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( OnApplyChanges, "ApplyChanges" );
  36. bool m_bAllowOutOfRange;
  37. bool m_bModifiedOnce;
  38. float m_fStartValue;
  39. int m_iStartValue;
  40. int m_iLastSliderValue;
  41. float m_fCurrentValue;
  42. char m_szCvarName[ 64 ];
  43. bool m_bCreatedInCode;
  44. float m_flMinValue;
  45. float m_flMaxValue;
  46. };
  47. #endif // CVARSLIDER_H