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.

105 lines
2.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "DemoPage.h"
  8. #include <vgui_controls/ComboBox.h>
  9. #include <vgui_controls/Label.h>
  10. using namespace vgui;
  11. class SampleDropDowns: public DemoPage
  12. {
  13. public:
  14. SampleDropDowns(Panel *parent, const char *name);
  15. ~SampleDropDowns();
  16. private:
  17. ComboBox *m_pNormal;
  18. ComboBox *m_pNormalScroll;
  19. ComboBox *m_pNormal2;
  20. ComboBox *m_pNormal3;
  21. Label *m_pLabel1;
  22. Label *m_pLabel2;
  23. Label *m_pLabel3;
  24. Label *m_pLabel4;
  25. };
  26. //-----------------------------------------------------------------------------
  27. // Purpose: Constructor
  28. //-----------------------------------------------------------------------------
  29. SampleDropDowns::SampleDropDowns(Panel *parent, const char *name) : DemoPage(parent, name)
  30. {
  31. m_pNormal = new ComboBox(this, "Pills", 6, false);
  32. m_pNormal->SetPos(90, 25);
  33. m_pNormal->SetWide(80);
  34. m_pNormal->AddItem("Red Pill", NULL );
  35. m_pNormal->AddItem("Blue Pill", NULL );
  36. m_pNormal->AddItem("ReallyLongName Pill", NULL );
  37. m_pNormal->ActivateItem(0);
  38. m_pLabel1 = new Label (this, "WhichLabel", "Which");
  39. m_pLabel1->SizeToContents();
  40. m_pLabel1->SetPos(43, 25);
  41. m_pNormalScroll = new ComboBox(this, "Moves", 6, false);
  42. m_pNormalScroll->SetPos(243, 25);
  43. m_pNormalScroll->SetWide(130);
  44. m_pNormalScroll->AddItem("Freezes", NULL );
  45. m_pNormalScroll->AddItem("Kipup", NULL );
  46. m_pNormalScroll->AddItem("Donkey", NULL );
  47. m_pNormalScroll->AddItem("Sidewinder", NULL );
  48. m_pNormalScroll->AddItem("Handspin", NULL );
  49. m_pNormalScroll->AddItem("Coffee Grinder", NULL );
  50. m_pNormalScroll->AddItem("Headspin", NULL );
  51. m_pNormalScroll->AddItem("The Worm", NULL );
  52. m_pNormalScroll->ActivateItem(6);
  53. m_pLabel2 = new Label (this, "MoveLabel", "Move");
  54. m_pLabel2->SizeToContents();
  55. m_pLabel2->SetPos(200, 25);
  56. m_pNormal2 = new ComboBox(this, "Pills2", 6, false);
  57. m_pNormal2->SetPos(90, 125);
  58. m_pNormal2->SetWide(80);
  59. m_pNormal2->AddItem("one", NULL );
  60. m_pNormal2->AddItem("two", NULL );
  61. m_pNormal2->ActivateItem(1);
  62. m_pLabel3 = new Label (this, "ALabel", "Label on top");
  63. m_pLabel3->SizeToContents();
  64. m_pLabel3->SetPos(90, 100);
  65. m_pNormal3 = new ComboBox(this, "Pills", 6, false);
  66. m_pNormal3->SetPos(90, 200);
  67. m_pNormal3->SetWide(80);
  68. m_pNormal3->AddItem("one", NULL );
  69. m_pNormal3->AddItem("two", NULL );
  70. m_pNormal3->ActivateItem(0);
  71. m_pNormal3->SetEnabled(false);
  72. m_pLabel4 = new Label (this, "DLabel", "Disabled");
  73. m_pLabel4->SetPos(90, 175);
  74. m_pLabel4->SizeToContents();
  75. m_pLabel4->SetEnabled(false);
  76. }
  77. //-----------------------------------------------------------------------------
  78. // Purpose: Destructor
  79. //-----------------------------------------------------------------------------
  80. SampleDropDowns::~SampleDropDowns()
  81. {
  82. }
  83. Panel* SampleDropDowns_Create(Panel *parent)
  84. {
  85. return new SampleDropDowns(parent, "Drop-downs");
  86. }