summaryrefslogtreecommitdiff
path: root/utils/vgui_panel_zoo/ListPanelDemo2.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /utils/vgui_panel_zoo/ListPanelDemo2.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'utils/vgui_panel_zoo/ListPanelDemo2.cpp')
-rw-r--r--utils/vgui_panel_zoo/ListPanelDemo2.cpp99
1 files changed, 99 insertions, 0 deletions
diff --git a/utils/vgui_panel_zoo/ListPanelDemo2.cpp b/utils/vgui_panel_zoo/ListPanelDemo2.cpp
new file mode 100644
index 0000000..6581979
--- /dev/null
+++ b/utils/vgui_panel_zoo/ListPanelDemo2.cpp
@@ -0,0 +1,99 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+#include "DemoPage.h"
+
+#include <VGUI_IVGui.h>
+#include <VGUI_Controls.h>
+#include <VGUI_KeyValues.h>
+#include <VGUI_ListPanel.h>
+
+using namespace vgui;
+
+class ListPanelDemo2: public DemoPage
+{
+ public:
+ ListPanelDemo2(Panel *parent, const char *name);
+ ~ListPanelDemo2();
+
+ void onButtonClicked();
+
+ private:
+ ListPanel *m_pListPanel;
+
+};
+
+//-----------------------------------------------------------------------------
+// Purpose: Constructor
+//-----------------------------------------------------------------------------
+ListPanelDemo2::ListPanelDemo2(Panel *parent, const char *name) : DemoPage(parent, name)
+{
+ // Create a list panel.
+ m_pListPanel = new ListPanel(this, "AListPanel");
+
+ // Add a column header
+ m_pListPanel->addColumnHeader(0, "Muppet", "Muppet", 150, true, 20, 200, true);
+
+ // Add another column header
+ m_pListPanel->addColumnHeader(1, "Description", "Description", 150, true, 20, 200, true);
+
+ // Set its position.
+ m_pListPanel->setPos(90, 25);
+ m_pListPanel->setSize(400, 250);
+
+ // Add rows of data to the table
+ KeyValues *data = new KeyValues ("item");
+ data->SetString("Muppet", "Kermit");
+ data->SetString("Description", "The frog");
+ m_pListPanel->addItem(data);
+
+ data->SetString("Muppet", "Miss Piggy");
+ data->SetString("Description", "The diva");
+ m_pListPanel->addItem(data);
+
+ data->SetString("Muppet", "Scooter");
+ data->SetString("Description", "The man");
+ m_pListPanel->addItem(data);
+
+ data->SetString("Muppet", "Statler");
+ data->SetString("Description", "Old guy");
+ m_pListPanel->addItem(data);
+
+ data->SetString("Muppet", "Waldorf");
+ data->SetString("Description", "Old guy");
+ m_pListPanel->addItem(data);
+
+ data->SetString("Muppet", "Gonzo");
+ data->SetString("Description", "The unknown");
+ m_pListPanel->addItem(data);
+
+ data->SetString("Muppet", "Scooter");
+ data->SetString("Description", "The man");
+ m_pListPanel->addItem(data);
+
+ data->SetString("Muppet", "Fozzie");
+ data->SetString("Description", "The bear");
+ m_pListPanel->addItem(data);
+
+ data->SetString("Muppet", "Betty Lou");
+ data->SetString("Description", "[none]");
+ m_pListPanel->addItem(data);
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Destructor
+//-----------------------------------------------------------------------------
+ListPanelDemo2::~ListPanelDemo2()
+{
+}
+
+
+Panel* ListPanelDemo2_Create(Panel *parent)
+{
+ return new ListPanelDemo2(parent, "ListPanelDemo2");
+}
+
+