2 #include <X11/Intrinsic.h>
3 #include <X11/StringDefs.h>
5 #include <X11/Xaw/Box.h>
6 #include <X11/Xaw/Form.h>
7 #include <X11/Xaw/Command.h>
8 #include <X11/Xaw/AsciiText.h>
11 static XtAppContext app_context;
12 static Widget toplevel, form, text, buttons;
14 static String fallback[] = {
15 /* text window resources */
16 "*text.resizable: true",
17 "*text.resize: ResizeBoth",
23 void (*callback)(Widget, XtPointer, XtPointer);
28 static void quit_proc(Widget w, XtPointer client_data, XtPointer call_data)
30 XtDestroyApplicationContext (app_context);
34 static void noargs_proc(Widget w, XtPointer client_data, XtPointer call_data)
35 /* use this for commands that take no arguments */
37 /* currently a stub */
40 static struct cmd_t commands[] = {
45 {"Dock", noargs_proc, 0},
46 {"Damages", noargs_proc, 0},
47 {"Chart", noargs_proc, 0},
51 {"Score", noargs_proc, 0},
52 {"Sensors", noargs_proc, OPTION_PLANETS},
53 {"Orbit", noargs_proc, OPTION_PLANETS},
54 {"Transport", noargs_proc, OPTION_PLANETS},
55 {"Mine", noargs_proc, OPTION_PLANETS},
56 {"Crystals", noargs_proc, OPTION_PLANETS},
57 {"Shuttle", noargs_proc, OPTION_PLANETS},
58 {"Planets", noargs_proc, OPTION_PLANETS},
59 {"Report", noargs_proc, 0},
60 {"Computer", noargs_proc, 0},
61 {"Emexit", noargs_proc, 0},
62 {"Probe", NULL, OPTION_PROBE},
64 {"Abandon", noargs_proc, 0},
65 {"Destruct", noargs_proc, 0},
66 {"Deathray", noargs_proc, 0},
67 {"Mayday", noargs_proc, 0},
68 {"Quit", quit_proc, 0},
69 {"Help", noargs_proc, 0},
72 int main(int argc, char **argv)
76 toplevel = XtVaOpenApplication(&app_context, "sst2k", NULL, 0, &argc,
78 applicationShellWidgetClass,
79 XtNallowShellResize, True, NULL);
80 form = XtVaCreateManagedWidget("form", formWidgetClass, toplevel, NULL);
81 /* the command window */
82 text = XtVaCreateManagedWidget("text", asciiTextWidgetClass, form,
83 XtNwidth, 400, XtNheight, 200,
85 XtVaSetValues(text, XtNeditType,XawtextRead, XtNdisplayCaret,False, NULL);
86 /* The button panel */
87 buttons = XtVaCreateManagedWidget("form",
90 XtNorientation, XtorientHorizontal,
92 for (cp = commands; cp < commands + sizeof(commands)/sizeof(commands[0]); cp++) {
93 cp->widget = XtVaCreateManagedWidget(cp->name,
94 commandWidgetClass, buttons,
98 XtAddCallback (cp->widget, XtNcallback, cp->callback, NULL);
100 XtRealizeWidget(toplevel);
101 XtAppMainLoop(app_context);
102 /* loop may be interrupted */
103 XtDestroyApplicationContext(app_context);