#include #include #include #include #include #include #include "XrMisc.h" /* ARGSUSED */ static void DestroyParentCallback (w, client_data, call_data) Widget w; XtPointer client_data, call_data; { XtDestroyWidget (XtParent (w)); } /* ARGSUSED */ static void SetDialogPosition(w, client_data, call_data) Widget w; XtPointer client_data, call_data; { Position x, y, x1, y1; Dimension twidth, width, theight, height; Widget top = XtParent(w); XtVaGetValues (top, XmNx, &x, XmNy, &y, XmNwidth, &twidth, XmNheight, &theight, NULL); XtVaGetValues (w, XmNy, &x1, XmNy, &y1, XmNwidth, &width, XmNheight, &height, NULL); if (x1 != 0 && y1 != 0) return; XtVaSetValues (w, XmNx, x + (twidth - width) / 2, XmNy, y + (theight - height) / 2, NULL); } /* * This procedure builds an dialog box action area based on a list of * buttons passed to it. This code is based on the example in chapter 7 of * the O'Reilly & Associates Volume 6 by Dan Heller. */ Widget CreateButtonArea (name, parent, buttons, num_buttons, tightness, default_button) char *name; Widget parent; ActionAreaButton *buttons; int num_buttons; int tightness; int default_button; { Widget button_area, widget; register int i; Dimension height, h; button_area = XtVaCreateWidget (name, xmFormWidgetClass, parent, XmNfractionBase, tightness * num_buttons - 1, XmNskipAdjust, True, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL); for (i=0; i