Rev 3110 | Rev 3225 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3107 | leency | 1 | //#include "strings.h" |
2 | |||
3067 | leency | 3 | void DrawRectangle(dword x,y,width,height,color1) |
4 | { |
||
5 | DrawBar(x,y,width,1,color1); |
||
6 | DrawBar(x,y+height,width,1,color1); |
||
7 | DrawBar(x,y,1,height,color1); |
||
8 | DrawBar(x+width,y,1,height+1,color1); |
||
9 | } |
||
10 | |||
11 | void DrawRectangle3D(dword x,y,width,height,color1,color2) |
||
12 | { |
||
13 | DrawBar(x,y,width+1,1,color1); |
||
14 | DrawBar(x,y+1,1,height-1,color1); |
||
15 | DrawBar(x+width,y+1,1,height,color2); |
||
16 | DrawBar(x,y+height,width,1,color2); |
||
17 | } |
||
18 | |||
3110 | leency | 19 | void DrawCaptButton(dword x,y,width,height,id,color_b, color_t,text) |
3067 | leency | 20 | { |
3076 | leency | 21 | DefineButton(x,y,width,height,id,color_b); |
3110 | leency | 22 | WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,color_t,text); |
3067 | leency | 23 | } |
24 | |||
25 | void DrawCircle(int x, y, r) |
||
26 | { |
||
27 | int i; |
||
28 | float px=0, py=r, ii = r * 3.1415926 * 2; |
||
29 | FOR (i = 0; i < ii; i++) |
||
30 | { |
||
31 | PutPixel(px + x, y - py, 0); |
||
32 | px = py / r + px; |
||
33 | py = -px / r + py; |
||
34 | } |
||
3076 | leency | 35 | } |
3106 | leency | 36 | |
37 | void CheckBox(dword x,y,w,h, bt_id, text, graph_color, text_color, is_checked) |
||
38 | { |
||
39 | DefineButton(x-1, y-1, strlen(text)*6 + w + 17, h+2, bt_id+BT_HIDE+BT_NOFRAME, graph_color); |
||
40 | WriteText(x+w+10, h / 2 + y -3, 0x80, text_color, text); |
||
41 | DrawRectangle(x, y, w, h, graph_color); |
||
42 | if (is_checked == 1) |
||
43 | { |
||
44 | DrawRectangle(x+1, y+1, w-2, h-2, 0xffffff); |
||
45 | DrawBar(x+2, y+2, w-3, h-3, graph_color); |
||
46 | return; //не дадим стрелять себе в ногу |
||
47 | } |
||
48 | if (is_checked == 2) //not active |
||
49 | { |
||
50 | DrawRectangle(x+1, y+1, w-2, h-2, 0xffffff); |
||
51 | DrawBar(x+2, y+2, w-3, h-3, 0x888888); |
||
52 | return; |
||
53 | } |
||
54 | else |
||
55 | { |
||
56 | DrawRectangle3D(x+1, y+1, w-2, h-2, 0xDDDddd, 0xffffff); |
||
57 | DrawBar(x+2, y+2, w-3, h-3, 0xffffff); |
||
58 | } |
||
3114 | leency | 59 | } |
60 | |||
61 | void DrawProgressBar(dword st_x, st_y, st_w, st_h, col_fon, col_border, col_fill, col_text, progress_percent, status_text) |
||
62 | { |
||
63 | int progress_w = progress_percent * st_w / 100 - 3; |
||
64 | static int fill_old; |
||
65 | |||
66 | if (!progress_percent) {DrawBar(st_x,st_y, st_x + st_y + fill_old + 15,st_h+1, col_fon); return;} |
||
67 | |||
68 | DrawRectangle(st_x, st_y, st_w,st_h, col_border); |
||
69 | DrawRectangle3D(st_x+1, st_y+1, st_w-2,st_h-2, 0xFFFfff, 0xFFFfff); |
||
70 | if (progress_percent) DrawBar(st_x+2, st_y+2, progress_w, st_h-3, col_fill); |
||
71 | if (progress_percent<100) DrawBar(st_x+2+progress_w, st_y+2, st_w-progress_w-3, st_h-3, 0xFFFfff); |
||
72 | |||
73 | if (status_text) |
||
74 | { |
||
75 | DrawBar(st_x+st_w+15, st_h/2-4+st_y, fill_old, 9, col_fon); |
||
76 | WriteText(st_x+st_w+15, st_h/2-4+st_y, 0x80, col_text, status_text); |
||
77 | fill_old = strlen(status_text) * 6; |
||
78 | } |
||
3106 | leency | 79 | }100)>> |