summaryrefslogtreecommitdiff
path: root/utils/vgui_panel_zoo/DefaultColors.cpp
blob: c62ef927b40759bb26cc45350eefaf1b2dd66dea (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//
#include "DemoPage.h"

#include <VGUI/IVGui.h>
#include <Keyvalues.h>
#include <vgui_controls/Controls.h>
#include <vgui_controls/Panel.h>
#include <vgui/IScheme.h>
#include <Color.h>
#include <stdio.h>

using namespace vgui;

Color colors[] = {
	Color(0,0,0),
	Color(30, 30, 30),
	Color(45, 49, 40),
	Color(62, 70, 55),
	Color(76, 88, 68),
	Color(100, 120, 100),
	Color(136, 145, 128),
	Color(160, 170, 149),
	Color(216, 222, 211),
	Color(255, 255, 255),
	Color(149, 136, 49),
	Color(196, 181, 80)
};
	


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

		void Paint();
	private:
		Panel *m_pColorPanel[12];

};

//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
DefaultColors::DefaultColors(Panel *parent, const char *name) : DemoPage(parent, name)
{
	char buf[32];
	for (int i=1; i<=12; i++)
	{
		sprintf(buf, "ColorPanel%d", i);
		m_pColorPanel[i-1] = new Panel (this, buf);
	}
	LoadControlSettings("Demo/DefaultColors.res");

}

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


//-----------------------------------------------------------------------------
// Purpose: Apply settings
//-----------------------------------------------------------------------------
void DefaultColors::Paint()
{
	for (int i=0; i<12; i++)
	{
		IScheme *pScheme = scheme()->GetIScheme( m_pColorPanel[i]->GetScheme() );
		m_pColorPanel[i]->SetBorder(pScheme->GetBorder("DefaultBorder"));
		m_pColorPanel[i]->SetBgColor(colors[i]);
	}

	Panel::Paint();
}


Panel* DefaultColors_Create(Panel *parent)
{
	return new DefaultColors(parent, "Default Colors");
}