SSCRIPT TECHNICAL PAPER

X-Toolkit and Athena programming reference
------------------------------------------

Here are the GUI functions as used in SScript.

Basicly, the Xt, Xaw, X11 and Xext libraries are, together, what makes
the main X-window programming functions.

Any program using the following functions would needs to link with the
Xaw, Xmu, Xt, SM, ICE, Xext and X11 libraries, in that order.

Initializing can be made with the XtVaAppInitialize or XtAppInitialize 
functions:

Widget XtAppInitialize(app_context_return, application_class, options,
num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)

app_context_return is a defined XtAppContext, class is a user-defined
class, options can be NULL if no options are specified, with num_options
set to 0, argc_in_out and argv_in_out are the main()'s argc and *argv[],
fallback_resources is what defines your UI, args and num_args can be
replaced by a single NULL.

Here's an example of fallback_resources:

static String default_resources[] = {
    "*foreground: #0000FF",
    "*background: #FFFFFF",
    "*Label*foreground: #050505",
    "*Command*foreground: #FF0000",
    "*Command*background: #FFFFFF",
    "*QUIT*foreground: #005500",
    "*textbox*foreground: #005500",
    NULL
};

To make a widget, use XtCreateWidget, XtVaCreateWidget, 
XtCreateManagedWidget or XtVaCreateManagedWidget:

Widget XtCreateWidget(name, widget_class, parent, args, num_args)

name is a user-defined name, widget_class is one of the allowed classes,
parent is the parent widget containing this one, args and num_args can
be set with SetArg() or replaced by NULL.

The allowed classes are:

extern WidgetClass applicationShellWidgetClass;
extern WidgetClass asciiSinkObjectClass;
extern WidgetClass asciiSrcObjectClass;
extern WidgetClass asciiTextWidgetClass; 
extern WidgetClass boxWidgetClass;
extern WidgetClass commandWidgetClass; 
extern WidgetClass compositeWidgetClass;
extern WidgetClass constraintWidgetClass;      
extern WidgetClass coreWidgetClass; 
extern WidgetClass dialogWidgetClass;  
extern WidgetClass formWidgetClass;
extern WidgetClass gripWidgetClass;
extern WidgetClass labelWidgetClass;   
extern WidgetClass listWidgetClass;
extern WidgetClass menuButtonWidgetClass;
extern WidgetClass multiSinkObjectClass;
extern WidgetClass multiSrcObjectClass; 
extern WidgetClass objectClass;
extern WidgetClass overrideShellWidgetClass;
extern WidgetClass panedWidgetClass;   
extern WidgetClass pannerWidgetClass;
extern WidgetClass portholeWidgetClass;
extern WidgetClass rectObjClass;
extern WidgetClass repeaterWidgetClass;
extern WidgetClass scrollbarWidgetClass; 
extern WidgetClass shellWidgetClass;
extern WidgetClass simpleMenuWidgetClass;
extern WidgetClass simpleWidgetClass;
extern WidgetClass smeBSBObjectClass;
extern WidgetClass smeLineObjectClass; 
extern WidgetClass smeObjectClass;   
extern WidgetClass stripChartWidgetClass;
extern WidgetClass textSinkObjectClass;
extern WidgetClass textSrcObjectClass; 
extern WidgetClass textWidgetClass;
extern WidgetClass toggleWidgetClass;
extern WidgetClass topLevelShellWidgetClass;
extern WidgetClass transientShellWidgetClass;
extern WidgetClass treeWidgetClass;  
extern WidgetClass vendorShellWidgetClass;
extern WidgetClass viewportWidgetClass;
extern WidgetClass wmShellWidgetClass;   

Then the callbacks have to be set with XtAddCallback:

void XtAddCallback(w, callback_name, callback, client_data)

w is the widget you are adding a callback for, callback_name is
XtNcallback, callback is the function you call when the wanted event
occurs (casted to an XtPointer), and client_data is what you pass to the
function, usualy NULL.

Then you must use XtRealizeWidget() and enter the main loop either with
XtAppMainLoop which doesn't return, or with a combinaison of
XtAppNextEvent and XtDispatchEvent to handle the events.

See http://www.cs.curtin.edu.au/documentation/X11R5 for more good docs.
