revised large parts of widget rendering to make event handling more flexible