#!/home/nop/lua-fltk/flua
-- This is how *all* callbacks show up in lua-land, with w as the widget
function fltk_dispatch(w) if w.callback then w:callback() end end

-- Translation of resize.cxx from the examples directory

w = Fl_Window:new(366,261)
do
   local o = Fl_Button:new(20,40,40,40, "@<-")
   o:labeltype(FL_SYMBOL_LABEL)
   function o:callback() w:position(w:x()-50, w:y()) end
   fl_cb(o)
end
do 
   local o = Fl_Button:new(60, 80, 40, 40, "@2->")
   o:labeltype(FL_SYMBOL_LABEL)
   function o:callback() w:position(w:x(), w:y()+50) end
   fl_cb(o)
end
do
   local o = Fl_Button:new(100, 40, 40, 40, "@->");
   o:labeltype(FL_SYMBOL_LABEL)
   function o:callback() w:position(w:x()+50, w:y()) end
   fl_cb(o)
end
do
   local o = Fl_Button:new(60, 0, 40, 40, "@8->");
   o:labeltype(FL_SYMBOL_LABEL)
   function o:callback() w:position(w:x(), w:y()-50) end
   fl_cb(o)
end
do
   local o = Fl_Button:new(30, 130, 110, 40, "grow");
      o:labeltype(FL_SYMBOL_LABEL);
      o:labelfont(1);
      o:labelsize(18);
      function o:callback() w:size(w:w()+50, w:h()+50) end
      fl_cb(o)
end
do
   local o = Fl_Button:new(30, 190, 110, 40, "shrink");
      o:labeltype(FL_SYMBOL_LABEL);
      o:labelfont(1);
      o:labelsize(18);
      function o:callback() w:size(w:w()/2+1, w:h()/2+1) end
      fl_cb(o)
end
w:end_layout()
w:resizable(w)
w:show()
