Keywords: LessTif

Next: 3. The query_geometry() Method Up: 2. The BulletinBoard Class Previous: 1. The change_managed() and Contents Index

## 2. The resize() Method

The resize() method is almost identical to the two described above. The most significant difference is that we aren't supposed to talk back in this method, but accept whatever size we currently are, and lay ourselves out accordingly. Thus, that method is missing the calls that request the manager ideal size, and just does layout. Compare the resize() method to the change_managed() method above:

_XmGMEnforceMargin_XmClearShadowType_XmGMDoLayout_XmDrawShadows

    static void
    resize(Widget w)
    {
        XmBulletinBoardClassRec *bb = (XmBulletinBoardClassRec *)XtClass(w);
        Widget p;

        if (bb->bulletin_board_class.geo_matrix_create) {
            handle_resize(w, bb->bulletin_board_class.geo_matrix_create);
            return;
        }
        _XmGMEnforceMargin(w, BB_MarginWidth(w), BB_MarginHeight(w), False);
        _XmClearShadowType(w, BB_OldWidth(w), BB_OldHeight(w),
                           BB_OldShadowThickness(w), 0);
        BB_OldShadowThickness(w) = 0;
        if (XtIsRealized(w) || XtWidth(w) == 0 || XtHeight(w) == 0) {
            _XmGMDoLayout(w, BB_MarginWidth(w), BB_MarginHeight(w),
                          BB_ResizePolicy(w), True);
        }
        if ((XtWidth(w) < BB_OldWidth(w) || XtHeight(w) < BB_OldHeight(w)) &&
            XtIsRealized(w)) {
            _XmDrawShadows(XtDisplay(w), XtWindow(w),
                           MGR_TopShadowGC(w), MGR_BottomShadowGC(w),
                           0, 0, XtWidth(w), XtHeight(w),
                           MGR_ShadowThickness(w), BB_ShadowType(w));
        }
        BB_OldWidth(w) = XtWidth(w);
        BB_OldHeight(w) = XtHeight(w);
        BB_OldShadowThickness(w) = MGR_ShadowThickness(w);
    }

You can also see the similarities in handle_resize() to handle_change_managed():

_XmGeoMatrixGet_XmGeoArrangeBoxes_XmGeoMatrixSet_XmClearShadowType_XmDrawShadows_XmGeoMatrixFree

    static void
    handle_resize(Widget w, XmGeoCreateProc mat_make)
    {
        Dimension wd, ht;
        XmGeoMatrix geo;

        wd = XtWidth(w);
        ht = XtHeight(w);
        geo = mat_make(w, NULL, NULL);
        _XmGeoMatrixGet(geo, XmGET_PREFERRED_SIZE);
        _XmGeoArrangeBoxes(geo, 0, 0, &wd, &ht);
        _XmGeoMatrixSet(geo);
        if (XtIsRealized(w)) {
            _XmClearShadowType(w, BB_OldWidth(w), BB_OldHeight(w),
                               BB_OldShadowThickness(w), 0);

            _XmDrawShadows(XtDisplay(w), XtWindow(w),
                           MGR_TopShadowGC(w), MGR_BottomShadowGC(w),
                           0, 0, XtWidth(w), XtHeight(w),
                           MGR_ShadowThickness(w), BB_ShadowType(w));
        }
        _XmGeoMatrixFree(geo);
        BB_OldWidth(w) = XtWidth(w);
        BB_OldHeight(w) = XtHeight(w);
        BB_OldShadowThickness(w) = MGR_ShadowThickness(w);
    }