/* $Id: nifty3d.ths 3978 2003-05-23 10:19:38Z micah $
 *
 * This theme's pretty darn cpu-intensive, but it
 * demonstrates the neat things that can be done with
 * fillstyles and gradients.
 * Uses much less memory than Aqua, but probably not faster.
 *
 * Version 1.2
 *
 * -- Micah Dowty
 *
 * Changelog:
 *
 *  1.2 - Fixed menuitem background
 *  1.1 - Added alpha blending effects on popup windows
 *  1.0 - First 'stable' release
 */

object default {
  name = "Nifty 3D v1.11";

  /* This generates a beveled surface, based on 'bgcolor'.
     The amount of shading is determined by 'hilightcolor'
     and the width is set by 'margin'. The amount to shade
     the body of the surface is set by 'shadowcolor'. */
  bgfill = fillstyle {
    var m,a,p1,p2,hc;

    /* Black frame around it all */
    SetColor(0x000000);
    Frame(x,y,w,h);

    /* Thickness of the border */
    m = margin/2 + 1;
    /* Displace angles by... */
    a = offset;
    /* Preload hilight color */
    hc = hilightcolor;

    /* Body of the surface */
    Gradient(x+1,y+1,w-2,h-2,a ? 205 : 25,bgcolor,
	     ColorSub(bgcolor,shadowcolor));

    /* Hilights */
    SetLgop(a ? PG_LGOP_SUBTRACT : PG_LGOP_ADD);
    Gradient(x+1,y+1,m,h-2,0,hc,0);
    Gradient(x+1,y+1,w-2,m,90,hc,0);
    SetLgop(a ? PG_LGOP_ADD : PG_LGOP_SUBTRACT);
    Gradient(x+w-m-1,y+1,m,h-2,180,hc,0);
    Gradient(x+1,y+h-m-1,w-2,m,270,hc,0);

    /* Displacement */
    x = x+a;
    y = y+a;

    SetLgop(PG_LGOP_NONE);
  };

  bgcolor = 0xC0C0C0;
  hilightcolor = 0x202020;
  shadowcolor = 0x303030;

  /* Default sizing */
  margin = 3;
  spacing = 3;
  width = 20;
  height = 20;
}

/* Different default bevels for various types of objects */
object base.interactive hilightcolor = 0x606060;
object toolbar bgcolor = 0xC0C0E0;
object base.container {
  offset = 1;
  margin = 4;
}
object base.tlcontainer {
  hilightcolor = 0x606060;
  margin = 6;
}

/* Button dynamics */
object button.hilight bgcolor = 0xE0E0FF;
object button.on      offset = 1;

/* Background */
object background {
  bgfill = fillstyle {
    Bitmap(x,y,w,h,bitmap1);
  };
  bitmap1 = LoadBitmap("data/bluesquares.pnm");
}

/* Panelbar */
object panelbar {
  bgcolor = 0x7898B3;
  width = 17;
  margin = 0;
}
object base.panelbtn {
  width = Copy(panelbar::width);
  height = Copy(panelbar::width);
  spacing = 0;
  bgcolor = 0xC0C0C0;
  shadowcolor = 0;
}
object closebtn  {
  widgetbitmap = LoadBitmap("data/tiny_x.pnm");
  side = PG_S_LEFT;
}
object rotatebtn {
  widgetbitmap = LoadBitmap("data/tiny_arrow.pnm");
  side = PG_S_RIGHT;
}
object zoombtn {
  widgetbitmap = LoadBitmap("data/tiny_expand.pnm");
  side = PG_S_RIGHT;
}
object closebtn.on offset = 1;
object rotatebtn.on offset = 1;
object zoombtn.on offset = 1;

/* Make dialog box titles look like panelbars */
object label.dlgtitle {
  bgfill = Copy(panelbar::bgfill);
  bgcolor = Copy(panelbar::bgcolor);
}

object popup {
  margin = 6;

  bgfill = fillstyle {
    var m,hc;

    /* Black frame around it all */
    SetColor(0x000000);
    Frame(x,y,w,h);

    /* Thickness of the border */
    m = 3;
    /* Preload hilight color */
    hc = hilightcolor;

    /* Body of the surface */
    Gradient(x+1,y+1,w-2,h-2,25,bgcolor,ColorSub(bgcolor,shadowcolor));

    /* Hilights */
    SetLgop(PG_LGOP_ADD);
    Gradient(x+1,y+1,m,h-2,0,hc,0);
    Gradient(x+1,y+1,w-2,m,90,hc,0);
    SetLgop(PG_LGOP_SUBTRACT);
    Gradient(x+w-m-1,y+1,m,h-2,180,hc,0);
    Gradient(x+1,y+h-m-1,w-2,m,270,hc,0);
  };
}

/* Really spiffy translucent popup menus */
object popup.menu {
  margin = 2;
  width = 0;
  height = 0;

  bgfill = fillstyle {
    // Gray background
    SetLgop(PG_LGOP_NONE);
    SetColor(0x808080);
    Rect(x+2,y+2,w-4,h-4);

    // Black border within the menu to cap the top and sides
    SetColor(0x000000);
    Frame(x+2,y+1,w-4,h-3);
  };
  bgcolor = 0xAAAAFF;
}
object menuitem {
  bgfill = fillstyle {
    SetColor(bgcolor);
    Rect(x+1,y+1,w-2,h-2);
    SetColor(0x000000);
    Frame(x,y-1,w,h+1);
    SetColor(0xA0A0A0);
    Slab(x+1,y,w-2,1);
  };
  bgcolor = 0x808080;
  fgcolor = 0xFFFFFF;
  align = PG_A_LEFT;
  margin = 2;
  spacing = 0;
}
object menuitem.hilight {
  fgcolor = 0x000080;
  bgcolor = 0xA0A0A0;
}

/* A little 'fudge factor' for the dialogs */
object popup.messagedlg {
  width = 20;
  height = 30;
}

/* A scroll-safe background */
object label.scroll bgfill = fillstyle {
  SetColor(bgcolor);
  Rect(x,y,w,h);
};
object box shadowcolor = 0;

/* Scroll bars */
object scroll {
  width = 13;
  overlay = Copy(scroll::bgfill);
}

/* Indicator */
object indicator {
  margin = 4;
  width = 15;
  overlay = fillstyle {
    SetLgop(PG_LGOP_ADD);
    Gradient(x+1,y+1,w-2,h-2,w>h ? 0 : 90,0x808000,0);
  };
}

/* Check boxes */
object checkbox {
   bgfill = fillstyle {
      Bitmap(x+1,y+((h-12)>>1)-1,12,12,bitmap1);
      x = x + 16;
   };
   bitmap1 = LoadBitmap("data/check_unchecked.pnm");
   align = PG_A_LEFT;
   margin = 10;
}
object checkbox.on bitmap1 = LoadBitmap("data/check_checked.pnm");

/* The End */
