ff_layout
Layout classes for JUCE
|
This JUCE module provides a simple to use layout mechanism. The items to be laid out are LayoutItems. Each LayoutItem can be either a sub layout, a spacer to leave space or a component item which refers to a juce::Component. When Layout::updateGeometry is called, the calculated bounds of the item is then transfered to the component via setBounds.
The major benefit is, that the layout can be defined as xml file and load on creation of the GUI elements. So the GUI can be rearranged without changing the implementation. Different XML files dependent on screen dimensions are also feasible.
The basic usage is to add a Layout instance to your parent component where you want to lay the children in. This component doesn't need to be the top most component, it also works for sub components. Use the Constructor providing a this pointer to the component, so the overall bounds can be used.
If you use automatically created and owned components like labels and splitters, you should call Layout::realize() at the end of the constructor i.e. after loading and the components are added as children to owningComponent.
Add a call to updateGeometry() in your component's resized() method.