All Manuals > CAPI User Guide and Reference Manual > 21 CAPI Reference Entries

calculate-layout Generic Function

Summary

Provides a method for laying out the children of a new layout.

Package

capi

Signature

calculate-layout layout x y width height

Arguments
layout
A layout.
x, y, width, height
Integers.
Description

The generic function calculate-layout is called by the CAPI to set the position and size of the children of layout.

x, y, width and height are the position and size of a rectangle that should contain the children.

When defining a new subclass of layout using define-layout, a calculate-layout method must be provided that sets the position and size of each of the layout's children. This method must try to obey the constraints specified by its children (its minimum and maximum size) and should only break them when it becomes impossible to fit the constraints of all of the children. Use x, y, width and height to calculate a suitable position and size for each of the children and set them using the macro with-geometry, which works in a similar way to with-slots.

Examples
(example-edit-file "capi/layouts/buffer-layout")
(example-edit-file "capi/layouts/wrapping-layout")
See also

get-constraints
with-geometry
interpret-description
6 Laying Out CAPI Panes


CAPI User Guide and Reference Manual (Unix version) - 01 Dec 2021 19:32:42