Next: Space allocation, Up: Layout protocol
The space composition is accomplished by the generic function
compose-space
. When applied to a pane, compose-space
returns an object of type space-requirement indicating the needs
of the pane in terms of preferred size, minimum size and maximum size.
The phase starts when compose-space is applied to the top-level pane of
the application frame. That pane in turn may ask its children for their
space requirements, and so on until the leaves are reached. When the
top-level pane has computed its space requirments, it asks the system
for that much space. A conforming window manager should respect the
request (space wanted, min space, max space) and allocate a top-level
window of an acceptable size. The space given by the system must then
be distributed among the panes in the hierarchy
space-allocation.
Each type of pane is responsible for a different method on
compose-space
. Leaf panes such as labelled gadgets may
compute space requirements based on the size and the text-style of the
label. Other panes such as the vbox layout pane compute the space as a
combination of the space requirements of their children. The result of
such a query (in the form of a space-requirement object) is stored in
the pane for later use, and is only changed as a result of a call to
note-space-requirement-changed
.
Most composite panes can be given explicit values for the values
of :width
, :min-width
, :max-width
,
:height
, :min-height
, and :max-height
options. If such arguments are not given (effectively making these
values nil), a general method is used, such as computing from children
or, for leaf panes with no such reasonable default rule, a fixed value
is given. If such arguments are given, their values are used instead.
Notice that one of :height
and :width
might be
given, applying the rule only in one of the dimensions.
Subsequent calls to compose-space
with the same arguments are
assumed to return the same space-requirement object, unless a call to
note-space-requirement-changed has been called in between.