Layout management

Many factors have to be taken into consideration when laying out controls. Component controls are normally laid out within their containers according to the prevailing UI policy, skin, font, text style, zoom-factor and the sizes and shapes of the controls themselves. A change to any one of these might necessitate a new layout.

The Control Framework supports run-time layout management with the MCoeLayoutManager interface. Each compound control knows which layout manager to call when it changes size. The layout manager then takes responsibility for making any adjustments to the layout.

A layout manager is associated with a compound control using:

 IMPORT_C virtual void SetLayoutManagerL(MCoeLayoutManager* aLayout);

Note that this call passes 'ownership' so the caller does not need to retain a pointer. A layout manager may be attached to more than one control so it must implement its own reference count and delete itself when the count becomes zero. SetLayoutManagerL() is also used to dissociate a layout manager from a control by passing either NULL or a pointer to a different layout manager.

The Control Framework does not provide any concrete layout managers. This is the responsibility of the UI variant library or the application developer.

Though layout managers are now built into the control framework their use is optional.