/************************************************************************ * * QueryGeometry * return width X height based on the children preferred sizes * ************************************************************************/ static XtGeometryResult QueryGeometry( Widget widget, XtWidgetGeometry *intended, XtWidgetGeometry *desired ) { Dimension work_width = 0, work_height = 0, work_bw = 0 ; Dimension title_width = 0, title_height = 0, title_bw = 0 ; XtWidgetGeometry child_pref ; XmFrameWidget fw = (XmFrameWidget) widget ; /* first determine what is the desired size, using the preferred sizes of the title and the work_area, or the current setting if no preference are given */ if (fw->frame.work_area) { XtQueryGeometry (fw->frame.work_area, NULL, &child_pref); if (IsWidth(&child_pref)) work_width = child_pref.width ; else work_width = XtWidth(fw->frame.work_area); if (IsHeight(&child_pref)) work_height = child_pref.height ; else work_height = XtHeight(fw->frame.work_area); if (IsBorder(&child_pref)) work_bw = child_pref.border_width ; else work_bw = XtBorderWidth(fw->frame.work_area); } if (fw->frame.title_area) { XtQueryGeometry (fw->frame.title_area, NULL, &child_pref); if (IsWidth(&child_pref)) title_width = child_pref.width ; else title_width = XtWidth(fw->frame.title_area); if (IsHeight(&child_pref)) title_height = child_pref.height ; else title_height = XtHeight(fw->frame.title_area); if (IsBorder(&child_pref)) title_bw = child_pref.border_width ; else title_bw = XtBorderWidth(fw->frame.title_area); } CalcFrameSize (fw, title_width, title_height, title_bw, work_width, work_height, work_bw, &desired->width, &desired->height); /* deal with user initial size setting */ if (!XtIsRealized(widget)) { if (XtWidth(widget) != 0) desired->width = XtWidth(widget) ; if (XtHeight(widget) != 0) desired->height = XtHeight(widget) ; } return XmeReplyToQueryGeometry(widget, intended, desired) ; }
/**************************************************************** * Handle query geometry requests for both BB and DA. ****************/ XtGeometryResult _XmGMHandleQueryGeometry(Widget widget, XtWidgetGeometry * intended, XtWidgetGeometry * desired, #if NeedWidePrototypes int margin_width, int margin_height, #else Dimension margin_width, Dimension margin_height, #endif /* NeedWidePrototypes */ int resize_policy) { Dimension width, height ; /* first determine what is the desired size, using the resize_policy. */ if (resize_policy == XmRESIZE_NONE) { desired->width = XtWidth(widget) ; desired->height = XtHeight(widget) ; } else { if (GMode( intended) & CWWidth) width = intended->width; if (GMode( intended) & CWHeight) height = intended->height; _XmGMCalcSize ((XmManagerWidget)widget, margin_width, margin_height, &width, &height); if ((resize_policy == XmRESIZE_GROW) && ((width < XtWidth(widget)) || (height < XtHeight(widget)))) { desired->width = XtWidth(widget) ; desired->height = XtHeight(widget) ; } else { desired->width = width ; desired->height = height ; } } /* deal with user initial size setting */ if (!XtIsRealized(widget)) { if (XtWidth(widget) != 0) desired->width = XtWidth(widget) ; if (XtHeight(widget) != 0) desired->height = XtHeight(widget) ; } return XmeReplyToQueryGeometry(widget, intended, desired) ; }
/****************************************************************************** * * QueryGeometry: * Called by the Intrinsics in response to a proposed changed in geometry. * *****************************************************************************/ static XtGeometryResult QueryGeometry ( Widget widget, XtWidgetGeometry *parent_request, XtWidgetGeometry *child_reply ) { ExmSimpleWidget sw = (ExmSimpleWidget) widget; if (!XtIsRealized(widget)) { /* Simple has not yet been realized. */ child_reply->width = XtWidth(widget); /* might be 0 */ child_reply->height = XtHeight(widget); /* might be 0 */ } else { /* Simple has been realized. */ child_reply->width = sw->simple.pref_width; child_reply->height = sw->simple.pref_height; } /* Return Simple's preferred size */ return XmeReplyToQueryGeometry(widget, parent_request, child_reply); }