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