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.

99 lines
2.6 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 <VGUI_Controls.h>
  10. #include <VGUI_KeyValues.h>
  11. #include <VGUI_ListPanel.h>
  12. using namespace vgui;
  13. class ListPanelDemo2: public DemoPage
  14. {
  15. public:
  16. ListPanelDemo2(Panel *parent, const char *name);
  17. ~ListPanelDemo2();
  18. void onButtonClicked();
  19. private:
  20. ListPanel *m_pListPanel;
  21. };
  22. //-----------------------------------------------------------------------------
  23. // Purpose: Constructor
  24. //-----------------------------------------------------------------------------
  25. ListPanelDemo2::ListPanelDemo2(Panel *parent, const char *name) : DemoPage(parent, name)
  26. {
  27. // Create a list panel.
  28. m_pListPanel = new ListPanel(this, "AListPanel");
  29. // Add a column header
  30. m_pListPanel->addColumnHeader(0, "Muppet", "Muppet", 150, true, 20, 200, true);
  31. // Add another column header
  32. m_pListPanel->addColumnHeader(1, "Description", "Description", 150, true, 20, 200, true);
  33. // Set its position.
  34. m_pListPanel->setPos(90, 25);
  35. m_pListPanel->setSize(400, 250);
  36. // Add rows of data to the table
  37. KeyValues *data = new KeyValues ("item");
  38. data->SetString("Muppet", "Kermit");
  39. data->SetString("Description", "The frog");
  40. m_pListPanel->addItem(data);
  41. data->SetString("Muppet", "Miss Piggy");
  42. data->SetString("Description", "The diva");
  43. m_pListPanel->addItem(data);
  44. data->SetString("Muppet", "Scooter");
  45. data->SetString("Description", "The man");
  46. m_pListPanel->addItem(data);
  47. data->SetString("Muppet", "Statler");
  48. data->SetString("Description", "Old guy");
  49. m_pListPanel->addItem(data);
  50. data->SetString("Muppet", "Waldorf");
  51. data->SetString("Description", "Old guy");
  52. m_pListPanel->addItem(data);
  53. data->SetString("Muppet", "Gonzo");
  54. data->SetString("Description", "The unknown");
  55. m_pListPanel->addItem(data);
  56. data->SetString("Muppet", "Scooter");
  57. data->SetString("Description", "The man");
  58. m_pListPanel->addItem(data);
  59. data->SetString("Muppet", "Fozzie");
  60. data->SetString("Description", "The bear");
  61. m_pListPanel->addItem(data);
  62. data->SetString("Muppet", "Betty Lou");
  63. data->SetString("Description", "[none]");
  64. m_pListPanel->addItem(data);
  65. }
  66. //-----------------------------------------------------------------------------
  67. // Purpose: Destructor
  68. //-----------------------------------------------------------------------------
  69. ListPanelDemo2::~ListPanelDemo2()
  70. {
  71. }
  72. Panel* ListPanelDemo2_Create(Panel *parent)
  73. {
  74. return new ListPanelDemo2(parent, "ListPanelDemo2");
  75. }