Subversion Repositories Kolibri OS

Rev

Rev 6795 | 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";
6738 leency 3
#include "..\lib\collection.h"
4497 leency 4
 
4550 leency 5
#define NOLINE    0
6
#define UNDERLINE 1
7
 
6738 leency 8
#define MAXLINKS 400
9
 
4491 leency 10
struct array_link {
6795 leency 11
	dword link;
4491 leency 12
	int x,y,w,h;
6794 leency 13
	int underline, underline_h;
4491 leency 14
};
4488 leency 15
 
5772 leency 16
struct LinksArray {
6738 leency 17
	array_link links[MAXLINKS];
18
	collection page_links;
6795 leency 19
	int count;
20
	int active;
21
	bool HoverAndProceed();
4491 leency 22
	void AddLink();
23
	void AddText();
4488 leency 24
	dword GetURL();
25
	void Clear();
5718 leency 26
} PageLinks;
4488 leency 27
 
6795 leency 28
void LinksArray::AddLink(dword lpath)
4488 leency 29
{
6738 leency 30
	if (count>= MAXLINKS) return;
31
	page_links.add(lpath);
4488 leency 32
}
33
 
6795 leency 34
void LinksArray::AddText(dword _x, _y, _w, _h, _link_underline, _underline_h)
4491 leency 35
{
6795 leency 36
	if (count>= MAXLINKS) return;
37
	links[count].x = _x;
38
	links[count].y = _y;
39
	links[count].w = _w;
40
	links[count].h = _h;
41
	links[count].underline = _link_underline;
42
	links[count].underline_h = _underline_h;
43
	links[count].link = page_links.get(page_links.count-1);
44
	count++;
4491 leency 45
}
46
 
4488 leency 47
dword LinksArray::GetURL(int id)
48
{
4491 leency 49
	return links[id].link;
50
}
51
 
52
void LinksArray::Clear()
53
{
6738 leency 54
	page_links.drop();
55
	page_links.realloc_size = 4096 * 32;
4491 leency 56
	count = 0;
57
	active = -1;
4497 leency 58
	CursorPointer.Restore();
4491 leency 59
}
60
 
4686 leency 61
char temp[sizeof(URL)];
4677 leency 62
PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, #temp, 0};
4497 leency 63
 
6795 leency 64
bool LinksArray::HoverAndProceed(dword mx, my)
4491 leency 65
{
66
	int i;
67
	for (i=0; i
68
	{
69
		if (mx>links[i].x) && (my>links[i].y) && (mx
4488 leency 70
		{
6795 leency 71
			if (mouse.lkm) && (mouse.down) {
72
				DrawRectangle(links[active].x, -WB1.list.first + links[active].y,
6794 leency 73
				links[active].w, links[active].h, 0);
6795 leency 74
				return false;
75
			}
76
			if (mouse.mkm) && (mouse.up) {
6931 leency 77
				open_in_a_new_window = true;
78
				ClickLink();
6795 leency 79
				return false;
80
			}
81
			if (mouse.lkm) && (mouse.up) {
82
				CursorPointer.Restore();
83
				ClickLink();
84
				return false;
85
			}
86
			if (mouse.pkm) && (mouse.up) {
87
			//	EventShowLinkMenu(mouse.x, mouse.y);
88
				return false;
89
			}
90
			if (active==i) return false;
4497 leency 91
			CursorPointer.Set();
6794 leency 92
			if (links[active].underline) DrawBar(links[active].x, -WB1.list.first + links[active].y
6795 leency 93
				+ links[active].h, links[active].w, links[active].underline_h, link_color_inactive);
6794 leency 94
			if (links[i].underline) DrawBar(links[i].x, -WB1.list.first + links[i].y
6795 leency 95
				+ links[i].h, links[i].w, links[i].underline_h, bg_color);
4491 leency 96
			active = i;
6795 leency 97
			DrawStatusBar(links[active].link);
98
			return true;
4488 leency 99
		}
100
	}
4497 leency 101
	if (active!=-1)
102
	{
103
		CursorPointer.Restore();
6795 leency 104
		if (links[active].underline) {
105
			DrawBar(links[active].x, -WB1.list.first + links[active].y + links[active].h,links[active].w,
106
				links[active].underline_h, link_color_inactive);
107
		}
4718 leency 108
		DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg);
4497 leency 109
		active = -1;
110
	}
4488 leency 111
}
6795 leency 112
 
113