1,5 → 1,8 |
dword CursorFile = FROM "pointer.cur"; |
|
struct _link |
{ |
CustomCursor CursorPointer; |
int count; |
int x[4096], y[4096], w[4096], h[4096]; |
collection text; |
8,6 → 11,7 |
void add(); |
int hover(); |
int active; |
void draw_underline(); |
} link; |
|
void _link::clear() |
29,33 → 33,46 |
count++; |
} |
|
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); |
} |
|
int _link::hover() |
{ |
//char tempp[4096]; |
dword color; |
int i; |
active = -1; |
int new_active = -1; |
int link_start_y = list.first*list.item_h; |
mouse.x = mouse.x - list.x; |
mouse.y = mouse.y - list.y; |
for (i=0; i<link.count; i++) { |
if(link.y[i]>list.first*list.item_h) && (link.y[i]<list.first*list.item_h+list.h) { |
// sprintf(#tempp, "mx:%i my:%i x[i]:%i y[i]:%i", mx, my, x[i], y[i]); |
// sprintf(#tempp); |
if (mouse.x>link.x[i]) |
&& (-list.first*list.item_h+link.y[i]<mouse.y) |
&& (mouse.x<link.x[i]+link.w[i]) |
&& (-list.first*list.item_h+link.y[i]+link.h[i]>mouse.y) { |
color = 0xFFFfff; |
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; |
} |
} |
} |
|
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 = i; |
} |
else { |
color = 0x0000FF; |
active = new_active; |
return true; |
} |
DrawBar(link.x[i]+list.x, -list.first*list.item_h+link.y[i]+list.y+link.h[i]-1, link.w[i], 1, color); |
} |
} |
if (active==-1) CursorPointer.Restore(); |
|
return false; |
} |