Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
4491 leency 1
struct array_link {
2
	dword link, text;
3
	int x,y,w,h;
4
};
4488 leency 5
 
6
struct LinksArray
7
{
4491 leency 8
	array_link links[100];
4488 leency 9
	char page_links[12000];
4491 leency 10
	dword buflen;
11
	int count, active;
12
 
13
	void Hover();
14
	void AddLink();
15
	void AddText();
4488 leency 16
	dword GetURL();
17
	void Clear();
4491 leency 18
};
4488 leency 19
 
4491 leency 20
void LinksArray::AddLink(dword new_link, int link_x, link_y)
4488 leency 21
{
4491 leency 22
	links[count].x = link_x;
23
	links[count].y = link_y;
24
 
25
	links[count].link = buflen;
26
	strcpy(buflen, new_link);
27
	buflen += strlen(new_link)+1;
28
	count++;
4488 leency 29
}
30
 
4491 leency 31
void LinksArray::AddText(dword new_text, int link_w, link_h)
32
{
33
	if (count<1) return;
34
	links[count-1].w = link_w;
35
	links[count-1].h = link_h;
36
 
37
	links[count-1].text = buflen;
38
	strcpy(buflen, new_text);
39
	buflen += strlen(new_text)+1;
40
}
41
 
4488 leency 42
dword LinksArray::GetURL(int id)
43
{
4491 leency 44
	return links[id].link;
45
}
46
 
47
void LinksArray::Clear()
48
{
49
	buflen = #page_links;
50
	count = 0;
51
	active = -1;
52
}
53
 
54
void LinksArray::Hover(dword mx, my, link_col_in, link_col_a)
55
{
56
	int i;
57
	if (active>=0)
4488 leency 58
	{
4491 leency 59
		WriteText(links[active].x,links[active].y, 0x80, link_col_in, links[active].text);
60
		DrawBar(links[active].x,links[active].y+8,links[active].w,1, link_col_in);
61
		active = -1;
62
	}
63
	for (i=0; i
64
	{
65
		if (mx>links[i].x) && (my>links[i].y) && (mx
4488 leency 66
		{
4491 leency 67
			WriteText(links[i].x,links[i].y, 0x80, link_col_a, links[i].text);
68
			DrawBar(links[i].x,links[i].y+8,links[i].w,1, link_col_a);
69
			active = i;
70
			return;
4488 leency 71
		}
72
	}
73
}
74
 
4491 leency 75
 
76
LinksArray PageLinks;