next up previous contents index
Next: AVS/Explorer Up: 17.2.7 Integrated Visualization Model Previous: DPS/NeWS

X/Motif/OpenLook

MovieScript windowing is constructed by building the interface to the XtIntrinsics-based GUI toolkits. The generic interface model is constructed and so far explicitly implemented for Motif [Furmanski:92e]. The OpenLook implementation is in progress. Mechanisms are provided for combining various toolkit components into the global GUI toolkit. The minimal set of components consists of the XtIntrinsics subtree provided by the X Consortium and the vendor-specific subtree such as Motif or OpenLook. This two-component model can be further extended by new user-provided components. Each toolkit component is implemented as individual MovieScript shell. In particular, the shell Xi defines the intrinsic widgets, the shell Xm defines the Motif widgets, and so on. There is also a toolkit integration shell Xt which provides tools for combining toolkit components (e.g., Xt = Xi + Xm). The implementation of OpenLook interface in this model is reduced to specifying the shell Xol with the OpenLook widgets and building the full toolkit Xt = Xi + Xol.

The object-oriented model of XtIntrinsics is based on static binding and single inheritance. As such, it doesn't contain enough dynamics and functionality to motivate the faithful embedding in terms of derived types in MovieScript. Instead, we implement the widget classes as parametric modules in terms of a few primitive MovieScript types such as xtclass (widget class), xtwidget (widget instance), xtattr (widget attribute), and xtcallback (widget callback). The types xtclass and xtattr play the role of static containers of the corresponding Xlib information and they are supported only by a set of query/browse methods. The types xtwidget and xtcallback are dynamic, that is, their instances are created/destroyed in the run time.

The operator xtwidget creates an instance of the widget class, taking as input two objects: the parent widget and the array of attribute-value pairs. Attributes are specified by literal MovieScript names, coinciding with the corresponding Motif names. The Motif attribute set is suitably extended. For example, the widget class name itself is a special attribute, to be specified first in the attribute-value array. The associated value is the widget instance name as referred to by the X Resource Manager. Another special attribute is represented by the MovieScript atomic  item $ which indicates the nested child widget. Its corresponding value is the attribute-value array for this child widget. The $[...] pairs of this type can be nested, which allows for creating trees of nested widgets linked by the parent-child relations. This construct is extensively used in building GUI interfaces. We illustrate it below on a simple example:

 xtinit

$ ¯[/MainShell /main

$ ¯[/XmRowColumn /panel

/orientation /Vertical

$ [/XmPushButton /red

/background [ 1.0 0.0 0.0 ]

/activateCallback { (red) run }

]

$ [/XmPushButton /green

/background [ 0.0 1.0 0.0 ]

/activateCallback { (green) run }

]

$ [/XmPushButton /blue

/background [ 0.0 0.0 1.0 ]

/activateCallback { (blue) run }

]

]

] xtwidget realize

xtmainloop

As a result of executing the MovieScript program above, the main application window will be created with three buttons, labelled by color = red, green, blue strings and colored accordingly. By pressing a selected color button, the ./color file in the current directory will be executed, that is, interpreted as a MovieScript code. In this example, the nested widget tree is constructed with the depth three: Main is created as a child of the root window, panel is created as a child of main, and, finally red, green, blue buttons are created as panel children.

The GUI in this example is provided in terms of the button widgets and the associated callback procedures. The /activateCallback attribute for the button widget expects as value the MovieScript procedure (executable array), to be executed whenever the X event ButtonPress is generated, that is, whenever the user presses this button. Callback procedure in MovieScript is a natural interpreted version of the conventional C language interface, in which one registers the callback functions to be invoked as a response to the appropriate X events, created by the GUI controls. The advantage of the MovieScript-based GUI model is the support for rapid prototyping. After constructing the control panel as in the example above, one can now easily develop, modify, and test the scriptable callback procedures simply by editing the corresponding red, green, and blue files in the run-time mode.



next up previous contents index
Next: AVS/Explorer Up: 17.2.7 Integrated Visualization Model Previous: DPS/NeWS



Guy Robinson
Wed Mar 1 10:19:35 EST 1995