| #include <stdio.h>
#include <descrip.h>
#include <decw$include/DECwDwtApplProg.h>
static void ok_button_activate();
static Widget toplevel, dialogmain;
static Widget ok_button;
static DwtCallback callback_arg[2];
static XtAppContext app_context;
int finished = FALSE;
Display *display;
Arg arglist[10];
static int number[]={0, 1, 2, 3, 4, 5};
static int FIRST = 1;
main()
{
int i;
for (i = 0; i<4; i++)
pvmenu();
}
pvmenu()
{
XrmOptionDescRec options;
int temp;
if (FIRST) {
XtToolkitInitialize ();
FIRST = FALSE;
app_context = XtCreateApplicationContext();
}
display = XtOpenDisplay (app_context, NULL, "PVI",
"pvclass", &options, 0, &number[0],
0);
XtSetArg (arglist[0], XtNallowShellResize, TRUE);
toplevel = XtAppCreateShell ("PVI", "pvclass",
applicationShellWidgetClass, display, arglist, 1);
XtSetArg (arglist[0], DwtNunits, DwtPixelUnits);
dialogmain = DwtDialogBoxCreate (toplevel, "MAINWIN", arglist,
1);
callback_arg[0].proc = ok_button_activate;
callback_arg[0].tag = 0;
callback_arg[1].proc = NULL;
XtSetArg (arglist[0], DwtNx, 10);
XtSetArg (arglist[1], DwtNy, 50);
XtSetArg (arglist[2], DwtNactivateCallback, callback_arg);
XtSetArg (arglist[3], DwtNlabel, DwtLatin1String ("OK"));
XtSetArg (arglist[4], DwtNbordHighlight, TRUE);
ok_button = DwtPushButtonGadgetCreate (dialogmain, "ok_button",
arglist,
5);
XtManageChild (ok_button);
XtManageChild (dialogmain);
XtRealizeWidget (toplevel);
finished = FALSE;
pvMainLoop();
XtDestroyWidget (ok_button);
XtDestroyWidget (dialogmain);
XtDestroyWidget (toplevel);
XtCloseDisplay (display);
/* XtDestroyApplicationContext (app_context);*/
XFlush(display);
}
pvMainLoop()
{
XEvent event;
while (!finished) {
XtAppNextEvent (app_context, &event);
XtDispatchEvent (&event);
}
}
static void ok_button_activate (widget, tag, callback_data)
Widget widget;
char *tag;
DwtAnyCallbackStruct *callback_data;
{
finished = TRUE;
}
|