Aliaksei Syrel

Brick for Pharo | Part II - Basic layouts

Jan 032015

There are only a few basic and foundational types of layouts that are used to build flexible interfaces. In this post we will see which types of them are implemented and could be used in Brick. First of all lets divide all of them in two groups by orientation:

  • Horizontal layouts
  • Vertical layouts

Nevertheless, orientation is not the only parameter that describes a specific layout. I would like to postulate that parent's and children's dimensions depends on each other in four ways:

  • Dimension depends on parent
  • Parent depends on children
  • Height depends on width and the way around
  • Doesn't depend


When parent and children are independent:


The width of the parent is a sum of children's widths:


Or when children fill the height of the parent and parent expands to children's width at the same time:


Each layout like shown above I name LinearLayout because every element is positioned right after it's predecessor in one line - linearly. Children in simple LinearLayout can have different width or height. But there are cases when we want them to depend on the parent's dimension. For example proportionally:


And even fill height too:


Out of box Brick supports the following ones:

  • GLMHorizontalLinearLayout
  • GLMVerticalLinearLayout

They will be described more detailed in the next Part III of Brick for Pharo.