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.

91 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "DemoPage.h"
  8. #include <VGUI/IVGui.h>
  9. #include <Keyvalues.h>
  10. #include <vgui_controls/Slider.h>
  11. #include <vgui_controls/Label.h>
  12. using namespace vgui;
  13. class SampleSliders: public DemoPage
  14. {
  15. public:
  16. SampleSliders(Panel *parent, const char *name);
  17. ~SampleSliders();
  18. private:
  19. Slider *m_pSlider;
  20. Slider *m_pSlider2;
  21. Slider *m_pSlider3;
  22. Label *m_pSliderLabel;
  23. Label *m_pSliderLabel2;
  24. Label *m_pSliderLabel3;
  25. };
  26. //-----------------------------------------------------------------------------
  27. // Purpose: Constructor
  28. //-----------------------------------------------------------------------------
  29. SampleSliders::SampleSliders(Panel *parent, const char *name) : DemoPage(parent, name)
  30. {
  31. m_pSliderLabel = new Label (this, "ASliderLabel", "Label on top");
  32. m_pSliderLabel->SizeToContents();
  33. m_pSliderLabel->SetPos(90, 25);
  34. m_pSliderLabel->SetZPos(1);
  35. m_pSlider = new Slider (this, "ALabeledSlider");
  36. m_pSlider->SetPos(90,50);
  37. m_pSlider->SetSize(165, 30);
  38. m_pSlider->SetTickCaptions("0", "test");
  39. m_pSlider->SetNumTicks(7);
  40. m_pSlider->SetZPos(0);
  41. m_pSliderLabel2 = new Label (this, "ASliderLabel", "Or, without numbers");
  42. m_pSliderLabel2->SizeToContents();
  43. m_pSliderLabel2->SetPos(290, 25);
  44. m_pSliderLabel2->SetZPos(1);
  45. m_pSlider2 = new Slider (this, "ALabeledSlider");
  46. m_pSlider2->SetPos(290,50);
  47. m_pSlider2->SetSize(165, 50);
  48. m_pSlider2->SetNumTicks(7);
  49. m_pSlider2->SetZPos(0);
  50. m_pSliderLabel3 = new Label (this, "ASliderLabel", "Label at left");
  51. m_pSliderLabel3->SizeToContents();
  52. m_pSliderLabel3->SetPos(90, 125);
  53. m_pSlider3 = new Slider (this, "ALabeledSlider");
  54. int wide, tall;
  55. m_pSliderLabel->GetSize(wide, tall);
  56. m_pSlider3->SetPos(90+wide,125);
  57. m_pSlider3->SetSize(150, 50);
  58. m_pSlider3->SetNumTicks(5);
  59. }
  60. //-----------------------------------------------------------------------------
  61. // Purpose: Destructor
  62. //-----------------------------------------------------------------------------
  63. SampleSliders::~SampleSliders()
  64. {
  65. }
  66. Panel* SampleSliders_Create(Panel *parent)
  67. {
  68. return new SampleSliders(parent, "Slider Bars");
  69. }