Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
7225 leency 1
:struct more_less_box
2
{
3
	signed x,y;
4
	unsigned value, min, max;
5
	unsigned bt_id_more, bt_id_less;
6
	dword text;
7227 leency 7
	int click_delta;
7225 leency 8
	bool click();
9
	void draw();
10
};
11
 
12
:bool more_less_box::click(unsigned id)
13
{
7227 leency 14
	if (!click_delta) click_delta = 1;
15
	if (id==bt_id_less) { value = math.max(value-click_delta, min); draw(); return 1; }
16
	if (id==bt_id_more) { value = math.min(value+click_delta, max); draw(); return 1; }
7225 leency 17
	return 0;
18
}
19
 
20
:void more_less_box::draw()
21
{
22
	#define VALUE_FIELD_W 34
23
	#define SIZE 18
24
	dword value_text = itoa(value);
25
 
26
	DrawRectangle(x, y, VALUE_FIELD_W+1, SIZE, system.color.work_graph);
27
	DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff);
28
	DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff);
29
	WriteText( -strlen(value_text)+3*8 + x+6, SIZE / 2 + y -6, 0x90, 0x333333, value_text);
30
 
31
	DrawCaptButton(VALUE_FIELD_W + x + 1,    y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+");
32
	DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-");
33
	EDI = system.color.work;
34
	WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text);
35
	DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light);
36
}
37
 
38
//OUTDATED: to be removed
39
:void MoreLessBox(dword x,y, bt_id_more, bt_id_less, value, text)
40
{
41
	#define VALUE_FIELD_W 34
42
	#define SIZE 18
43
	dword value_text = itoa(value);
44
 
45
	DrawRectangle(x, y, VALUE_FIELD_W+1, SIZE, system.color.work_graph);
46
	DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff);
47
	DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff);
48
	WriteText( -strlen(value_text)+3*8 + x+6, SIZE / 2 + y -6, 0x90, 0x333333, value_text);
49
 
50
	DrawCaptButton(VALUE_FIELD_W + x + 1,    y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+");
51
	DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-");
52
	EDI = system.color.work;
53
	WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text);
54
	DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light);
55
}