[previous] [up] [next]     [contents] [index]
Next: Panels Up: Geometry Management Toolbox Previous: Geometry Management Toolbox

Child Classes

The following classes are the same as their core toolbox counterparts, but these classes work with automatic geometry management.

Additional properties are necessary for these objects to function as part of a container: default position, minimum size, and stretchability. Default position is used by mred:panel% and is discussed further in the next section. Each object must also be able to determine its minimum size. The actual size is platform-dependant, but it is always the smallest reasonable size the object can assume. For instance, a button's minimum size allows the entire text of the label to be visible, plus a small blank space around the edge. In addition, the objects must exhibit appropriate behavior when there is extra space in the container. Therefore, each object has a stretchability property in the x and y directions. The panel determines how stretchable and non-stretchable objects are treated, so this is discussed further in the next section. This stretchability property can be inspected and set by the child's stretchable-in-x and stretchable-in-y methods.

In order for a panel to correctly determine its minimum size or draw itself, it must know all of its children's properties. Therefore, each child has a get-info method which calculates and returns these properties in a mred:child-info struct. It has six fields:

Whenver these properties change, the overall window may change significantly in appearance, so the children need some method of notifying the rest of the window that one of their properties has changed. Each child has a force-redraw method for this purpose. (The actual calculation for a call to force-redraw may be delayed if an ancestor of the control is not visible to the user.)

These objects do not re-calculate their minimum sizes after their label is changed. A better approach to chaging the label is creating two items with different labels and replacing one item with the other as necessary. To implement list boxes and other items which contain multiple text items, create a list box with no label and use a mred:message% for its label.

The size initialization arguments to passed to make-object when constructing an object are ignored.

An object must be added to its panel so that the panel is aware of the object's size during a resize. A child is added to the end of its parent panel automatically upon instantiation; see the next section for more information about manipulating a panel's children.


[previous] [up] [next]     [contents] [index]
Next: Panels Up: Geometry Management Toolbox Previous: Geometry Management Toolbox

PLT