model_server/ui_misc/src/ProgressBar.cxx
// Specify the widget layout of the dialog box:
Specify the widget layout of the dialog box.
Specify the widget layout of the dialog box .
void ProgressBar::BuildDialog(Widget w)
{
  static const int xyoff = 15;         
  static const Dimension xbar = 350;   
  static const Dimension ybar = 24;    
  static const Dimension xnum = 40;
  static const Dimension ynum = 24;
  static const Dimension xdlg = xbar + 200;
   Build the widgets and arrange them:
  dialog = XmCreateFormDialog(w, "progress_bar", NULL, 0);
  XtVaSetValues(dialog, XmNnoResize, True, XmNwidth, xdlg, NULL);
  XtVaSetValues(XtParent(dialog),
		XmNtitle, "DIScover",
		XmNallowShellResize, True,
		XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
		NULL);
  if (is_splash) {
    splash_frame = XtVaCreateWidget("splash_frame",
				    xmFrameWidgetClass, dialog,
				    XmNtopAttachment, XmATTACH_FORM,
				    XmNleftAttachment, XmATTACH_FORM,
				    XmNrightAttachment, XmATTACH_FORM,
				    XmNshadowType, XmSHADOW_IN,
				    NULL);
    splash_subform = XtVaCreateWidget("splash_subform",
				      xmFormWidgetClass, splash_frame,
				      NULL);
    char **pd[] = { splash };
    Pixmap xpm[1];
    Pixmap mask[1];
    AllocXpm(xpm, dialog, 1, pd, mask);
    splash_label = XtVaCreateWidget("splash_label",
				    xmLabelWidgetClass, splash_subform,
				    XmNtopAttachment, XmATTACH_FORM,
				    XmNleftAttachment, XmATTACH_FORM,
				    XmNlabelType, XmPIXMAP,
				    XmNlabelPixmap, xpm[0],
				    XmNbackground, WhitePixelOfScreen(XtScreen(parent)),
				    XmNforeground, BlackPixelOfScreen(XtScreen(parent)),
				    NULL);
    msg_label = XtVaCreateWidget("msg_label",
			         xmLabelWidgetClass, dialog,
			         XmNleftAttachment, XmATTACH_FORM,
			         XmNtopAttachment, XmATTACH_WIDGET,
			         XmNtopWidget, splash_frame,
			         XmNleftOffset, xyoff,
			         XmNtopOffset, xyoff,
			         NULL);
  }
  else {
    msg_label = XtVaCreateWidget("msg_label",
			         xmLabelWidgetClass, dialog,
			         XmNtopAttachment, XmATTACH_FORM,
			         XmNleftAttachment, XmATTACH_FORM,
			         XmNleftOffset, xyoff,
			         XmNtopOffset, xyoff,
			         NULL);
  }
  Widget num_frame = XtVaCreateWidget("num_frame",
				      xmFrameWidgetClass, dialog,
				      XmNshadowType, XmSHADOW_IN,
				      XmNbottomAttachment, XmATTACH_FORM,
				      XmNrightAttachment, XmATTACH_FORM,
				      XmNtopAttachment, XmATTACH_WIDGET,
				      XmNtopWidget, msg_label,
				      XmNrightOffset, xyoff,
				      XmNbottomOffset, xyoff,
				      XmNtopOffset, xyoff,
				      NULL);
  num_canvas = XmCreateDrawingArea(num_frame, "num_canvas", NULL, 0);
  XtVaSetValues(num_canvas,
		XmNbackground, WhitePixelOfScreen(XtScreen(w)),
		NULL);
  Widget bar_frame = XtVaCreateWidget("bar_frame",
				      xmFrameWidgetClass, dialog,
				      XmNshadowType, XmSHADOW_IN,
				      XmNbottomAttachment, XmATTACH_FORM,
				      XmNrightAttachment, XmATTACH_WIDGET,
				      XmNrightWidget, num_frame,
				      XmNleftAttachment, XmATTACH_FORM,
				      XmNrightOffset, 5,
				      XmNleftOffset, xyoff,              
				      XmNbottomOffset, xyoff,
				      XmNtopAttachment, XmATTACH_WIDGET,
				      XmNtopWidget, msg_label,
				      XmNtopOffset, xyoff,
				      NULL);
  canvas = XmCreateDrawingArea(bar_frame, "canvas", NULL, 0);
  XtVaSetValues(canvas,
		XmNbackground, WhitePixelOfScreen(XtScreen(w)),
		NULL);
  XtManageChild(dialog);
  if (is_splash) {
    XtManageChild(splash_frame);
    XtManageChild(splash_subform);
    XtManageChild(splash_label);
  }
  XtManageChild(msg_label);
  XtManageChild(num_frame);
  XtManageChild(num_canvas);
  XtManageChild(bar_frame);
  XtManageChild(canvas);
   Hack to compensate for inconsistencies in our X support (specify the size
   after the lower frame has been managed):
  XtVaSetValues(bar_frame, XmNwidth, xbar, XmNheight, ybar, NULL);
  XtVaSetValues(num_frame, XmNwidth, xnum, XmNheight, ynum, NULL);
  SetMessage(default_msg);
  DrawBar();
  XtAddCallback(canvas, XmNexposeCallback, ExposeCB, (XtPointer)this);
}
void ProgressBar :: BuildDialog ( Widget w ) { static const int xyoff = 15 ; static const Dimension xbar = 350 ; static const Dimension ybar = 24 ; static const Dimension xnum = 40 ; static const Dimension ynum = 24 ; static const Dimension xdlg = xbar + 200 ; dialog = XmCreateFormDialog ( w , " " , NULL , 0 ) ; XtVaSetValues ( dialog , XmNnoResize , True , XmNwidth , xdlg , NULL ) ; XtVaSetValues ( XtParent ( dialog ) , XmNtitle , " " , XmNallowShellResize , True , XmNdialogStyle , XmDIALOG_FULL_APPLICATION_MODAL , NULL ) ; if ( is_splash ) { splash_frame = XtVaCreateWidget ( " " , xmFrameWidgetClass , dialog , XmNtopAttachment , XmATTACH_FORM , XmNleftAttachment , XmATTACH_FORM , XmNrightAttachment , XmATTACH_FORM , XmNshadowType , XmSHADOW_IN , NULL ) ; splash_subform = XtVaCreateWidget ( " " , xmFormWidgetClass , splash_frame , NULL ) ; char * * pd [ ] = { splash } ; Pixmap xpm [ 1 ] ; Pixmap mask [ 1 ] ; AllocXpm ( xpm , dialog , 1 , pd , mask ) ; splash_label = XtVaCreateWidget ( " " , xmLabelWidgetClass , splash_subform , XmNtopAttachment , XmATTACH_FORM , XmNleftAttachment , XmATTACH_FORM , XmNlabelType , XmPIXMAP , XmNlabelPixmap , xpm [ 0 ] , XmNbackground , WhitePixelOfScreen ( XtScreen ( parent ) ) , XmNforeground , BlackPixelOfScreen ( XtScreen ( parent ) ) , NULL ) ; msg_label = XtVaCreateWidget ( " " , xmLabelWidgetClass , dialog , XmNleftAttachment , XmATTACH_FORM , XmNtopAttachment , XmATTACH_WIDGET , XmNtopWidget , splash_frame , XmNleftOffset , xyoff , XmNtopOffset , xyoff , NULL ) ; } else { msg_label = XtVaCreateWidget ( " " , xmLabelWidgetClass , dialog , XmNtopAttachment , XmATTACH_FORM , XmNleftAttachment , XmATTACH_FORM , XmNleftOffset , xyoff , XmNtopOffset , xyoff , NULL ) ; } Widget num_frame = XtVaCreateWidget ( " " , xmFrameWidgetClass , dialog , XmNshadowType , XmSHADOW_IN , XmNbottomAttachment , XmATTACH_FORM , XmNrightAttachment , XmATTACH_FORM , XmNtopAttachment , XmATTACH_WIDGET , XmNtopWidget , msg_label , XmNrightOffset , xyoff , XmNbottomOffset , xyoff , XmNtopOffset , xyoff , NULL ) ; num_canvas = XmCreateDrawingArea ( num_frame , " " , NULL , 0 ) ; XtVaSetValues ( num_canvas , XmNbackground , WhitePixelOfScreen ( XtScreen ( w ) ) , NULL ) ; Widget bar_frame = XtVaCreateWidget ( " " , xmFrameWidgetClass , dialog , XmNshadowType , XmSHADOW_IN , XmNbottomAttachment , XmATTACH_FORM , XmNrightAttachment , XmATTACH_WIDGET , XmNrightWidget , num_frame , XmNleftAttachment , XmATTACH_FORM , XmNrightOffset , 5 , XmNleftOffset , xyoff , XmNbottomOffset , xyoff , XmNtopAttachment , XmATTACH_WIDGET , XmNtopWidget , msg_label , XmNtopOffset , xyoff , NULL ) ; canvas = XmCreateDrawingArea ( bar_frame , " " , NULL , 0 ) ; XtVaSetValues ( canvas , XmNbackground , WhitePixelOfScreen ( XtScreen ( w ) ) , NULL ) ; XtManageChild ( dialog ) ; if ( is_splash ) { XtManageChild ( splash_frame ) ; XtManageChild ( splash_subform ) ; XtManageChild ( splash_label ) ; } XtManageChild ( msg_label ) ; XtManageChild ( num_frame ) ; XtManageChild ( num_canvas ) ; XtManageChild ( bar_frame ) ; XtManageChild ( canvas ) ; XtVaSetValues ( bar_frame , XmNwidth , xbar , XmNheight , ybar , NULL ) ; XtVaSetValues ( num_frame , XmNwidth , xnum , XmNheight , ynum , NULL ) ; SetMessage ( default_msg ) ; DrawBar ( ) ; XtAddCallback ( canvas , XmNexposeCallback , ExposeCB , ( XtPointer ) this ) ; }
Specify the widget layout of the dialog box:
Specify the widget layout of the dialog box :
// Default horizontal and vertical offset // Width of bar canvas // Height of bar canvas // Width of dialog (theoretically we shouldn't need this, because the dialog // should auto-size itself in response to the size requests of its children. // However, our broken version of Motif doesn't support this, so we need to // explicitly give the width): // // Build the widgets and arrange them: // // Hack to compensate for inconsistencies in our X support (specify the size // after the lower frame has been managed):