| 1 |
|
| 2 |
#include "precomp.h" |
| 3 |
#include "property_list.h" |
| 4 |
|
| 5 |
///////////////////////////////////////////////////////////////////////////// |
| 6 |
// PropertyList construction: |
| 7 |
|
| 8 |
PropertyList::PropertyList(const CL_Rect &pos, CL_Component *parent) |
| 9 |
: CL_Component(pos, parent) |
| 10 |
{ |
| 11 |
font = new CL_Font("ListBox/font", get_style_manager()->get_resources()); |
| 12 |
|
| 13 |
properties.push_back(Property("name", "label_title")); |
| 14 |
properties.push_back(Property("x", "20")); |
| 15 |
properties.push_back(Property("y", "20")); |
| 16 |
properties.push_back(Property("width", "500")); |
| 17 |
properties.push_back(Property("height", "17")); |
| 18 |
properties.push_back(Property("text", "Welcome to the CTalk IRC Client.")); |
| 19 |
|
| 20 |
slots.connect(sig_paint(), this, &PropertyList::on_paint); |
| 21 |
} |
| 22 |
|
| 23 |
PropertyList::~PropertyList() |
| 24 |
{ |
| 25 |
delete font; |
| 26 |
} |
| 27 |
|
| 28 |
///////////////////////////////////////////////////////////////////////////// |
| 29 |
// PropertyList attributes: |
| 30 |
|
| 31 |
|
| 32 |
///////////////////////////////////////////////////////////////////////////// |
| 33 |
// PropertyList operations: |
| 34 |
|
| 35 |
|
| 36 |
///////////////////////////////////////////////////////////////////////////// |
| 37 |
// PropertyList implementation: |
| 38 |
|
| 39 |
void PropertyList::on_paint() |
| 40 |
{ |
| 41 |
int width = get_width(); |
| 42 |
int height = get_height(); |
| 43 |
|
| 44 |
CL_Display::fill_rect(CL_Rect(0, 0, width, height), CL_Color::white); |
| 45 |
CL_Display::draw_rect(CL_Rect(0, 0, width, height), CL_Color(128, 142, 159)); |
| 46 |
|
| 47 |
CL_Display::draw_line(width/2, 0, width/2, height, CL_Color(128, 142, 159)); |
| 48 |
|
| 49 |
for (std::vector<Property>::size_type y=0; y<properties.size(); y++) |
| 50 |
{ |
| 51 |
font->draw(5, y*20+5, properties[y].first); |
| 52 |
font->draw(width/2+5, y*20+5, properties[y].second); |
| 53 |
CL_Display::draw_line(0, (y+1)*20, width, (y+1)*20, CL_Color(128, 142, 159)); |
| 54 |
} |
| 55 |
} |