To help illustrate the distinction between bounds and allocated area, Figure 30 Bounds and
allocated area
The View System uses two distinct notions of a view's size: bounds and allocated area. The bounds of a view represent its "natural size" in its own coordinate system. A view's bounds are unaffected by how the view's parent transforms the view for display purposes. A view's allocated area is the space that the view's parent allocates for displaying the view.
If a child view's bounds are square, the child view naturally fits into the allocated area. This retains the width-to-height ratio, or aspect ratio, of the child view's bounds.
However, suppose you want to display an image whose bounds are not square, such as the line graph shown in Figure 31. Because the allocated area in this example is a fixed square, it is not possible to retain the aspect ratio of the child when rendering the child in the allocated area. The parent needs a layout policy to determine how to resolve the conflict between bounds and allocated area.
The View System provides no generic mechanism for resolving conflicts between the bounds of a child view and the allocated area in the parent view. Your implementation for the parent class determines how to resolve the conflict. Typically, the parent uses one of three approaches:
In every case, the parent determines the final result. Because the parent view owns its children, a child cannot set its own allocated area (unless the parent provides an explicit mechanism for doing so).
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Generated with WebMaker