#!/home/nop/lua-fltk/flua
-- Translation of boxtype.cxx

N = 0

W = 150
H = 50
ROWS = 8

function bt(name, ...)
   local square
   if getn(arg) == 1 then square = 1 end
   -- Of course, the C version uses integer arithmetic....
   x = floor(mod(N,4))
   y = floor(N/4)
   N = N + 1
   x = x * W + 10
   y = y * H + 10
   local mw = W - 20
   if square then mw = H - 20 end
   local b = Fl_Box:new(getglobal(name), x, y, mw, H-20, name)
   b:labelsize(10)
   if square then b:align(FL_ALIGN_RIGHT) end
end

window = Fl_Window:new(4*W, ROWS*H)
window:box(FL_FLAT_BOX)
window:color(12) -- light blue
bt("FL_NO_BOX")
bt("FL_FLAT_BOX")
N = N + 2 -- go to start of next row to line up boxes & frames

boxtypes = {
"FL_UP_BOX", "FL_DOWN_BOX", "FL_UP_FRAME", "FL_DOWN_FRAME",
"FL_THIN_UP_BOX", "FL_THIN_DOWN_BOX", "FL_THIN_UP_FRAME",
"FL_THIN_DOWN_FRAME", "FL_ENGRAVED_BOX", "FL_EMBOSSED_BOX",
"FL_ENGRAVED_FRAME", "FL_EMBOSSED_FRAME", "FL_BORDER_BOX",
"FL_SHADOW_BOX", "FL_BORDER_FRAME", "FL_SHADOW_FRAME",
"FL_ROUNDED_BOX", "FL_RSHADOW_BOX", "FL_ROUNDED_FRAME",
"FL_RFLAT_BOX", "FL_OVAL_BOX", "FL_OSHADOW_BOX", "FL_OVAL_FRAME",
"FL_OFLAT_BOX", "FL_ROUND_UP_BOX", "FL_ROUND_DOWN_BOX",
"FL_DIAMOND_UP_BOX", "FL_DIAMOND_DOWN_BOX"
}

for i,v in boxtypes do bt(v) end

window:resizable(window)
window:end_layout()
window:show()
