#include #include #include #include #include XtAppContext app_context; Widget toplevel; /* The overall window. */ Widget form; /* The layout of the window. */ Widget quit_button; /* The button in the window. */ /* The callback function for the quit button. */ void quit_proc (Widget w, XtPointer client_data, XtPointer call_data) { XtDestroyApplicationContext (app_context); exit (0); } int main (int argc, char ** argv) { /* Create the window and its contents' appearance. */ toplevel = XtOpenApplication (&app_context, "XFirst", NULL, 0, &argc, argv, NULL, applicationShellWidgetClass, NULL, 0); form = XtVaCreateManagedWidget ("form", formWidgetClass, toplevel, NULL); quit_button = XtVaCreateManagedWidget ("quit_button", commandWidgetClass, form, XtNlabel, "Quit", NULL); /* Create window's behavior. */ XtAddCallback (quit_button, XtNcallback, quit_proc, NULL); /* Display the window. */ XtRealizeWidget (toplevel); /* Infinite loop, waiting for events to happen. */ XtAppMainLoop (app_context); return 0; }