The Prefab module, as a graphics "toolkit," provides higher-level graphics capabilities compared to the Draw module. There are still concepts and terms that should be introduced first.
Compound
defines boxes drawn on the screen. Each appears in a new window, Compound.image
, and holds a (possibly nil
) title
and contents
. It occupies the space on the screen defined by Compound.r
. Allocating a Compound
creates a window but does not draw it.
After the Compound
is built, Compound.draw
must be called to make it visible. Compounds have a border around them, drawn in Style.edgecolor
and contain, from top-to-bottom:
Applications should allocate a
Compound
only through the appropriate member functions. Moreover, except where indicated, applications should not modify the data members directly. Although the type definitions make data members visible, the members should be treated as read-only data.
The objects on the screen are of type Compound
, each of which occupies a unique window on the display and contains objects of type Element
. An Element
may be a single object or a list of Elements
that can be used to build structured components.
Applications should allocate an Element
only through the appropriate member functions. Moreover, except where indicated, applications should not modify the data members directly. Although the type definitions make data members visible, the members should be treated as read-only data.
Environ
type specifies the screen
and style
types for the element.
The screen
, of type ref Draw->Screen
, specifies where the elements are displayed.
The style
, of type Style
, specifies how the elements are drawn.
Style
type collects the font and color information for an application or a set of items within an application. Except when using Layout
, the members of Style
are the only way to control the appearance of Prefab elements.
The color members, elemcolor
, edgecolor
, titlecolor
, textcolor
and highlightcolor
typically refer to a literal color (a single replicated pixel of color). They are of type ref Draw->Image
, so they can be any image.
Styles are allocated by regular Limbo definitions. There are no allocation functions. All the members of a Style
must be defined. Although it will not cause errors to modify the members of a Style
after it has been created and passed to a Prefab function, the results may be unpredictable.
Layout
type defines a more general form of text and image display. It provides fine control over the font and color in which to display text and the inclusion of images as textual elements. It allows setting of the tag for each component of the resulting element or list of elements.