EZwgl (2.6 Geometry Management)

## 2.6 Geometry Management

The purpose of the geometry manager is to automate widget layout. Each widget in EZwgl has attributes that control the placement of children widgets as well as attributes to hardcode the geometry of widgets. Unless absolutely necessary, it is recommended that you do not hard code the geometry of your widgets.

EZwgl implements four geometry managers: layout widget in rows/columns/grid-bag and a simplified grid-bag (the default). The geometry manager is controled by the `EZ_GEOMETRY_MANAGER` configuration option or the `geometryManager` resource. Possible resource values are: -1 (the default), 0 (grid bag), 1 (row), 2 (column) and 3 (none).

### 2.6.1 The Default Geometry Manager

The default geometry manager arranges children widgets in one row or one column. To compute the layout, it uses the following set of attributes of container widgets

- `EZ_ORIENTATION` (how to stack subwidgets)

- `EZ_FILL_MODE` (how to distribute extra spaces)

- `EZ_SIDE` (how to align subwidgets)

- `EZ_PADX` (padding in the horizontal direction)

- `EZ_PADY` (padding in the vertical direction)

- `EZ_IPADX` (padding between subwidgets, in the horizontal direction)

- `EZ_IPADY` (padding between subwidgets, in the vertical direction)

- `EZ_WIDTH`

- `EZ_HEIGHT`

and the following set of attributes of children widgets

- `EZ_EXPAND`

- `EZ_WIDTH`

- `EZ_HEIGHT`

- `EZ_X`

- `EZ_Y`

### 2.6.2 The Grid Bag Geometry Manager

The grid bag geometry manager arranges children widgets in multiple rows and columns. It is more powerful and flexible than the default geometry manager. The down side is that it is not very intuitive and can be extremly complex.

The grid bag geometry manager uses the row/column contrains of the container widget and cell geometry attributes of children widgets to compute the layout. Row/column contrains are set by the following configuration options

- `EZ_GRID_COLUMN_CONSTRAINS`

- `EZ_GRID_ROW_CONSTRAINS`

Cell geometry of children widgets are set by the following two configuration options

- `EZ_GRID_CELL_GEOMETRY`

- `EZ_GRID_CELL_PLACEMENT`

### 2.6.3 The Row and Column Geometry Manager

Row/column geometry manager layout children widgets in rows/columns inside the parent widget window. The size of children widgets does not depend on the geometry of the parent, only the location does.

### 2.6.4 About EZ_PROPAGATE

Geometry managers in EZwgl use a recursive algorithm to compute the layout of widgets. If the geometry of a widget changes, the change by default propagates to the whole widget tree. If your interface has many widgets packed as descendants of one toplevel widget, the perfermence may not be satisfactory if the geometry of leave widgets change constantly. Updating the geometry and move/resize/redisplay all widget windows can be slow. This is especially noticable if the application is running on a different machine across the network.

The attribute `EZ_PROPAGATE` is designed to alter the the default behavior about propagating geometry changes. When set `True` for a widget, change of geometry of the widget will no longer propagate.

HTML Documentation Maintainance:`Arturo Espinosa <arturo@nuclecu.unam.mx>`