Subversion Repositories Kolibri OS

Rev

Rev 6058 | Blame | Last modification | View Log | Download | RSS feed

  1. struct _link
  2. {
  3.         int count;
  4.         int x[4096], y[4096], w[4096], h[4096];
  5.         collection text;
  6.         collection url;
  7.         void clear();
  8.         void add();
  9.         int hover();
  10.         int active;
  11. } link;
  12.  
  13. void _link::clear()
  14. {
  15.         text.drop();
  16.         url.drop();
  17.         count = 0;
  18. }
  19.  
  20. void _link::add(int _xx, _yy, _ww, _hh, dword _textt, _urll )
  21. {
  22.         if (count==4095) return;
  23.         x[count] = _xx;
  24.         y[count] = _yy;
  25.         w[count] = _ww;
  26.         h[count] = _hh;
  27.         text.add(_textt);
  28.         url.add(_urll);
  29.         count++;
  30. }
  31.  
  32. int _link::hover()
  33. {
  34.         //char tempp[4096];
  35.         dword color;
  36.         int i;
  37.         active = -1;
  38.         mouse.x = mouse.x - list.x;
  39.         mouse.y = mouse.y - list.y;
  40.         for (i=0; i<link.count; i++) {
  41.                 if(link.y[i]>list.first*list.item_h) && (link.y[i]<list.first*list.item_h+list.h) {
  42.                         // sprintf(#tempp, "mx:%i my:%i x[i]:%i y[i]:%i", mx, my, x[i], y[i]);
  43.                         // sprintf(#tempp);
  44.                         if (mouse.x>link.x[i])
  45.                         && (-list.first*list.item_h+link.y[i]<mouse.y)
  46.                         && (mouse.x<link.x[i]+link.w[i])
  47.                         && (-list.first*list.item_h+link.y[i]+link.h[i]>mouse.y) {
  48.                                 color = 0xFFFfff;
  49.                                 CursorPointer.Set();
  50.                                 active = i;
  51.                         }
  52.                         else {
  53.                                 color = 0x0000FF;
  54.                         }
  55.                         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);
  56.                 }
  57.         }
  58.         if (active==-1) CursorPointer.Restore();
  59.         return false;
  60. }