/* $Id: lucid.ths 4519 2003-07-16 22:47:05Z lalo $
 *
 * Lucid - A simple and clean solid color and thin outline theme, where
 *         most elements are translucent.
 *
 * WARNING: This theme is still incomplete!
 *
 * Micah Dowty
 */

property fBackground,fTranslucent, fSolid, fFramedTranslucent, fStippleFramedTranslucent;
property fNop, frameColor, alpha, boxOffset;

object default {
  name = "Lucid";

  bgfill = Copy(default::fTranslucent);

		  

  fBackground = fillstyle {
    SetClip(x,y,w,h);
    background::bgfill(-widget::PG_WP_ABSOLUTEX,
		       -widget::PG_WP_ABSOLUTEY,
		       0x7FFF,0x7FFF);
    SetClip(0,0,0x7FFF,0x7FFF);
  };

  fNop = fillstyle {
    Nop();
  };

  fTranslucent = fillstyle {
    fBackground(x,y,w,h);
    
    SetLgop(PG_LGOP_ALPHA);
    SetColor(PGCF_ALPHA | alpha | bgcolor);
    Rect(x,y,w,h);
    SetLgop(PG_LGOP_NONE);
  };

  fSolid = fillstyle {
    SetColor(bgcolor);
    Rect(x,y,w,h);
  };

  fFramedTranslucent = fillstyle {
    SetColor(frameColor);
    Frame(x,y,w,h);
    fTranslucent(x+1,y+1,w-2,h-2);
  };

  fStippleFramedTranslucent =  fillstyle {
    SetColor(frameColor);
    SetLgop(PG_LGOP_STIPPLE);
    Frame(x,y,w,h);
    SetLgop(PG_LGOP_NONE);
    fTranslucent(x+1,y+1,w-2,h-2);
  };

  fgcolor = 0x000000;
  bgcolor = 0xffffff;
  alpha   = 0x68000000;

  margin  = 0;
  spacing = 5;
  width   = 20;
  height  = 20;
  boxOffset = 10;
}

object background {
  bgcolor = 0xeeeeee;
  bgfill = fillstyle {
    fSolid(x,y,w,h);
  };
}

object base.tlcontainer {
  bgcolor = 0xffffff;
  margin = 10;
}

object popup {
  bgfill = fillstyle {
    fFramedTranslucent(x,y,w,h);
  };
}

object label.dlgtitle parent = PGTH_O_PANELBAR;

object panelbar {
  margin = 1;
  font = Font(NULL,0,PG_FSTYLE_BOLD);
  align = PG_A_LEFT;
  bgfill = fillstyle {
    fTranslucent(x,y,w,h);
    SetColor(0x336699);
    Slab(x+2,y+h-1,w-4,1);
  };
}

object base.panelbtn {
  side = PG_S_RIGHT;
}

object button {
  fgcolor = 0x336699;
  frameColor = button::fgcolor;
  font = Font(NULL,0,PG_FSTYLE_BOLD);
  margin = 2;
}

object button.hilight bgfill = Copy(default::fStippleFramedTranslucent);

object button.on bgfill = fillstyle {
  button::bgfill(x,y,w,h);
  SetColor(frameColor);
  Frame(x,y,w,h);
};

object flatbutton parent = PGTH_O_BUTTON;

/* Check box things */
object checkbox {
   bgfill = fillstyle {
      fTranslucent(x,y,w,h);
      x = x + boxOffset;
   };
   align = PG_A_LEFT;
}
object checkbox.hilight fgcolor = button::fgcolor;
object checkbox.on {
  bgfill = fillstyle {
    fTranslucent(x,y,w,h);
    SetColor(button::fgcolor);
    Line(x+8,0,-4,h-1);
    Line(x+4,h-1,-4,0-(h/2));
    x = x + boxOffset;
  };
};
object checkbox.on.nohilight {
  bgfill = Copy(checkbox.on::bgfill);
  parent = PGTH_O_CHECKBOX;
};


object radiobutton bgfill = fillstyle {
   var b;
   fTranslucent(x,y,w,h);
   SetColor(button::fgcolor);
   b=y+(h/2);
   Line(x+5,b-5,3,5);
   Line(x+5,b-5,-3,5);
   Line(x+5,b+5,3,-5);
   Line(x+5,b+5,-3,-5);
   x = x + boxOffset;
};
object radiobutton.hilight {
  fgcolor = button::fgcolor;
  parent = PGTH_O_RADIOBUTTON;
};
object radiobutton.on {
  fgcolor = button::fgcolor;
  bgfill = fillstyle {
    var b;
    fTranslucent(x,y,w,h);
    SetColor(button::fgcolor);
    b=y+(h/2);
    Line(x+5,b-5,3,5);
    Line(x+5,b-5,-3,5);
    Line(x+5,b+5,3,-5);
    Line(x+5,b+5,-3,-5);
    Line(x+1,b-6,8,12);
    Line(x+1,b+6,8,-12);
    x = x + boxOffset;
  };
  parent = PGTH_O_RADIOBUTTON;
};
object radiobutton.on.nohilight {
  bgfill = Copy(radiobutton.on::bgfill);
};

/* Items */
object menuitem {
  bgfill = Copy(default::bgfill);
  align = PG_A_LEFT;
}  

object menuitem.hilight {
  bgfill = Copy(default::fFramedTranslucent);
}

object listitem.hilight parent = PGTH_O_MENUITEM_HILIGHT;

object listitem.on parent = PGTH_O_MENUITEM_HILIGHT;

/* The panel */
object panel {
  border.size = 10;
  bgfill = Copy(default::fNop);
  border.fill = fillstyle {
    fBackground(x,y,border.size-1,h);
    fBackground(x,y,w,border.size-1);
    fBackground(x+w-border.size+1,y,border.size-1,h);
    fBackground(x,y+h-border.size+1,w,border.size-1);
    fFramedTranslucent(x+border.size-1,y+border.size-1,w-border.size*2+2,h-border.size*2+2);
  };
}

object closebtn text = "X";
object rotatebtn text = "/";
object zoombtn text = "-";

/* Editables */

object field {
  bgfill = fillstyle {
    SetColor(frameColor);
    Line(x,y+h-1,w,0);
    fTranslucent(x,y,w,h-1);
  };

  frameColor = button::fgcolor;
  margin  = 2;
  alpha   = 0x75000000;
}

object textbox {
  bgfill = Copy(default::fStippleFramedTranslucent);

  frameColor = button::fgcolor;
  margin  = 3;
  alpha   = 0x75000000;
}

/* The scrollbar - not translucent, for niftier effect */

object scroll {
  width = 12;
  fgcolor = 0x336699;

  bgfill = fillstyle {
    var m;

    default::bgfill(x,y,w,h);
    SetColor(fgcolor);
    m = width/2-1;
    Rect(x+m,y+m,w-m*2,h-m*2);
  };

  overlay = fillstyle {
    SetColor(fgcolor);
    Frame(x+1,y+1,w-2,h-2);
    SetColor(bgcolor);
    Rect(x+2,y+2,w-4,h-4);
  };
}

object indicator {
  width = 12;
  fgcolor = 0x336699;

  bgfill = fillstyle {
    var m;

    default::bgfill(x,y,w,h);
    SetColor(widget::PG_WP_COLOR);
    m = width/2-1;
    Rect(x+m,y+m,w-m*2,h-m*2);
  };

  overlay = fillstyle {
    SetColor(widget::PG_WP_COLOR);
    Rect(x+1,y+1,w-2,h-2);
  };
}

/* The tabpage and its family */

object tab.page {
  margin = 4;
  bgfill = fillstyle {
    var x1, y1, w1, h1;
    fTranslucent(x,y,w,h);
    SetColor(frameColor);
    SetLgop(PG_LGOP_STIPPLE);
    Frame(x,y,w,h);
    SetLgop(PG_LGOP_NONE);
    x1 = (widget::PG_WP_SIDE == PG_S_LEFT) ? x: x+1;
    y1 = (widget::PG_WP_SIDE == PG_S_TOP)  ? y: y+1;
    w1 = (widget::PG_WP_SIDE == PG_S_TOP || widget::PG_WP_SIDE == PG_S_BOTTOM) ? w-2: w-1;
    h1 = (widget::PG_WP_SIDE == PG_S_TOP || widget::PG_WP_SIDE == PG_S_BOTTOM) ? h-1: h-2;
    fTranslucent(x1,y1,w1,h1);
  };
  frameColor = button::fgcolor;
}
object tab.bar {
  margin = 0;
  bgfill = fillstyle {
    var x1, y1, w1, h1;
    fTranslucent(x,y,w,h);
    SetColor(frameColor);
    SetLgop(PG_LGOP_STIPPLE);
    Frame(x,y,w,h);
    SetLgop(PG_LGOP_NONE);
    x1 = (widget::PG_WP_SIDE == PG_S_RIGHT) ? x+1: x;
    y1 = (widget::PG_WP_SIDE == PG_S_BOTTOM)  ? y+1: y;
    w1 = (widget::PG_WP_SIDE == PG_S_TOP || widget::PG_WP_SIDE == PG_S_BOTTOM) ? w-2: w-1;
    h1 = (widget::PG_WP_SIDE == PG_S_TOP || widget::PG_WP_SIDE == PG_S_BOTTOM) ? h-1: h-2;
    fTranslucent(x1,y1,w1,h1);
  };
  frameColor = button::fgcolor;
}

object tab {
  bgfill = Copy(default::fStippleFramedTranslucent);
  alpha   = 0x50000000;
}

object tab.on {
  bgfill = fillstyle {
    /* FIXME: there is probably a better way, look into setclip() - photonic uses that */
    var x1, y1, w1, h1;
    fTranslucent(x,y,w,h);
    SetColor(frameColor);
    SetLgop(PG_LGOP_STIPPLE);
    Frame(x,y,w,h);
    SetLgop(PG_LGOP_NONE);
    x1 = (widget->container[1]::PG_WP_SIDE == PG_S_RIGHT) ? x: x+1;
    y1 = (widget->container[1]::PG_WP_SIDE == PG_S_BOTTOM)  ? y: y+1;
    w1 = (widget->container[1]::PG_WP_SIDE == PG_S_TOP || widget->container[1]::PG_WP_SIDE == PG_S_BOTTOM) ? w-2: w-1;
    h1 = (widget->container[1]::PG_WP_SIDE == PG_S_TOP || widget->container[1]::PG_WP_SIDE == PG_S_BOTTOM) ? h-1: h-2;
    fTranslucent(x1,y1,w1,h1);
  };
}
/* The End */
