kolibrios-fun/programs/cmm/aelia/link.h
Kirill Lipatov (Leency) 228094c871 Aelia 0.33: add cursor pointer
git-svn-id: svn://kolibrios.org@6059 a494cfbc-eb01-0410-851d-a64ba20cac60
2016-01-14 23:51:52 +00:00

60 lines
1.3 KiB
C

struct _link
{
int count;
int x[4096], y[4096], w[4096], h[4096];
collection text;
collection url;
void clear();
void add();
int hover();
int active;
} 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++;
}
int _link::hover()
{
//char tempp[4096];
dword color;
int i;
active = -1;
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;
CursorPointer.Set();
active = i;
}
else {
color = 0x0000FF;
}
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;
}