| 1 |
|
| 2 |
#include "precomp.h" |
| 3 |
#include "form_view.h" |
| 4 |
|
| 5 |
///////////////////////////////////////////////////////////////////////////// |
| 6 |
// FormView construction: |
| 7 |
|
| 8 |
FormView::FormView(const CL_Rect &pos, CL_Component *parent) |
| 9 |
: CL_Component(pos, parent) |
| 10 |
{ |
| 11 |
slots.connect(sig_paint(), this, &FormView::on_paint); |
| 12 |
} |
| 13 |
|
| 14 |
FormView::~FormView() |
| 15 |
{ |
| 16 |
} |
| 17 |
|
| 18 |
///////////////////////////////////////////////////////////////////////////// |
| 19 |
// FormView attributes: |
| 20 |
|
| 21 |
|
| 22 |
///////////////////////////////////////////////////////////////////////////// |
| 23 |
// FormView operations: |
| 24 |
|
| 25 |
|
| 26 |
///////////////////////////////////////////////////////////////////////////// |
| 27 |
// FormView implementation: |
| 28 |
|
| 29 |
void FormView::on_paint() |
| 30 |
{ |
| 31 |
int width = get_width(); |
| 32 |
int height = get_height(); |
| 33 |
|
| 34 |
CL_Display::fill_rect(CL_Rect(1, 1, width-1, 20), CL_Color(240,240,240)); |
| 35 |
CL_Display::fill_rect(CL_Rect(1, 1, 20, height-1), CL_Color(240,240,240)); |
| 36 |
CL_Display::draw_line(20, 20, width-1, 20, CL_Color(128, 142, 159)); |
| 37 |
CL_Display::draw_line(20, 20, 20, height-1, CL_Color(128, 142, 159)); |
| 38 |
|
| 39 |
for (int x=0; x<width-21; x+=5) |
| 40 |
{ |
| 41 |
switch (x % 100) |
| 42 |
{ |
| 43 |
case 0: |
| 44 |
CL_Display::draw_line(20+x, 10, 20+x, 20, CL_Color(128, 142, 159)); |
| 45 |
break; |
| 46 |
|
| 47 |
case 50: |
| 48 |
CL_Display::draw_line(20+x, 13, 20+x, 20, CL_Color(128, 142, 159)); |
| 49 |
break; |
| 50 |
|
| 51 |
case 25: |
| 52 |
case 75: |
| 53 |
CL_Display::draw_line(20+x, 15, 20+x, 20, CL_Color(128, 142, 159)); |
| 54 |
break; |
| 55 |
|
| 56 |
default: |
| 57 |
CL_Display::draw_line(20+x, 17, 20+x, 20, CL_Color(128, 142, 159)); |
| 58 |
break; |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
for (int y=0; y<height-21; y+=5) |
| 63 |
{ |
| 64 |
switch (y % 100) |
| 65 |
{ |
| 66 |
case 0: |
| 67 |
CL_Display::draw_line(10, 20+y, 20, 20+y, CL_Color(128, 142, 159)); |
| 68 |
break; |
| 69 |
|
| 70 |
case 50: |
| 71 |
CL_Display::draw_line(13, 20+y, 20, 20+y, CL_Color(128, 142, 159)); |
| 72 |
break; |
| 73 |
|
| 74 |
case 25: |
| 75 |
case 75: |
| 76 |
CL_Display::draw_line(15, 20+y, 20, 20+y, CL_Color(128, 142, 159)); |
| 77 |
break; |
| 78 |
|
| 79 |
default: |
| 80 |
CL_Display::draw_line(17, 20+y, 20, 20+y, CL_Color(128, 142, 159)); |
| 81 |
break; |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
CL_Display::fill_rect(CL_Rect(21, 21, 400, 300), CL_Color::white); |
| 86 |
for (int x=0; x<400-20; x+=5) CL_Display::draw_line(400-x, 300, 400-x-2, 300, CL_Color::black); |
| 87 |
for (int y=0; y<300-20; y+=5) CL_Display::draw_line(400, 300-y, 400, 300-y-2, CL_Color::black); |
| 88 |
|
| 89 |
// CL_Display::fill_rect(CL_Rect(400/2-3, 300-3, 400/2+2, 300+2), CL_Color::black); |
| 90 |
// CL_Display::fill_rect(CL_Rect(400-3, 300/2-3, 400+2, 300/2+2), CL_Color::black); |
| 91 |
// CL_Display::fill_rect(CL_Rect(400-3, 300-3, 400+2, 300+2), CL_Color::black); |
| 92 |
|
| 93 |
CL_Display::draw_rect(CL_Rect(0, 0, width, height), CL_Color(128, 142, 159)); |
| 94 |
} |