Subversion Repositories Kolibri OS

Rev

Rev 7291 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7291 Rev 7293
Line 7... Line 7...
7
	int x[4096], y[4096], w[4096], h[4096];
7
	int x[4096], y[4096], w[4096], h[4096];
8
	collection text;
8
	collection text;
9
	collection url;
9
	collection url;
10
	void clear();
10
	void clear();
11
	void add();
11
	void add();
-
 
12
	dword get_active_url();
-
 
13
	void draw_underline();
12
	int hover();
14
	int hover();
13
	int active;
15
	int active;
14
	void draw_underline();
-
 
15
} link;
16
} link;
Line 16... Line 17...
16
 
17
 
17
void _link::clear()
18
void _link::clear()
18
{
19
{
Line 31... Line 32...
31
	text.add(_textt);
32
	text.add(_textt);
32
	url.add(_urll);
33
	url.add(_urll);
33
	count++;
34
	count++;
34
}
35
}
Line -... Line 36...
-
 
36
 
-
 
37
dword _link::get_active_url()
-
 
38
{
-
 
39
	return url.get(active);
-
 
40
}
35
 
41
 
36
void _link::draw_underline(dword i, color)
42
void _link::draw_underline(dword i, color)
37
{
43
{
38
	DrawBar(x[i]+list.x, -list.first*list.item_h+y[i]+list.y+h[i]-1, w[i], 1, color);
44
	DrawBar(x[i]+list.x, -list.first*list.item_h+y[i]+list.y+h[i]-2, w[i], 1, color);
Line 39... Line 45...
39
}
45
}
40
 
46
 
41
int _link::hover()
47
int _link::hover(dword mouse_x, mouse_y)
42
{
48
{
43
	int i;
49
	int i;
44
	int new_active = -1;
50
	int new_active = -1;
45
	int link_start_y = list.first*list.item_h;
51
	int link_start_y = list.first*list.item_h;
46
	mouse.x = mouse.x - list.x;
52
	mouse_x -= list.x;
47
	mouse.y = mouse.y - list.y;
53
	mouse_y -= list.y;
48
	for (i=0; i
54
	for (i=0; i
49
		if(y[i] > link_start_y) && (y[i] < link_start_y+list.h) {
55
		if(y[i] > link_start_y) && (y[i] < link_start_y+list.h) {
50
			// debugln( sprintf(#param, "mx:%i my:%i x[i]:%i y[i]:%i", mx, my, x[i], y[i]) );
56
			// debugln( sprintf(#param, "mx:%i my:%i x[i]:%i y[i]:%i", mx, my, x[i], y[i]) );
51
			if (mouse.x > x[i]) 
57
			if (mouse_x > x[i]) 
52
			&& (mouse.x < x[i]+w[i]) 
58
			&& (mouse_x < x[i]+w[i]) 
53
			&& (mouse.y > y[i]-link_start_y)
59
			&& (mouse_y > y[i]-link_start_y)
54
			&& (mouse.y < h[i]-link_start_y+link.y[i]) {
60
			&& (mouse_y < h[i]-link_start_y+link.y[i]) {
55
				new_active = i;
61
				new_active = i;
56
				break;
62
				break;
57
			}
63
			}