Subversion Repositories Kolibri OS

Rev

Go to most recent revision | 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 = 0;
  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 = 0xFF0000;
  49.                         else
  50.                                 color = 0xCCCccc;
  51.                         DrawRectangle(link.x[i]+list.x+1, -list.first*list.item_h+link.y[i]+list.y, link.w[i], link.h[i], color);
  52.                 }
  53.         }
  54.         return false;
  55. }