#include <Xm/Xm.h>
#include <XmL/Progress.h>
Boolean compute();
Widget progress;
main(argc, argv)
int argc;
char *argv[];
{
XtAppContext app;
Widget shell;
shell = XtAppInitialize(&app, "Prog2", NULL, 0,
&argc, argv, NULL, NULL, 0);
progress = XtVaCreateManagedWidget("progress",
xmlProgressWidgetClass, shell,
XmNshowTime, True,
XtVaTypedArg, XmNbackground, XmRString, "white", 6,
XtVaTypedArg, XmNforeground, XmRString, "#800000", 8,
XmNwidth, 300,
XmNheight, 25,
NULL);
XtAppAddWorkProc(app, compute, NULL);
XtRealizeWidget(shell);
XtAppMainLoop(app);
}
Boolean compute(clientData)
XtPointer clientData;
{
int i;
XtVaSetValues(progress,
XmNvalue, 0,
XmNcompleteValue, 7,
NULL);
for (i = 0; i < 7; i++)
{
XtVaSetValues(progress,
XmNvalue, i,
NULL);
sleep(1);
}
XtVaSetValues(progress,
XmNvalue, i,
NULL);
return(FALSE);
}