summaryrefslogtreecommitdiff
path: root/utils/vgui_panel_zoo/SampleListPanelBoth.cpp
blob: 9e43555fa8fa3db8cf3d59f61919b099c275f2ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//
#include "DemoPage.h"

#include "vgui/IVGui.h"
#include "vgui_controls/Controls.h"
#include "tier1/KeyValues.h"
#include "vgui_controls/SectionedListPanel.h"


using namespace vgui;


class SampleListPanelBoth: public DemoPage
{
	public:
		SampleListPanelBoth(Panel *parent, const char *name);
		~SampleListPanelBoth();

		void onButtonClicked();
	
	private:
		SectionedListPanel *m_pSectionedListPanel;
		
};

//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
SampleListPanelBoth::SampleListPanelBoth(Panel *parent, const char *name) : DemoPage(parent, name)
{
	// Create a list panel.
	m_pSectionedListPanel = new SectionedListPanel(this, "AListPanel");

	// Add a new section
	m_pSectionedListPanel->AddSection(0, "LIST ITEMS");
	m_pSectionedListPanel->AddColumnToSection(0, "items", "items", 0, 150 );

	// Add items to the list
	KeyValues *data = new KeyValues ("items");
	data->SetString("items", "Many actions");
	m_pSectionedListPanel->AddItem(0, data);

	data->SetString("items", "Performed on");
	m_pSectionedListPanel->AddItem(0, data);

	data->SetString("items", "List items can");
	m_pSectionedListPanel->AddItem(0, data);

	data->SetString("items", "Only be accessed");
	m_pSectionedListPanel->AddItem(0, data);

	data->SetString("items", "Using the right-");
	m_pSectionedListPanel->AddItem(0, data);

	data->SetString("items", "Click menu");
	m_pSectionedListPanel->AddItem(0, data);

	// Add a new section
	//m_pSectionedListPanel->AddSection(1, "RIGHT CLICK");
	m_pSectionedListPanel->AddColumnToSection(0, "items", "items", 0, 150 );

	// Add items to the list
	data->SetString("items", "Right-click the item");
	m_pSectionedListPanel->AddItem(1, data);

	data->SetString("items", "To access its");
	m_pSectionedListPanel->AddItem(1, data);

	data->SetString("items", "List of associated");
	m_pSectionedListPanel->AddItem(1, data);

	data->SetString("items", "Commands");
	m_pSectionedListPanel->AddItem(1, data);


	// Add a new section
	m_pSectionedListPanel->AddSection(2, "RIGHT CLICK");
	m_pSectionedListPanel->AddColumnToSection(2, "items", "items", 0, 150);

	// Add items to the list
	data->SetString("items", "Right-click the item");
	m_pSectionedListPanel->AddItem(2, data);

	data->SetString("items", "To access its");
	m_pSectionedListPanel->AddItem(2, data);

	data->SetString("items", "List of associated");
	m_pSectionedListPanel->AddItem(2, data);

	data->SetString("items", "Commands");
	m_pSectionedListPanel->AddItem(2, data);


	// Set its position.
	m_pSectionedListPanel->SetPos(90, 25);
	m_pSectionedListPanel->SetSize(200, 150);
	
}

//-----------------------------------------------------------------------------
// Purpose: Destructor
//-----------------------------------------------------------------------------
SampleListPanelBoth::~SampleListPanelBoth()
{
}




Panel* SampleListPanelBoth_Create(Panel *parent)
{
	return new SampleListPanelBoth(parent, "List Panel - both");
}