Move layout widget setting code into class