From 26dfc5effef436ff09e7df80b26b34e20cc86165 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 13 Sep 2006 17:18:31 +0000 Subject: [PATCH] This is Jaap Boender's original example code. --- xio.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 xio.c diff --git a/xio.c b/xio.c new file mode 100644 index 0000000..494ea7a --- /dev/null +++ b/xio.c @@ -0,0 +1,35 @@ +#include +#include +#include +#include +#include +#include + +XtAppContext app_context; +Widget toplevel, form, quit, text; + +void quit_proc (Widget w, XtPointer client_data, XtPointer call_data) +{ XtDestroyApplicationContext (app_context); + exit (0); +} + +int main (int argc, char **argv) +{ toplevel = XtVaOpenApplication (&app_context, "XThird", NULL, 0, &argc, + argv, NULL, applicationShellWidgetClass, + XtNallowShellResize, True, NULL); + form = XtVaCreateManagedWidget ("form", formWidgetClass, toplevel, NULL); + quit = XtVaCreateManagedWidget ("quit", commandWidgetClass, form, XtNlabel, + "Quit", NULL); + text = XtVaCreateManagedWidget ("text", asciiTextWidgetClass, form, + XtNfromHoriz, quit, XtNresize, + XawtextResizeBoth, XtNresizable, True, NULL); + XtAddCallback (quit, XtNcallback, quit_proc, NULL); + if (argc <= 1) + XtVaSetValues (text, XtNtype, XawAsciiString, XtNstring, "Fool! You should" + " supply a file name!", NULL); + else + XtVaSetValues (text, XtNtype, XawAsciiFile, XtNstring, argv [1], NULL); + XtVaSetValues (text, XtNeditType, XawtextRead, XtNdisplayCaret, False, NULL); + XtRealizeWidget (toplevel); + XtAppMainLoop (app_context); +} -- 2.31.1