Keywords: LessTif

Next: 3. Computing the Layout Up: 2. Layout Management Functions Previous: 1. Querying the Children Contents Index

### 2. Computing the Desired Size

The next function is the real workhorse in layout computation. Basically, it takes the information that was recorded from the previous step and determines how that would make us look. It uses values in the GeoMatrix, the MajorLayoutRec, and the KidGeometryRec to determine this. It uses this information, in combination with the input parameters, to determine how the total composite should look.

_XmGeoArrangeBoxes

    void
    _XmGeoArrangeBoxes(XmGeoMatrix geoSpec, Position x, Position y,
                       Dimension *pW, Dimension *pH);

The pseudo code for this function is as follows:

_XmGeoAdjustBoxes_XmGeoGetDimensions_XmGeoArrangeList_XmGeoStretchVertical_XmGeoFillVertical

    _XmGeoArrangeBoxes()
    {
        if (°user specified an arrange procedure°) {
            °call user's arrange°
            return
        }
        _XmGeoAdjustBoxes()
        _XmGeoGetDimensions()

        °adjust the overall layout based on the input parameters°

        while (°rows remaining°)
            _XmGeoArrangeList(row);
        if (°height needs adjusting°) {
            if (°user allows stretching°)
                _XmGeoStretchVertical()
            else
                _XmGeoFillVertical()
        }
    }

_XmGeoArrangeBoxes_XmGeoArrangeBoxes() calls this next function to determine the overall layout. In the current implementation, _XmGeoAdjustBoxes() loops through the rows in the composite, figuring out how each row would look.

    void _XmGeoAdjustBoxes(XmGeoMatrix geoSpec);

The pseudo code for this function is as follows:

    _XmGeoAdjustBoxes()
    {
        while (°rows remaining°) {
            if (°children in row should be even width°)
                _XmGeoBoxesSameWidth();
            if (°children in row should be even height°)
                _XmGeoBoxesSameHeight();
            if (°children in row should have the same border°)
                °adjust the border°
        }
    }

If the relevant flags are set in the MajorLayoutRec, _XmGeoAdjustBoxes() invokes the following two functions:

_XmGeoBoxesSameWidth_XmGeoBoxesSameHeight

    Dimension
    _XmGeoBoxesSameWidth(XmKidGeometry rowPtr, Dimension width);
    Dimension
    _XmGeoBoxesSameHeight(XmKidGeometry rowPtr, Dimension height);

Next, _XmGeoArrangeBoxes() calls this next function to compute the total picture of the desired geometry. This function takes the overal results computed above, and adjusts values in the Matrix and Layout data structures.

_XmGeoGetDimensions

    void
    _XmGeoGetDimensions(XmGeoMatrix geoSpec);

Next: 3. Computing the Layout Up: 2. Layout Management Functions Previous: 1. Querying the Children Contents Index