Subversion Repositories Kolibri OS

Rev

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

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