Subversion Repositories Kolibri OS

Rev

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

  1.  
  2. #define TAB_PADDING 15
  3. #define TAB_HEIGHT 28
  4.  
  5. :struct _tabs
  6. {
  7.         int x,y,w,h;
  8.         int active_tab;
  9.         int c;
  10.         void draw_button();
  11.         int click();
  12.         void draw_wrapper();
  13. };
  14.  
  15. :void _tabs::draw_wrapper()
  16. {
  17.         dword color_light = MixColors(system.color.work, 0xFFFfff, 40);
  18.         dword color_content = MixColors(system.color.work, 0xFFFfff, 120);
  19.         dword color_light_border = MixColors(system.color.work, system.color.work_graph, 120);
  20.  
  21.         DrawRectangle(x-1, y-1, w+1, h+1, system.color.work_graph);
  22.         DrawBar(x, y, w, h, color_content); //0xF3F3F3
  23.         DrawRectangle3D(x, y, w-1, h-1, color_light, color_content); //0xF3F3F3
  24.  
  25.         DrawBar(x+1, y+h+1, w-2, 2, system.color.work_dark); //"shadow"
  26.  
  27.         DrawBar(x, y+TAB_HEIGHT-1, w, 1, color_light_border);
  28.         DrawBar(x, y+TAB_HEIGHT, w, 1, color_light);
  29.  
  30.         c = y + TAB_HEIGHT;
  31. }
  32.  
  33. :void _tabs::draw_button(dword xx, but_id, text)
  34. {
  35.         dword col_bg, col_text;
  36.         dword ww=strlen(text)*8, hh=TAB_HEIGHT;
  37.  
  38.         if (but_id==active_tab)
  39.         {
  40.                 col_bg=0xE44C9C;
  41.                 col_text=0x000000;
  42.         }
  43.         else
  44.         {
  45.                 col_bg=0xC3A1B7;
  46.                 col_text=0x333333;
  47.         }
  48.         DefineHiddenButton(xx,y, ww-1,hh-1, but_id);
  49.         WriteText(xx, y+6, 0x90, col_text, text);
  50.         DrawBar(xx, y+hh-3, ww, 3, col_bg);
  51. }
  52.  
  53. :int _tabs::click(int N)
  54. {
  55.         if (N==active_tab) return false;
  56.         active_tab = N;
  57.         return true;
  58. }