Subversion Repositories Kolibri OS

Rev

Rev 7906 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. #define MIN_PB_BLOCK_W 19
  3. #define LOAD_CPU 0x2460C8
  4. #define PROGRESS_ACTIVE 0x489FE4
  5. #define PROGRESS_BG 0xFFFfff
  6. #define PROGRESS_BG_TEXT 0x696969
  7.  
  8. :struct sensor {
  9.         int x,y,w,h;
  10.         void set_size();
  11.         void draw_wrapper();
  12.         void draw_progress();
  13. };
  14.  
  15. :void sensor::set_size(dword _x, _y, _w, _h)
  16. {
  17.         x=_x+2;
  18.         y=_y;
  19.         w=_w;
  20.         h=_h;
  21.         draw_wrapper();
  22. }
  23.  
  24. :void sensor::draw_wrapper()
  25. {
  26.         DrawRectangle(x-1, y-1, w+1, h+1, system.color.work_graph);
  27.         DrawRectangle3D(x-2, y-2, w+3, h+3, system.color.work_dark, system.color.work_light);
  28. }
  29.  
  30. :void sensor::draw_progress(dword progress_w, active_value, bg_value, mesure)
  31. {
  32.         if (progress_w < MIN_PB_BLOCK_W) progress_w = MIN_PB_BLOCK_W;
  33.         if (progress_w > w-MIN_PB_BLOCK_W) progress_w = w-MIN_PB_BLOCK_W;
  34.  
  35.         DrawBar(x, y,     w-progress_w, 1,   MixColors(PROGRESS_ACTIVE, PROGRESS_BG, 200));
  36.         DrawBar(x, y+1,   w-progress_w, h-2, PROGRESS_ACTIVE);
  37.         DrawBar(x, y+h-1, w-progress_w, 1,   MixColors(PROGRESS_ACTIVE, system.color.work_graph, 200));
  38.  
  39.         sprintf(#param, "%i%s", active_value, mesure);
  40.         WriteText(w-progress_w- calc(strlen(#param)*8) /2 + x, h/2-7+y, 0x90, PROGRESS_BG, #param);
  41.  
  42.         DrawBar(x+w-progress_w, y, progress_w, h, PROGRESS_BG);
  43.         sprintf(#param, "%i%s", bg_value, mesure);
  44.         WriteText(-progress_w - calc(strlen(#param)*8)/2 + w+x, h/2-7+y, 0x90, PROGRESS_BG_TEXT, #param);
  45. }