Subversion Repositories Kolibri OS

Rev

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