Next Previous Up Top Contents Index

7.3 DUIM-Layouts Module

<space-requirement>

Abstract instantiable class

Summary

The class of all space requirement objects.

Superclasses

<object>

Init-keywords

width:
An instance of type <integer>. Default value: $fill.

min-width:
An instance of type <integer>. Default value: width.

max-width:
An instance of type <integer>. Default value: width.

height:
An instance of type <integer>. Default value: $fill.

min-height:
An instance of type <integer>. Default value: height.

max-height:
An instance of type <integer>. Default value: height.

label:
An instance of type type-union(<string>, <image>).

Library

duim-layouts

Module

duim-layouts

Description

The class of all space requirement objects. This type of object is used to reserve space when it is required in a layout in order to accommodate gadgets or other layouts.

The various init-keywords let you constrain the width and height of the object in a variety of ways.

If no init-keywords are specified, the object returned tries to fill all the available space.

Specifying width: or height: specifies the preferred width or height of the object.

Specifying any of the min- or max- init-keywords lets you minimum and maximum width or height for the object.

The following inequalities hold for all widths and heights:

min-height: <= height: <= max-height:
min-width: <= width: <= max-width:

If either min-width: or min-height: is 0, the object is "infinitely shrinkable" in that direction. If either max-width: or max-height: is $fill, the object is "infinitely stretchable" in that direction. The latter is a particularly useful way of ensuring that objects fill the available width, and can be used, say, to ensure that a series of buttons fill the entire width of the layout that they occupy.

An example of the use of max-width: to force the size of a button to fit the available space can be found in the entry for <button>, page 532.

The label: init-keyword specifies a label which is measured to give the preferred width and height.

Operations

space-requirement-height space-requirement-max-height space-requirement-max-width space-requirement-min-height space-requirement-min-width
space-requirement-width

Example

Given the following definition of a button class:

define class <basic-test-button>
    (<leaf-pane>)
end class <basic-test-button>;

The following method for do-compose-space creates the necessary space requirements to accommodate the new button class in a layout.

define method do-compose-space
    (pane :: <basic-test-button>, #key width, height)
 => (space-req :: <space-requirement>)
  ignore(width, height);
  make(<space-requirement>,
       width: 40,
       height: 15)
end method do-compose-space;

See also

$fill, page 465


Functional Developer Library Reference: DUIM - 3 Dec 1998

Next Previous Up Top Contents Index