2018-05-22 23:02:03 +02:00
|
|
|
dword CursorFile = FROM "pointer.cur";
|
|
|
|
|
2016-01-15 00:05:51 +01:00
|
|
|
struct _link
|
|
|
|
{
|
2018-05-22 23:02:03 +02:00
|
|
|
CustomCursor CursorPointer;
|
2016-01-15 00:05:51 +01:00
|
|
|
int count;
|
|
|
|
int x[4096], y[4096], w[4096], h[4096];
|
|
|
|
collection text;
|
|
|
|
collection url;
|
|
|
|
void clear();
|
|
|
|
void add();
|
|
|
|
int hover();
|
|
|
|
int active;
|
2018-05-22 23:02:03 +02:00
|
|
|
void draw_underline();
|
2016-01-15 00:05:51 +01:00
|
|
|
} link;
|
|
|
|
|
|
|
|
void _link::clear()
|
|
|
|
{
|
|
|
|
text.drop();
|
|
|
|
url.drop();
|
|
|
|
count = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void _link::add(int _xx, _yy, _ww, _hh, dword _textt, _urll )
|
|
|
|
{
|
|
|
|
if (count==4095) return;
|
|
|
|
x[count] = _xx;
|
|
|
|
y[count] = _yy;
|
|
|
|
w[count] = _ww;
|
|
|
|
h[count] = _hh;
|
|
|
|
text.add(_textt);
|
|
|
|
url.add(_urll);
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
2018-05-22 23:02:03 +02:00
|
|
|
void _link::draw_underline(dword i, color)
|
|
|
|
{
|
|
|
|
DrawBar(x[i]+list.x, -list.first*list.item_h+y[i]+list.y+h[i]-1, w[i], 1, color);
|
|
|
|
}
|
|
|
|
|
2016-01-15 00:05:51 +01:00
|
|
|
int _link::hover()
|
|
|
|
{
|
|
|
|
int i;
|
2018-05-22 23:02:03 +02:00
|
|
|
int new_active = -1;
|
|
|
|
int link_start_y = list.first*list.item_h;
|
2016-01-15 00:05:51 +01:00
|
|
|
mouse.x = mouse.x - list.x;
|
|
|
|
mouse.y = mouse.y - list.y;
|
2018-05-22 23:02:03 +02:00
|
|
|
for (i=0; i<count; i++) {
|
|
|
|
if(y[i] > link_start_y) && (y[i] < link_start_y+list.h) {
|
|
|
|
// debugln( sprintf(#param, "mx:%i my:%i x[i]:%i y[i]:%i", mx, my, x[i], y[i]) );
|
|
|
|
if (mouse.x > x[i])
|
|
|
|
&& (mouse.x < x[i]+w[i])
|
|
|
|
&& (mouse.y > y[i]-link_start_y)
|
|
|
|
&& (mouse.y < h[i]-link_start_y+link.y[i]) {
|
|
|
|
new_active = i;
|
|
|
|
break;
|
2016-01-15 00:51:52 +01:00
|
|
|
}
|
2016-01-15 00:05:51 +01:00
|
|
|
}
|
|
|
|
}
|
2018-05-22 23:02:03 +02:00
|
|
|
|
|
|
|
if (new_active != active)
|
|
|
|
{
|
|
|
|
if (-1 == new_active) {
|
|
|
|
draw_underline(active, 0x0000FF);
|
|
|
|
CursorPointer.Restore();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
draw_underline(active, 0x0000FF);
|
|
|
|
draw_underline(new_active, 0xFFFfff);
|
|
|
|
CursorPointer.Load(#CursorFile);
|
|
|
|
CursorPointer.Set();
|
|
|
|
}
|
|
|
|
active = new_active;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-01-15 00:05:51 +01:00
|
|
|
return false;
|
|
|
|
}
|