Port the old layout code to the new scheme

Also add the stack element and make the button use the new frame
layout.
Start implementing the input system too