Subversion Repositories Kolibri OS

Rev

Rev 7243 | Rev 7373 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7243 Rev 7244
Line 31... Line 31...
31
	0x04, 0xF9, 0x98, 0x04, 0xFC, 0xB4, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 
31
	0x04, 0xF9, 0x98, 0x04, 0xFC, 0xB4, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 
32
	0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 
32
	0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 
33
	0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04
33
	0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04
34
};
34
};
Line 35... Line 35...
35
 
35
 
36
:void CheckBox(dword x,y,bt_id, text, is_checked)
36
struct checkbox
-
 
37
{
-
 
38
	dword text;
-
 
39
	bool checked;
-
 
40
	bool disabled;
-
 
41
	dword x,y, id;
-
 
42
	bool click();
-
 
43
	void draw();
-
 
44
	void redraw();
-
 
45
};
-
 
46
 
-
 
47
:bool checkbox::click(dword _id)
-
 
48
{
-
 
49
	if (disabled) return 0;
37
{
50
	if (_id == id) {
-
 
51
		checked^=1; 
-
 
52
		redraw(); 
-
 
53
		return 1;		
-
 
54
	}
-
 
55
	return 0;
-
 
56
}
-
 
57
 
-
 
58
:void checkbox::draw(dword _x,_y)
-
 
59
{
-
 
60
	#define SIZE 14
-
 
61
	if (!id) id = GetFreeButtonId();
-
 
62
	x=_x; y=_y;
38
	byte w=14, h=14;
63
 
39
	DefineButton(x-1, y-1, strlen(text)*8 + w + 17, h+2, bt_id+BT_HIDE+BT_NOFRAME, 0);
64
	DefineButton(x-1, y-1, strlen(text)*8 + SIZE + 17, SIZE+2, id+BT_HIDE+BT_NOFRAME, 0);
40
	EDI = system.color.work;
65
	EDI = system.color.work;
41
	WriteText(x+w+8, h / 2 + y -7, 0xD0, system.color.work_text, text);
66
	WriteText(x+SIZE+8, SIZE / 2 + y -7, 0xD0, system.color.work_text, text);
42
	DrawRectangle(x, y, w, h, system.color.work_graph);
67
	DrawRectangle(x, y, SIZE, SIZE, system.color.work_graph);
43
	if (is_checked == 0)
68
	if (checked == 0)
44
	{
69
	{
45
		DrawRectangle3D(x+1, y+1, w-2, h-2, 0xDDDddd, 0xffffff);
70
		DrawRectangle3D(x+1, y+1, SIZE-2, SIZE-2, 0xDDDddd, 0xffffff);
46
		DrawBar(x+2, y+2, w-3, h-3, 0xffffff);
71
		DrawBar(x+2, y+2, SIZE-3, SIZE-3, 0xffffff);
47
	} 
72
	} 
48
	else if (is_checked == 1)
73
	else if (checked == 1)
49
	{
74
	{
50
		DrawWideRectangle(x+1, y+1, w-1, h-1, 2, 0xffffff);
75
		DrawWideRectangle(x+1, y+1, SIZE-1, SIZE-1, 2, 0xffffff);
51
		_PutImage(x+1, y+1, 13, 13, #checkbox_flag);
76
		_PutImage(x+1, y+1, 13, 13, #checkbox_flag);
52
	}
77
	}
53
	else if (is_checked == 2) //not active
78
	else if (checked == 2) //not active
54
	{
79
	{
55
		DrawWideRectangle(x+1, y+1, w-1, h-1, 2, 0xffffff);
80
		DrawWideRectangle(x+1, y+1, SIZE-1, SIZE-1, 2, 0xffffff);
-
 
81
		DrawBar(x+3, y+3, SIZE-5, SIZE-5, 0x888888);
-
 
82
	}
56
		DrawBar(x+3, y+3, w-5, h-5, 0x888888);
83
	DrawRectangle3D(x-1,y-1,SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light);
-
 
84
}
57
	}
85
 
-
 
86
:void checkbox::redraw()
-
 
87
{
58
	DrawRectangle3D(x-1,y-1,w+2,h+2,system.color.work_dark,system.color.work_light);
88
	draw(x,y);