1 CAPI Reference Entries

grid-layout

Class

Summary

Thegrid-layout is a layout which positions its children on a two dimensional grid.

Superclasses

x-y-adjustable-layout

Subclasses

row-layout

column-layout

Slots

orientation
The orientation of the children.

rows
The number of rows in the grid.

columns
The number of columns in the grid.

x-ratios
The ratios between the columns.

y-ratios
The ratios between the rows.

x-gap
The gap between each column.

y-gap
The gap between each row.

x-uniform-size-p

Ift, make each of the columns the same size.

y-uniform-size-p

Ift, make each of the rows the same size.

Accessors

layout-x-ratios

layout-y-ratios

layout-x-gap

layout-y-gap

Description

The row and column sizes are controlled by the constraints on their children. For example, themin-width of any column is the maximum of themin-widths of the children in the column. The size of the layout is controlled by the constraints on the rows and columns.

The description is either a two dimensional array or a list in the order specified by the orientation (which defaults to:row). In the latter case, one of:columns or:rows can be given to specify the dimensions (the default is two columns).

Thex-ratios andy-ratios slots control the sizes of the elements in a grid layout in the following manner:

The elements ofx-ratios (ory-ratios) control the size of each child relative to the others. If an element inx-ratios (ory-ratios) isnil the child is fixed at its minimum size. Otherwise the size is calculated as follows

(round (* total ratio) ratio-sum) 

where ratio-sum is the sum of the non-nil elements ofx-ratios (ory-ratios) and ratio is the element of ratios corresponding to the child. If this ideal ratio size does not fit the maximum or minimum constraints on the child size, and the constraint means that changing the ratio size would not assist the sum of the child sizes fitting the total space available, then the child is fixed at its constrained size, the child is removed from the ratio calculation, and the calculation is performed again. Ifx-ratios (ory-ratios) has fewer elements than the number of children, 1 is used for each of the missing ratios. Leavingx-ratios (ory-ratios)nil causes all of the children to be the same size.

The positions of each pane in the layout can be specified usingx-adjust andy-adjust like every otherx-y-adjustable-layout, except that if there is one value then it is used for all of the panes, whereas if it is a list then each value in the list refers to one row or column. If the list does not contain a value for every row or column then the last value is taken to refer to all of the remaining panes.

Example

(capi:contain (make-instance
               'capi:grid-layout
               :description '("1" "2" "3"
                              "4" "5" "6"
                              "7" "8" "9")
               :columns 3))

(capi:contain (make-instance 'capi:grid-layout :description (list "List:" (make-instance 'capi:list-panel :items '(1 2 3)) "Buttons:" (make-instance 'capi:button-panel :items '(1 2 3)))))

(capi:contain (make-instance 'capi:grid-layout :description (list "List:" (make-instance 'capi:list-panel :items '(1 2 3)) "Buttons:" (make-instance 'capi:button-panel :items '(1 2 3))) :x-adjust '(:right :left) :y-adjust '(:center :bottom)))

(capi:contain (make-instance 'capi:grid-layout :description (list "List:" (make-instance 'capi:list-panel :items '(1 2 3)) "Buttons:" (make-instance 'capi:button-panel :items '(1 2 3))) :orientation :column))

Example File

capi/layouts/form-using-grid.lisp

See Also

layout


CAPI Reference Manual, Liquid Common Lisp Version 5.0 - 3 OCT 1997

Generated with Harlequin WebMaker