2014-01-21 03:42:18 +04:00
|
|
|
CustomCursor CursorPointer;
|
|
|
|
dword CursorFile = FROM "../TWB/pointer.cur";
|
|
|
|
|
2014-01-30 22:28:50 +04:00
|
|
|
#define NOLINE 0
|
|
|
|
#define UNDERLINE 1
|
|
|
|
|
|
|
|
|
2014-01-20 02:46:58 +04:00
|
|
|
struct array_link {
|
|
|
|
dword link, text;
|
|
|
|
int x,y,w,h;
|
2014-01-30 22:28:50 +04:00
|
|
|
int underline;
|
2014-01-20 02:46:58 +04:00
|
|
|
};
|
2014-01-20 00:06:42 +04:00
|
|
|
|
|
|
|
struct LinksArray
|
|
|
|
{
|
2014-01-20 03:48:36 +04:00
|
|
|
array_link links[200];
|
|
|
|
char page_links[64000];
|
2014-01-20 02:46:58 +04:00
|
|
|
dword buflen;
|
|
|
|
int count, active;
|
|
|
|
|
|
|
|
void Hover();
|
|
|
|
void AddLink();
|
|
|
|
void AddText();
|
2014-01-20 00:06:42 +04:00
|
|
|
dword GetURL();
|
|
|
|
void Clear();
|
2014-01-20 02:46:58 +04:00
|
|
|
};
|
2014-01-20 00:06:42 +04:00
|
|
|
|
2014-01-20 02:46:58 +04:00
|
|
|
void LinksArray::AddLink(dword new_link, int link_x, link_y)
|
2014-01-20 00:06:42 +04:00
|
|
|
{
|
2014-01-20 02:46:58 +04:00
|
|
|
links[count].x = link_x;
|
|
|
|
links[count].y = link_y;
|
|
|
|
|
|
|
|
links[count].link = buflen;
|
|
|
|
strcpy(buflen, new_link);
|
|
|
|
buflen += strlen(new_link)+1;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
2014-01-30 22:28:50 +04:00
|
|
|
void LinksArray::AddText(dword new_text, int link_w, link_h, link_underline)
|
2014-01-20 02:46:58 +04:00
|
|
|
{
|
|
|
|
if (count<1) return;
|
|
|
|
links[count-1].w = link_w;
|
|
|
|
links[count-1].h = link_h;
|
2014-01-30 22:28:50 +04:00
|
|
|
links[count-1].underline = link_underline;
|
2014-01-20 02:46:58 +04:00
|
|
|
|
|
|
|
links[count-1].text = buflen;
|
|
|
|
strcpy(buflen, new_text);
|
|
|
|
buflen += strlen(new_text)+1;
|
2014-01-20 00:06:42 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
dword LinksArray::GetURL(int id)
|
|
|
|
{
|
2014-01-20 02:46:58 +04:00
|
|
|
return links[id].link;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LinksArray::Clear()
|
|
|
|
{
|
2014-01-20 03:48:36 +04:00
|
|
|
int i;
|
|
|
|
for (i=0; i<=count; i++) DeleteButton(i+400);
|
2014-01-20 02:46:58 +04:00
|
|
|
buflen = #page_links;
|
|
|
|
count = 0;
|
|
|
|
active = -1;
|
2014-01-21 03:42:18 +04:00
|
|
|
CursorPointer.Restore();
|
2014-01-20 02:46:58 +04:00
|
|
|
}
|
|
|
|
|
2014-01-21 03:42:18 +04:00
|
|
|
|
2014-01-20 02:55:57 +04:00
|
|
|
void LinksArray::Hover(dword mx, my, link_col_in, link_col_a, bg_col)
|
2014-01-20 02:46:58 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i=0; i<count; i++)
|
|
|
|
{
|
|
|
|
if (mx>links[i].x) && (my>links[i].y) && (mx<links[i].x+links[i].w) && (my<links[i].y+links[i].h)
|
2014-01-20 00:06:42 +04:00
|
|
|
{
|
2014-01-21 03:42:18 +04:00
|
|
|
if (active==i) return;
|
|
|
|
CursorPointer.Set();
|
2014-01-30 22:28:50 +04:00
|
|
|
if (links[active].underline) DrawBar(links[active].x,links[active].y+8,links[active].w,1, link_col_in);
|
|
|
|
if (links[i].underline) DrawBar(links[i].x,links[i].y+8,links[i].w,1, bg_col);
|
2014-01-20 02:46:58 +04:00
|
|
|
active = i;
|
|
|
|
return;
|
2014-01-20 00:06:42 +04:00
|
|
|
}
|
|
|
|
}
|
2014-01-21 03:42:18 +04:00
|
|
|
if (active!=-1)
|
|
|
|
{
|
|
|
|
CursorPointer.Restore();
|
2014-01-30 22:28:50 +04:00
|
|
|
if (links[active].underline) DrawBar(links[active].x,links[active].y+8,links[active].w,1, link_col_in);
|
2014-01-21 03:42:18 +04:00
|
|
|
active = -1;
|
|
|
|
}
|
2014-01-20 00:06:42 +04:00
|
|
|
}
|
|
|
|
|
2014-01-20 02:46:58 +04:00
|
|
|
|
2014-01-20 03:48:36 +04:00
|
|
|
LinksArray PageLinks;
|