File: property_list.cpp

package info (click to toggle)
clanlib 1.0~svn3827-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 24,600 kB
  • sloc: cpp: 101,591; xml: 6,410; makefile: 1,743; ansic: 463; perl: 424; php: 247; sh: 53
file content (55 lines) | stat: -rw-r--r-- 1,669 bytes parent folder | download | duplicates (7)
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

#include "precomp.h"
#include "property_list.h"

/////////////////////////////////////////////////////////////////////////////
// PropertyList construction:

PropertyList::PropertyList(const CL_Rect &pos, CL_Component *parent)
: CL_Component(pos, parent)
{
	font = new CL_Font("ListBox/font", get_style_manager()->get_resources());

	properties.push_back(Property("name", "label_title"));
	properties.push_back(Property("x", "20"));
	properties.push_back(Property("y", "20"));
	properties.push_back(Property("width", "500"));
	properties.push_back(Property("height", "17"));
	properties.push_back(Property("text", "Welcome to the CTalk IRC Client."));

	slots.connect(sig_paint(), this, &PropertyList::on_paint);
}

PropertyList::~PropertyList()
{
	delete font;
}

/////////////////////////////////////////////////////////////////////////////
// PropertyList attributes:


/////////////////////////////////////////////////////////////////////////////
// PropertyList operations:


/////////////////////////////////////////////////////////////////////////////
// PropertyList implementation:

void PropertyList::on_paint()
{
	int width = get_width();
	int height = get_height();

	CL_Display::fill_rect(CL_Rect(0, 0, width, height), CL_Color::white);
	CL_Display::draw_rect(CL_Rect(0, 0, width, height), CL_Color(128, 142, 159));

	CL_Display::draw_line(width/2, 0, width/2, height, CL_Color(128, 142, 159));

	for (std::vector<Property>::size_type y=0; y<properties.size(); y++)
	{
		font->draw(5, y*20+5, properties[y].first);
		font->draw(width/2+5, y*20+5, properties[y].second);
		CL_Display::draw_line(0, (y+1)*20, width, (y+1)*20, CL_Color(128, 142, 159));
	}
}