2 #include <X11/Intrinsic.h>
3 #include <X11/StringDefs.h>
5 #include <X11/Xaw/Form.h>
6 #include <X11/Xaw/Command.h>
7 #include <X11/Xaw/AsciiText.h>
9 XtAppContext app_context;
10 Widget toplevel, form, quit, text;
12 void quit_proc (Widget w, XtPointer client_data, XtPointer call_data)
14 XtDestroyApplicationContext (app_context);
18 int main (int argc, char **argv)
20 toplevel = XtVaOpenApplication (&app_context, "XThird", NULL, 0, &argc,
21 argv, NULL, applicationShellWidgetClass,
22 XtNallowShellResize, True, NULL);
23 form = XtVaCreateManagedWidget ("form", formWidgetClass, toplevel, NULL);
24 quit = XtVaCreateManagedWidget ("quit", commandWidgetClass, form, XtNlabel,
26 text = XtVaCreateManagedWidget ("text", asciiTextWidgetClass, form,
27 XtNfromVert, quit, XtNresize,
28 XawtextResizeBoth, XtNresizable, True, NULL);
29 XtAddCallback (quit, XtNcallback, quit_proc, NULL);
31 XtVaSetValues (text, XtNtype, XawAsciiString,
32 XtNstring, "Fool! You should"
33 " supply a file name!", NULL);
35 XtVaSetValues (text, XtNtype, XawAsciiFile, XtNstring, argv [1], NULL);
36 XtVaSetValues (text, XtNeditType, XawtextRead, XtNdisplayCaret, False, NULL);
37 XtRealizeWidget (toplevel);
38 XtAppMainLoop (app_context);