[previous] [up] [next]     [index]
Next: Mouse and Keyboard Events Up: Geometry Management Previous: Containers

Defining New Types of Containers

Although nested horizontal and vertical containers can express most layout patterns, a programmer can define a new type of container with an explicit layout procedure. A programmer defines a new type of container by deriving a class from panel% or pane% and overriding the container-size and place-children methods. The container-size method takes a list of size specifications for each child and returns two values: the minimum height and width of the container. The place-children method takes the container's size and a list of size specifications for each child, and returns a list of sizes and placements (in parallel to the original list).

A input size specification is a list of four values:

For place-children, an output position and size specification is a list of four values:

The widths and heights for both the input and output include the children's margins. The returned position for each child is automatically incremented to account for the child's margin in placing the control.



PLT