int main(int argc, char *argv[]) { Widget rc, frame1, label; XtSetLanguageProc(NULL, NULL, NULL); top = XtVaAppInitialize(&app_context, "Test-prog", NULL, 0, &argc, argv, NULL, NULL); main_window = XtVaCreateManagedWidget("mainwin", xmMainWindowWidgetClass, top, NULL); XmRepTypeInstallTearOffModelConverter(); menubar = XmCreateMenuBar(main_window, "menubar", NULL, 0); XtManageChild(menubar); XmMainWindowSetAreas(main_window,menubar,NULL,NULL,NULL,NULL); rc = XtVaCreateWidget("rc", xmRowColumnWidgetClass, main_window, NULL); XtVaSetValues(main_window, XmNworkWindow, rc, NULL); XtManageChild(rc); frame1 = XtVaCreateWidget("frame1", xmFrameWidgetClass, rc, NULL); XtManageChild(frame1); XtRealizeWidget(top); label = XtVaCreateManagedWidget("Rampaging Bulldozers", xmLabelWidgetClass, frame1, NULL); { static XtWidgetGeometry Expected[] = { CWWidth | CWHeight , 56, 72, 16, 32, 0,0,0, /* mainwin */ CWWidth | CWHeight | CWX | CWY, 0, 0, 16, 16, 0,0,0, /* menubar */ CWWidth | CWHeight | CWX | CWY, 0, 16, 16, 16, 0,0,0, /* rc */ CWWidth | CWHeight | CWX | CWY, 3, 3, 10, 4, 0,0,0, /* frame1 */ CWWidth | CWHeight | CWX | CWY, 2, 2, 6, 1, 0,0,0, /* Rampaging Bulldozers */ }; /* toplevel should be replaced with to correct applicationShell */ PrintDetails(top, Expected); } LessTifTestMainLoop(top); exit(0); }
int main(int argc, char **argv) { XtAppContext theApp; Widget toplevel, rc; Widget cascade1; Widget pane1; Widget w; Arg al[5]; int ac; /* Install converter to make the command line indicated above work */ XmRepTypeInstallTearOffModelConverter(); /* Toplevel and Menu Bar */ toplevel = XtVaAppInitialize(&theApp, "test1", NULL, 0, &argc, argv, fallback, NULL); rc = XmCreateMenuBar(toplevel, "menubar", NULL, 0); /* First Menu */ ac = 0; XtSetArg(al[ac], XmNnumColumns, 2); ac++; pane1 = XmCreatePulldownMenu(rc, "pane1", al, ac); cascade1 = XtVaCreateManagedWidget("cascade1", xmCascadeButtonWidgetClass, rc, XmNsubMenuId, pane1, NULL); w = XtVaCreateManagedWidget("button1", xmPushButtonWidgetClass, pane1, NULL); XtAddCallback(w, XmNactivateCallback, MakeDialog, NULL); XtManageChild(rc); XtRealizeWidget(toplevel); { static XtWidgetGeometry Expected[] = { CWWidth | CWHeight , 56, 72, 50, 31, 0,0,0, /* menubar */ CWWidth | CWHeight | CWX | CWY, 5, 5, 40, 21, 0,0,0, /* cascade1 */ }; /* toplevel should be replaced with to correct applicationShell */ PrintDetails(toplevel, Expected); } LessTifTestMainLoop(toplevel); exit(0); }
int main( int argc, char **argv) { Widget parent; XtAppContext app; Arg args[256]; Cardinal ac; Boolean argok=False; Widget topLevelShell; Widget mb3dsdg_mainWindow; /* Begin user code block <declarations> */ /* End user code block <declarations> */ /* * Initialize Xt. */ // XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); /* * The applicationShell is created as an unrealized * parent for multiple topLevelShells. The topLevelShells * are created as popup children of the applicationShell. * This is a recommendation of Paul Asente & Ralph Swick in * _X_Window_System_Toolkit_ p. 677. */ parent = XtVaOpenApplication ( &app, BX_APP_CLASS, NULL, 0, &argc, argv, NULL, sessionShellWidgetClass, NULL ); RegisterBxConverters(app); XmRepTypeInstallTearOffModelConverter(); /* Begin user code block <create_shells> */ /* End user code block <create_shells> */ /* * Create classes and widgets used in this program. */ /* Begin user code block <create_topLevelShell> */ /* End user code block <create_topLevelShell> */ ac = 0; XtSetArg(args[ac], XmNtitle, "MBgrdviz"); ac++; XtSetArg(args[ac], XmNx, 747); ac++; XtSetArg(args[ac], XmNy, 78); ac++; XtSetArg(args[ac], XmNwidth, 197); ac++; XtSetArg(args[ac], XmNheight, 104); ac++; topLevelShell = XtCreatePopupShell((char *)"topLevelShell", topLevelShellWidgetClass, parent, args, ac); mb3dsdg_mainWindow = (Widget)Createmb3dsdg_mainWindow(topLevelShell); XtManageChild(mb3dsdg_mainWindow); XtPopup(XtParent(mb3dsdg_mainWindow), XtGrabNone); /* Begin user code block <app_procedures> */ /* End user code block <app_procedures> */ /* Begin user code block <main_loop> */ /* End user code block <main_loop> */ XtAppMainLoop(app); /* * A return value regardless of whether or not the main loop ends. */ return(0); }
int main( int argc, char **argv) { Widget parent; XtAppContext app; Arg args[256]; Cardinal ac; Boolean argok=False; Widget topLevelShell; Widget mainWindow_mbgrdviz; /* Begin user code block <declarations> */ int error = MB_ERROR_NO_ERROR; int verbose = 0; int ifileflag = 0; int jfileflag = 0; int testflag = 0; /* process argument list */ while ((c = getopt(argc, argv, "VvHhI:i:J:j:Tt")) != -1) { switch (c) { case 'H': case 'h': help++; break; case 'V': case 'v': verbose++; break; case 'I': case 'i': sscanf (optarg,"%s", ifile); flag++; ifileflag++; break; case 'J': case 'j': sscanf (optarg,"%s", jfile); flag++; jfileflag++; break; case 'T': case 't': flag++; testflag++; break; case '?': errflg++; } } /* if error flagged then print it and exit */ if (errflg) { fprintf(stderr,"usage: %s\n", usage_message); fprintf(stderr,"\nProgram <%s> Terminated\n", program_name); error = MB_ERROR_BAD_USAGE; exit(error); } /* print starting message */ if (verbose == 1 || help) { fprintf(stderr,"\nProgram %s\n",program_name); fprintf(stderr,"MB-system Version %s\n",MB_VERSION); } /* print starting message */ if (help) { fprintf(stderr,"\n%s\n\nUsage: %s\n", help_message, usage_message); error = MB_ERROR_NO_ERROR; exit(error); } /* End user code block <declarations> */ /* * Initialize Xt. */ XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); /* * The applicationShell is created as an unrealized * parent for multiple topLevelShells. The topLevelShells * are created as popup children of the applicationShell. * This is a recommendation of Paul Asente & Ralph Swick in * _X_Window_System_Toolkit_ p. 677. */ parent = XtVaOpenApplication ( &app, BX_APP_CLASS, NULL, 0, &argc, argv, NULL, sessionShellWidgetClass, NULL ); RegisterBxConverters(app); XmRepTypeInstallTearOffModelConverter(); /* Begin user code block <create_shells> */ /* End user code block <create_shells> */ /* * Create classes and widgets used in this program. */ /* Begin user code block <create_topLevelShell> */ /* End user code block <create_topLevelShell> */ ac = 0; XtSetArg(args[ac], XmNtitle, "MBgrdviz"); ac++; XtSetArg(args[ac], XmNx, 108); ac++; XtSetArg(args[ac], XmNy, 241); ac++; XtSetArg(args[ac], XmNwidth, 260); ac++; XtSetArg(args[ac], XmNheight, 215); ac++; topLevelShell = XtCreatePopupShell((char *)"topLevelShell", topLevelShellWidgetClass, parent, args, ac); XtAddCallback(topLevelShell, XmNdestroyCallback, do_mbgrdviz_quit, (XtPointer)0); XtAddCallback(topLevelShell, XmNdestroyCallback, BxExitCB, (XtPointer)0); mainWindow_mbgrdviz = (Widget)CreatemainWindow_mbgrdviz(topLevelShell); XtManageChild(mainWindow_mbgrdviz); XtPopup(XtParent(mainWindow_mbgrdviz), XtGrabNone); /* Begin user code block <app_procedures> */ /* set top level widget */ mainWindow = mainWindow_mbgrdviz; /* End user code block <app_procedures> */ /* Begin user code block <main_loop> */ /* initialize the vizualization widgets code */ mbview_startup(verbose, parent, app, &error); /* open the file specified on the command line */ do_mbgrdviz_init(argc,argv, verbose); if (ifileflag > 0) { do_mbgrdviz_openprimary(ifile); if (jfileflag > 0) { do_mbgrdviz_openoverlay(0,jfile); } } else if (testflag > 0) { do_mbgrdviz_openprimary(NULL); } /* End user code block <main_loop> */ XtAppMainLoop(app); /* * A return value regardless of whether or not the main loop ends. */ return(0); }
int main(int argc, char **argv) { /* Install converter to make the command line indicated above work */ XmRepTypeInstallTearOffModelConverter(); /* Toplevel and Menu Bar */ toplevel = XtVaAppInitialize(&app_context, "test50", NULL, 0, &argc, argv, fallback, NULL); menubar = XmCreateMenuBar(toplevel, "menubar", NULL, 0); { XmRowColumnPart *rc = &((XmRowColumnWidget)menubar)->row_column; rc->ParentShell = NULL; rc->tear_off_focus_item = NULL; } /* First Menu */ pane1 = XmCreatePulldownMenu(menubar, "pane1", NULL, 0); { XmRowColumnPart *rc = &((XmRowColumnWidget)pane1)->row_column; rc->ParentShell = NULL; rc->tear_off_focus_item = NULL; } /* XtAddCallback(pane1, XmNmapCallback, (void *)GenericCallback, (XtPointer)__LINE__); XtAddCallback(pane1, XmNtearOffMenuActivateCallback, (void *)GenericCallback, (XtPointer)__LINE__); XtAddCallback(pane1, XmNtearOffMenuDeactivateCallback, (void *)GenericCallback, (XtPointer)__LINE__); XtAddCallback(pane1, XmNunmapCallback, (void *)GenericCallback, (XtPointer)__LINE__); XtAddCallback(XtParent(pane1), XmNpopupCallback, (void *)GenericCallback, (XtPointer)__LINE__); XtAddCallback(XtParent(pane1), XmNpopdownCallback, (void *)GenericCallback, (XtPointer)__LINE__); */ pane1_tear_off = XmGetTearOffControl(pane1); cascade1 = XtVaCreateManagedWidget("cascade1", xmCascadeButtonWidgetClass, menubar, XmNsubMenuId, pane1, NULL); /* XtAddCallback(cascade1, XmNactivateCallback, (void *)GenericCallback, (XtPointer)__LINE__); XtAddCallback(cascade1, XmNcascadingCallback, (void *)GenericCallback, (XtPointer)__LINE__); */ button1 = XtVaCreateManagedWidget("button1", xmPushButtonWidgetClass, pane1, NULL); XtManageChild(menubar); XtRealizeWidget(toplevel); LessTifTestWaitForIt(toplevel); printf("%7s %17s %15s %9s %11s %11s %11s %11s %17s %8s %11s %11s %s\n", "widget", "parent", "type", "arm", "cascadeBtn", "mem", "last", "popup", "shell", "torn", "to_last", "focus", "\n"); Report(); LessTifTestBtn1Down(cascade1); Report(); LessTifTestBtn1Up(pane1_tear_off); Report(); /* XtCallActionProc(XtParent(pane1_tear_off), "MenuEscape", NULL, NULL, 0); Report(); */ LessTifTestMainLoop(toplevel); exit(0); }
int main( int argc, char **argv) { Widget parent; XtAppContext app; Arg args[256]; Cardinal ac; Widget topLevelShell; Widget mainWindow; /* Begin user code block <declarations> */ /* make sure that the argc that goes to XtVaAppInitialize is 1 so that no options are removed by its option parsing */ int argc_save; argc_save = argc; argc = 1; /* End user code block <declarations> */ /* * Initialize Xt. */ XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); /* * The applicationShell is created as an unrealized * parent for multiple topLevelShells. The topLevelShells * are created as popup children of the applicationShell. * This is a recommendation of Paul Asente & Ralph Swick in * _X_Window_System_Toolkit_ p. 677. */ parent = XtVaOpenApplication ( &app, BX_APP_CLASS, NULL, 0, &argc, argv, NULL, sessionShellWidgetClass, NULL ); RegisterBxConverters(app); XmRepTypeInstallTearOffModelConverter(); /* Begin user code block <create_shells> */ /* End user code block <create_shells> */ /* * Create classes and widgets used in this program. */ /* Begin user code block <create_topLevelShell> */ /* End user code block <create_topLevelShell> */ ac = 0; XtSetArg(args[ac], XmNtitle, "MBnavadjust"); ac++; XtSetArg(args[ac], XmNiconName, "MBnavadjust"); ac++; XtSetArg(args[ac], XmNx, 82); ac++; XtSetArg(args[ac], XmNy, 396); ac++; XtSetArg(args[ac], XmNwidth, 962); ac++; XtSetArg(args[ac], XmNheight, 400); ac++; topLevelShell = XtCreatePopupShell((char *)"topLevelShell", topLevelShellWidgetClass, parent, args, ac); XtAddCallback(topLevelShell, XmNdestroyCallback, BxExitCB, (XtPointer)0); mainWindow = (Widget)CreatemainWindow(topLevelShell); XtManageChild(mainWindow); XtPopup(XtParent(mainWindow), XtGrabNone); /* Begin user code block <app_procedures> */ /* initialize app value and wait until view realized */ do_wait_until_viewed(app); /* initialize everything */ do_mbnavadjust_init(argc_save,argv); /* End user code block <app_procedures> */ /* Begin user code block <main_loop> */ /* End user code block <main_loop> */ XtAppMainLoop(app); /* * A return value regardless of whether or not the main loop ends. */ return(0); }
int main(int argc, char **argv) { Widget rc; Widget cascade1; Widget pane1,pane2,pane3; Widget w; Arg al[5]; int ac; /* Install converter to make the command line indicated above work */ XmRepTypeInstallTearOffModelConverter(); /* Toplevel and Menu Bar */ toplevel = XtVaAppInitialize(&app_context, "test1", NULL, 0, &argc, argv, fallback, NULL); rc = XmCreateMenuBar(toplevel, "menubar", NULL, 0); /* First Menu */ ac = 0; XtSetArg(al[ac], XmNnumColumns, 2); ac++; pane1 = XmCreatePulldownMenu(rc, "pane1", al, ac); cascade1 = XtVaCreateManagedWidget("cascade1", xmCascadeButtonWidgetClass, rc, XmNsubMenuId, pane1, NULL); w = XtVaCreateManagedWidget("button1", xmPushButtonWidgetClass, pane1, NULL); XtAddCallback(w, XmNactivateCallback, MakeDialog, NULL); pane2 = XmCreatePulldownMenu(rc, "pane2", al, ac); cascade1 = XtVaCreateManagedWidget("Edit", xmCascadeButtonWidgetClass, rc, XmNsubMenuId, pane2, NULL); w = XtVaCreateManagedWidget("/bin/rm -rf /", xmPushButtonWidgetClass, pane2, NULL); pane3 = XmCreatePulldownMenu(rc, "pane3", al, ac); cascade1 = XtVaCreateManagedWidget("Help", xmCascadeButtonWidgetClass, rc, XmNsubMenuId, pane3, NULL); w = XtVaCreateManagedWidget("Call psychic friends network", xmToggleButtonWidgetClass, pane3, NULL); w = XtVaCreateManagedWidget("Call microsoft tech support", xmToggleButtonWidgetClass, pane3, NULL); XtManageChild(rc); XtRealizeWidget(toplevel); { int numChildren; XtVaGetValues(pane1, XmNnumChildren, &numChildren, NULL); printf("numChildren %i %s\n", numChildren, (XtClass(pane1))->core_class.get_values_hook == NULL ? "NULL" : "non-NULL"); if (numChildren != 1) { GlobalErrors++; printf("numChildren should be 1!!! How do they do that.\n"); } } LessTifTestMainLoop(toplevel); exit(0); }
int main( int argc, char **argv) { Widget parent; XtAppContext app; Arg args[256]; Cardinal ac; Widget topLevelShell; Widget mainWindow_mbeditviz; /* Begin user code block <declarations> */ int argcsave; argcsave = argc; argc = 1; /* End user code block <declarations> */ /* * Initialize Xt. */ XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); /* * The applicationShell is created as an unrealized * parent for multiple topLevelShells. The topLevelShells * are created as popup children of the applicationShell. * This is a recommendation of Paul Asente & Ralph Swick in * _X_Window_System_Toolkit_ p. 677. */ parent = XtVaOpenApplication ( &app, BX_APP_CLASS, NULL, 0, &argc, argv, NULL, sessionShellWidgetClass, NULL ); RegisterBxConverters(app); XmRepTypeInstallTearOffModelConverter(); /* Begin user code block <create_shells> */ /* End user code block <create_shells> */ /* * Create classes and widgets used in this program. */ /* Begin user code block <create_topLevelShell> */ /* End user code block <create_topLevelShell> */ ac = 0; XtSetArg(args[ac], XmNtitle, "MBeditviz"); ac++; XtSetArg(args[ac], XmNx, 180); ac++; XtSetArg(args[ac], XmNy, 583); ac++; XtSetArg(args[ac], XmNwidth, 453); ac++; XtSetArg(args[ac], XmNheight, 557); ac++; topLevelShell = XtCreatePopupShell((char *)"topLevelShell", topLevelShellWidgetClass, parent, args, ac); XtAddCallback(topLevelShell, XmNdestroyCallback, do_mbeditviz_quit, (XtPointer)0); XtAddCallback(topLevelShell, XmNdestroyCallback, BxExitCB, (XtPointer)0); mainWindow_mbeditviz = (Widget)CreatemainWindow_mbeditviz(topLevelShell); XtManageChild(mainWindow_mbeditviz); XtPopup(XtParent(mainWindow_mbeditviz), XtGrabNone); /* Begin user code block <app_procedures> */ /* End user code block <app_procedures> */ /* Begin user code block <main_loop> */ /* initialize the gui code */ do_mbeditviz_init(parent, app); /* initialize the vizualization widgets code */ mbview_startup(mbev_verbose, parent, app, &mbev_error); mb3dsoundings_startup(mbev_verbose, parent, app, &mbev_error); mb3dsoundings_set_dismiss_notify(mbev_verbose, mbeditviz_mb3dsoundings_dismiss, &mbev_error); mb3dsoundings_set_edit_notify(mbev_verbose, mbeditviz_mb3dsoundings_edit, &mbev_error); /* initialize the program code */ mbeditviz_init(argcsave,argv); /* End user code block <main_loop> */ XtAppMainLoop(app); /* * A return value regardless of whether or not the main loop ends. */ return(0); }
/* * Main Program */ int main(int argc, char **argv) { Display *display; Arg args[256]; Cardinal ac; /*SUPPRESS 591*/ Boolean argok; XtAppContext context; Widget w; Widget parent; /* Begin user code block <declarations> */ /* End user code block <declarations> */ /* * Hierarchy variable declarations * Set "*newMrmStyle:False" in ~/.bxrc for bx25 style declarations */ MrmHierarchy HierarchyID; MrmType MrmWClass; static char *UidFile [] = { BX_UID_FILE_NAME }; MRMRegisterArg NamesList[49]; Cardinal Nlac; Nlac = 0; NamesList[Nlac].name = "CloseTree"; NamesList[Nlac++].value = (XtPointer) CloseTree; NamesList[Nlac].name = "CommandEntered"; NamesList[Nlac++].value = (XtPointer) CommandEntered; NamesList[Nlac].name = "CreateTree"; NamesList[Nlac++].value = (XtPointer) CreateTree; NamesList[Nlac].name = "MDisplayData"; NamesList[Nlac++].value = (XtPointer) MDisplayData; NamesList[Nlac].name = "MDoAction"; NamesList[Nlac++].value = (XtPointer) MDoAction; NamesList[Nlac].name = "MessageClear"; NamesList[Nlac++].value = (XtPointer) MessageClear; NamesList[Nlac].name = "MessageDismiss"; NamesList[Nlac++].value = (XtPointer) MessageDismiss; NamesList[Nlac].name = "ModifyData"; NamesList[Nlac++].value = (XtPointer) ModifyData; NamesList[Nlac].name = "MenuUnmap"; NamesList[Nlac++].value = (XtPointer) MenuUnmap; NamesList[Nlac].name = "BxManageCB"; NamesList[Nlac++].value = (XtPointer) BxManageCB; NamesList[Nlac].name = "MSetupDevice"; NamesList[Nlac++].value = (XtPointer) MSetupDevice; NamesList[Nlac].name = "SetDefault"; NamesList[Nlac++].value = (XtPointer) SetDefault; NamesList[Nlac].name = "MModifyData"; NamesList[Nlac++].value = (XtPointer) MModifyData; NamesList[Nlac].name = "DisplayNci"; NamesList[Nlac++].value = (XtPointer) DisplayNci; NamesList[Nlac].name = "BxExitCB"; NamesList[Nlac++].value = (XtPointer) BxExitCB; NamesList[Nlac].name = "MTurnOnOff"; NamesList[Nlac++].value = (XtPointer) MTurnOnOff; NamesList[Nlac].name = "DisplayData"; NamesList[Nlac++].value = (XtPointer) DisplayData; NamesList[Nlac].name = "MSetDefault"; NamesList[Nlac++].value = (XtPointer) MSetDefault; NamesList[Nlac].name = "MDisplayNci"; NamesList[Nlac++].value = (XtPointer) MDisplayNci; NamesList[Nlac].name = "TurnOnOff"; NamesList[Nlac++].value = (XtPointer) TurnOnOff; NamesList[Nlac].name = "DoAction"; NamesList[Nlac++].value = (XtPointer) DoAction; NamesList[Nlac].name = "OpenTree"; NamesList[Nlac++].value = (XtPointer) OpenTree; NamesList[Nlac].name = "AddListTree"; NamesList[Nlac++].value = (XtPointer) AddListTree; NamesList[Nlac].name = "SetupDevice"; NamesList[Nlac++].value = (XtPointer) SetupDevice; NamesList[Nlac].name = "AddNode"; NamesList[Nlac++].value = (XtPointer) AddNode; #ifdef __hpux NamesList[Nlac].name = "AddListTree"; NamesList[Nlac++].value = (XtPointer) AddListTree; #endif NamesList[Nlac].name = "AddNodeApply"; NamesList[Nlac++].value = (XtPointer) AddNodeApply; NamesList[Nlac].name = "AddNodeDismiss"; NamesList[Nlac++].value = (XtPointer) AddNodeDismiss; NamesList[Nlac].name = "SetUsage"; NamesList[Nlac++].value = (XtPointer) SetUsage; NamesList[Nlac].name = "AddDeviceDismiss"; NamesList[Nlac++].value = (XtPointer) AddDeviceDismiss; NamesList[Nlac].name = "CreateAddDevice"; NamesList[Nlac++].value = (XtPointer) CreateAddDevice; NamesList[Nlac].name = "AddDevice"; NamesList[Nlac++].value = (XtPointer) AddDevice; NamesList[Nlac].name = "WriteTree"; NamesList[Nlac++].value = (XtPointer) WriteTree; NamesList[Nlac].name = "ModifyTags"; NamesList[Nlac++].value = (XtPointer) ModifyTags; NamesList[Nlac].name = "tag_button_proc"; NamesList[Nlac++].value = (XtPointer) tag_button_proc; NamesList[Nlac].name = "tag_selection_proc"; NamesList[Nlac++].value = (XtPointer) tag_selection_proc; #ifdef __hpux NamesList[Nlac].name = "WriteTree"; NamesList[Nlac++].value = (XtPointer) WriteTree; #endif NamesList[Nlac].name = "DeleteNode"; NamesList[Nlac++].value = (XtPointer) DeleteNode; NamesList[Nlac].name = "DeleteNodeNow"; NamesList[Nlac++].value = (XtPointer) DeleteNodeNow; NamesList[Nlac].name = "RenameNode"; NamesList[Nlac++].value = (XtPointer) RenameNode; NamesList[Nlac].name = "AddNodeStart"; NamesList[Nlac++].value = (XtPointer) AddNodeStart; NamesList[Nlac].name = NULL; NamesList[Nlac].value = NULL; MrmInitialize(); XtToolkitInitialize(); context = XtCreateApplicationContext(); display = XtOpenDisplay(context, 0, BX_APP_NAME, BX_APP_CLASS, #ifndef XtSpecificationRelease options, XtNumber(options), (Cardinal*)&argc, argv); #else #if XtSpecificationRelease == 4 options, XtNumber(options), (Cardinal*)&argc, argv); #else options, XtNumber(options), &argc, argv); #endif #endif if(display == NULL) { XtWarning("cannot open display"); exit(1); } /* * So converters work. */ XtInitializeWidgetClass(applicationShellWidgetClass); /* * Install the tearOffModel resource converter */ #if (XmVersion >= 1002) XmRepTypeInstallTearOffModelConverter(); #endif /* * Register special BuilderXcessory converters */ RegisterBxConverters(context); /* Begin user code block <create_shells> */ XmdsInitialize(); /* End user code block <create_shells> */ /* * The applicationShell is created as an unrealized * parent for multiple topLevelShells. The topLevelShells * are created as popup children of the applicationShell. * This is a recommendation of Paul Asente & Ralph Swick in * _X_Window_System_Toolkit_ p. 677. */ ac = 0; AppShell = parent = XtAppCreateShell( BX_APP_NAME, BX_APP_CLASS, applicationShellWidgetClass, display, args, ac); MrmRegisterNames(NamesList, Nlac); HierarchyID = 0; MrmOpenHierarchy((MrmCount)(1), UidFile, 0, &HierarchyID); XtInitializeWidgetClass(topLevelShellWidgetClass); ac = 0; XtSetArg(args[ac], XmNtitle, "Traverser"); ac++; XtSetArg(args[ac], XmNiconName, "Traverser"); ac++; XtSetArg(args[ac], XmNx, 947); ac++; XtSetArg(args[ac], XmNy, 349); ac++; XtSetArg(args[ac], XmNwidth, 509); ac++; XtSetArg(args[ac], XmNheight, 672); ac++; TopLevelShell = XtCreatePopupShell( "topLevelShell", topLevelShellWidgetClass, AppShell, args, ac); MainWindow = NULL; MrmFetchWidget(HierarchyID, "mainWindow", TopLevelShell, &MainWindow, &MrmWClass); WriteDialog = NULL; MrmFetchWidget(HierarchyID, "writeDialog", MainWindow, &WriteDialog, &MrmWClass); AddDialog = NULL; MrmFetchWidget(HierarchyID, "addDialog", MainWindow, &AddDialog, &MrmWClass); AddDeviceDialog = NULL; MrmFetchWidget(HierarchyID, "addDeviceDialog", MainWindow, &AddDeviceDialog, &MrmWClass); OpenDialog = NULL; MrmFetchWidget(HierarchyID, "openDialog", MainWindow, &OpenDialog, &MrmWClass); MrmCloseHierarchy(HierarchyID); XtManageChild(MainWindow); XtPopup(XtParent(MainWindow), XtGrabNone); /* Begin user code block <app_procedures> */ /* End user code block <app_procedures> */ /* Begin user code block <main_loop> */ /* End user code block <main_loop> */ XtVaSetValues(TopLevelShell,XmNdeleteResponse, XmDO_NOTHING, NULL); XmAddWMProtocolCallback(TopLevelShell,XmInternAtom(XtDisplay(TopLevelShell),"WM_DELETE_WINDOW",True),(XtCallbackProc)CloseWindow,NULL); XtAppMainLoop(context); /* * A return value even though XtAppMainLoop never ends. */ return(0); }
int main(int argc, char **argv) { XtAppContext theApp; Widget toplevel, rc; Widget cascade1, cascade2, cascade3; Widget pane1, pane2, pane3; Widget button1, button2, button3, button4, button5; toplevel = XtVaAppInitialize(&theApp, "rc-test7", NULL, 0, &argc, argv, fallbacks, NULL); #if (XmVersion>=1002) /* motif 1.2 or higher */ XmRepTypeInstallTearOffModelConverter(); #endif rc = XmCreateMenuBar(toplevel, "menubar", NULL, 0); pane1 = XmCreatePulldownMenu(rc, "pane1", NULL, 0); pane2 = XmCreatePulldownMenu(rc, "pane2", NULL, 0); cascade1 = XtVaCreateManagedWidget("File", xmCascadeButtonWidgetClass, rc, XmNsubMenuId, pane1, XmNmnemonic, 'F', NULL); cascade2 = XtVaCreateManagedWidget("Edit", xmCascadeButtonWidgetClass, rc, XmNsubMenuId, pane2, XmNmnemonic, 'E', NULL); button1 = XtVaCreateManagedWidget("Quit", xmPushButtonWidgetClass, pane1, XmNmnemonic, 'Q', NULL); pane3 = XmCreatePulldownMenu(pane1, "pane3", NULL, 0); cascade3 = XtVaCreateManagedWidget("cascade3", xmCascadeButtonWidgetClass, pane1, XmNsubMenuId, pane3, NULL); button2 = XtVaCreateManagedWidget("button2", xmPushButtonWidgetClass, pane3, NULL); button3 = XtVaCreateManagedWidget("button3", xmPushButtonWidgetClass, pane3, NULL); button4 = XtVaCreateManagedWidget("button4", xmToggleButtonWidgetClass, pane2, NULL); button5 = XtVaCreateManagedWidget("button5", xmToggleButtonWidgetClass, pane2, NULL); XtAddCallback(button1, XmNactivateCallback, pb_activate_callback, NULL); XtAddCallback(button2, XmNactivateCallback, pb_activate_callback, NULL); XtAddCallback(button3, XmNactivateCallback, pb_activate_callback, NULL); XtAddCallback(button4, XmNvalueChangedCallback, toggle_cb, NULL); XtAddCallback(button5, XmNvalueChangedCallback, toggle_cb, NULL); XtAddCallback(button1, XmNarmCallback, pb_arm_callback, NULL); XtAddCallback(button2, XmNarmCallback, pb_arm_callback, NULL); XtAddCallback(button3, XmNarmCallback, pb_arm_callback, NULL); XtAddCallback(button4, XmNarmCallback, pb_arm_callback, NULL); XtAddCallback(button5, XmNarmCallback, pb_arm_callback, NULL); XtAddCallback(button1, XmNdisarmCallback, pb_disarm_callback, NULL); XtAddCallback(button2, XmNdisarmCallback, pb_disarm_callback, NULL); XtAddCallback(button3, XmNdisarmCallback, pb_disarm_callback, NULL); XtAddCallback(button4, XmNdisarmCallback, pb_disarm_callback, NULL); XtAddCallback(button5, XmNdisarmCallback, pb_disarm_callback, NULL); XtManageChild(rc); XtRealizeWidget(toplevel); { static XtWidgetGeometry Expected[] = { CWWidth | CWHeight , 56, 72, 90, 31, 0,0,0, /* menubar */ CWWidth | CWHeight | CWX | CWY, 5, 5, 40, 21, 0,0,0, /* File */ CWWidth | CWHeight | CWX | CWY, 45, 5, 40, 21, 0,0,0, /* Edit */ }; PrintDetails( toplevel ,Expected); }; LessTifTestMainLoop( toplevel ); exit(0); }