Subversion Repositories Kolibri OS

Rev

Rev 3107 | 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
	}
59
}