beforeLayout event added

Sometimes I need to know when there will be a change in the layout, because I have to modify the size of the elements. This is the simplest way I've found to solve this problem.