Subversion Repositories Kolibri OS

Rev

Rev 3076 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3067 leency 1
void DrawRectangle(dword x,y,width,height,color1)
2
{
3
	DrawBar(x,y,width,1,color1);
4
	DrawBar(x,y+height,width,1,color1);
5
	DrawBar(x,y,1,height,color1);
6
	DrawBar(x+width,y,1,height+1,color1);
7
}
8
 
9
void DrawRectangle3D(dword x,y,width,height,color1,color2)
10
{
11
	DrawBar(x,y,width+1,1,color1);
12
	DrawBar(x,y+1,1,height-1,color1);
13
	DrawBar(x+width,y+1,1,height,color2);
14
	DrawBar(x,y+height,width,1,color2);
15
}
16
 
3076 leency 17
void DrawCaptButton(dword x,y,width,height,id,color_b, color_t,text,text_len)
3067 leency 18
{
3076 leency 19
	DefineButton(x,y,width,height,id,color_b);
3106 leency 20
	WriteText(-text_len*6+width/2+x+1,height/2-3+y,0x80,color_t,text);
3067 leency 21
}
22
 
23
void DrawCircle(int x, y, r)
24
{
25
	int i;
26
	float px=0, py=r, ii = r * 3.1415926 * 2;
27
	FOR (i = 0; i < ii; i++)
28
	{
29
        PutPixel(px + x, y - py, 0);
30
        px = py / r + px;
31
        py = -px / r + py;
32
	}
3076 leency 33
}
3106 leency 34
 
35
void CheckBox(dword x,y,w,h, bt_id, text, graph_color, text_color, is_checked)
36
{
37
	DefineButton(x-1, y-1, strlen(text)*6 + w + 17, h+2, bt_id+BT_HIDE+BT_NOFRAME, graph_color);
38
	WriteText(x+w+10, h / 2 + y -3, 0x80, text_color, text);
39
	DrawRectangle(x, y, w, h, graph_color);
40
	if (is_checked == 1)
41
	{
42
		DrawRectangle(x+1, y+1, w-2, h-2, 0xffffff);
43
		DrawBar(x+2, y+2, w-3, h-3, graph_color);
44
		return; //не дадим стрелять себе в ногу
45
	}
46
	if (is_checked == 2) //not active
47
	{
48
		DrawRectangle(x+1, y+1, w-2, h-2, 0xffffff);
49
		DrawBar(x+2, y+2, w-3, h-3, 0x888888);
50
		return;
51
	}
52
	else
53
	{
54
		DrawRectangle3D(x+1, y+1, w-2, h-2, 0xDDDddd, 0xffffff);
55
		DrawBar(x+2, y+2, w-3, h-3, 0xffffff);
56
	}
57
}