links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Layout in Cuis
Last updated at 1:44 am UTC on 19 January 2022
The layout of morphs in Cuis Smalltalk is different from the way it is done in Squeak.

There is a class LayoutMorph.

It represents a row or column of widgets or morphs. It does layout the submorphs by placing them either horizontally or vertically.

A LayoutSpec might be attached to any of the submorphs. If there are none attached, then, for a column, the column width is taken as the width, and any morph height is kept.
The same for rows: the submorph width is maintained, and submorph height would be made equal to row height.

So LayoutSpecs are the basis for the layout mechanism. Any Morph can be given a LayoutSpec, but in order to honor it, its owner must be a LayoutMorph.

A LayoutSpec specifies how a morph wants to be layed out. It can specify either a fixed width or a fraction of some available owner width. Same goes for height. If a fraction is specified, a minimum extent is also possible.

A LayoutMorph does its job by setting the morphPosition and morphExtent of its direct submorphs.
A LayoutMorph may also have a Morph Separation specified: x@y.

In Squeak the layout is specified completely by a LayoutPolicy (e.g. the TableLayout subclass) object which is attached to the container morph. Any morph may act as a container morph if such a layout policy object is attached.