Subversion Repositories Kolibri OS

Rev

Rev 4550 | 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
 
4550 leency 4
#define NOLINE    0
5
#define UNDERLINE 1
6
 
7
 
4491 leency 8
struct array_link {
9
	dword link, text;
10
	int x,y,w,h;
4550 leency 11
	int underline;
4491 leency 12
};
4488 leency 13
 
14
struct LinksArray
15
{
4493 leency 16
	array_link links[200];
17
	char page_links[64000];
4491 leency 18
	dword buflen;
19
	int count, active;
20
 
21
	void Hover();
22
	void AddLink();
23
	void AddText();
4488 leency 24
	dword GetURL();
25
	void Clear();
4491 leency 26
};
4488 leency 27
 
4491 leency 28
void LinksArray::AddLink(dword new_link, int link_x, link_y)
4488 leency 29
{
4491 leency 30
	links[count].x = link_x;
31
	links[count].y = link_y;
32
 
33
	links[count].link = buflen;
34
	strcpy(buflen, new_link);
35
	buflen += strlen(new_link)+1;
36
	count++;
4488 leency 37
}
38
 
4550 leency 39
void LinksArray::AddText(dword new_text, int link_w, link_h, link_underline)
4491 leency 40
{
41
	if (count<1) return;
42
	links[count-1].w = link_w;
43
	links[count-1].h = link_h;
4550 leency 44
	links[count-1].underline = link_underline;
4491 leency 45
 
46
	links[count-1].text = buflen;
47
	strcpy(buflen, new_text);
48
	buflen += strlen(new_text)+1;
49
}
50
 
4488 leency 51
dword LinksArray::GetURL(int id)
52
{
4491 leency 53
	return links[id].link;
54
}
55
 
56
void LinksArray::Clear()
57
{
4493 leency 58
	int i;
59
	for (i=0; i<=count; i++) DeleteButton(i+400);
4491 leency 60
	buflen = #page_links;
61
	count = 0;
62
	active = -1;
4497 leency 63
	CursorPointer.Restore();
4491 leency 64
}
65
 
4677 leency 66
char temp[4096];
67
PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, #temp, 0};
4497 leency 68
 
4492 leency 69
void LinksArray::Hover(dword mx, my, link_col_in, link_col_a, bg_col)
4491 leency 70
{
71
	int i;
72
	for (i=0; i
73
	{
74
		if (mx>links[i].x) && (my>links[i].y) && (mx
4488 leency 75
		{
4497 leency 76
			if (active==i) return;
77
			CursorPointer.Set();
4550 leency 78
			if (links[active].underline) DrawBar(links[active].x,links[active].y+8,links[active].w,1, link_col_in);
79
			if (links[i].underline) DrawBar(links[i].x,links[i].y+8,links[i].w,1, bg_col);
4491 leency 80
			active = i;
4677 leency 81
			DrawBar(progress_bar.left+progress_bar.width+10, progress_bar.top+2, Form.cwidth-progress_bar.left-progress_bar.width-10, 9, col_bg);
82
			status_text.start_x = progress_bar.left+progress_bar.width+10;
83
			status_text.start_y = progress_bar.top+2;
84
			status_text.area_size_x = Form.cwidth-progress_bar.left-progress_bar.width-10;
85
			status_text.text_pointer = links[active].link;
86
			PathShow_prepare stdcall(#status_text);
87
			PathShow_draw stdcall(#status_text);
4491 leency 88
			return;
4488 leency 89
		}
90
	}
4497 leency 91
	if (active!=-1)
92
	{
93
		CursorPointer.Restore();
4550 leency 94
		if (links[active].underline) DrawBar(links[active].x,links[active].y+8,links[active].w,1, link_col_in);
4677 leency 95
		DrawBar(progress_bar.left+progress_bar.width+10, progress_bar.top+2, Form.cwidth-progress_bar.left-progress_bar.width-10, 9, col_bg);
4497 leency 96
		active = -1;
97
	}
4488 leency 98
}
99
 
4491 leency 100
 
4493 leency 101
LinksArray PageLinks;