next up previous contents index
Next: 5. The set_values() Method Up: 2. The BulletinBoard Class Previous: 3. The query_geometry() Method   Contents   Index

4. The geometry_manager() Method

Similar to the query_geometry() method, the geometry_manager() method passes the buck on complexity. It looks somewhat like the change_managed(), resize(), and realize() methods, but does both less and more. It does less in terms of code in BulletinBoard, but the code in the GeoUtils is much more complex, and uses little of the code that the other three methods use. Also, the geometry_manager() method uses the ``cache'' variable in the BulletinBoard Widget instance, for repeated calls to geometry_mananger() when geometry_manager() returns XtGeometryAlmost.


static XtGeometryResult
geometry_manager(Widget w, XtWidgetGeometry *desired,
                 XtWidgetGeometry *allowed)
    Widget bb = XtParent(w);
    XmBulletinBoardWidgetClass bbc = (XmBulletinBoardWidgetClass)XtClass(bb);

    if (bbc->bulletin_board_class.geo_matrix_create) {
        return handle_geometry_manager(w, desired, allowed,
    return _XmGMHandleGeometryManager(bb, w, desired, allowed,

If you read the handle_geometry_manager() code below, you'll see a similarity to the
change_managed(), realize(), and resize() code above.


static XtGeometryResult
handle_geometry_manager(Widget w,
                        XtWidgetGeometry *desired, XtWidgetGeometry *allowed,
                        XmGeoCreateProc mat_make)
    Widget bb = XtParent(w);
    XmBulletinBoardWidgetClass bbc = (XmBulletinBoardWidgetClass)XtClass(bb);
    XtGeometryResult res;

    if (!!(desired->request_mode & (CWWidth|CWHeight)))
        return XtGeometryYes;
    if (BB_OldShadowThickness(bb) !!= 0 ||
        BB_ResizePolicy(bb) !!= XmRESIZE_NONE) {
        _XmClearShadowType(bb, BB_OldWidth(bb), BB_OldHeight(bb),
                           BB_OldShadowThickness(bb), 0);
        BB_OldShadowThickness(bb) = 0;
    res = _XmHandleGeometryManager(bb, w, desired, allowed,
                                   BB_ResizePolicy(bb), &BB_GeoCache(bb),
    if (!!BB_InSetValues(bb) ||
        XtWidth(bb) > BB_OldWidth(bb) || XtHeight(bb) > BB_OldHeight(bb)) {
        if (XtIsRealized(bb)) {
            _XmDrawShadows(XtDisplay(bb), XtWindow(bb),
                         MGR_TopShadowGC(bb), MGR_BottomShadowGC(bb),
                         0, 0, XtWidth(bb), XtHeight(bb),
                         MGR_ShadowThickness(bb), BB_ShadowType(bb));
    BB_OldWidth(bb) = XtWidth(bb);
    BB_OldHeight(bb) = XtHeight(bb);
    return res;

Finally, we should discuss the set_values() method.

Danny Backx