XTkDoc.tioga
Copyright Ó 1991, 1992, 1993 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi
Christian Jacobi, August 24, 1993 10:44 am PDT
XTk is a simple X window toolkit.
XTk is vaguely modelled after Xt. However, XTk is much simpler and more direct to be used. Unfortunately there is less software for XTk available. XTk applications are much shorter then Xt applications, largely due to good defaults for parameters.
For those who know x windows and Xt: The XTk toolkit gives users the freedom in which order to allocate windows; e.g. subwidgets can be created independently from a container widget and included at any time. XTk takes the chore of accessing the x server for many applications (but not widget class implementors). However XTk does not hide the underlying x window but exposes it to its clients whenever they desire.
The XTk toolkit also allows for widgets to migrate from one X connection to an other one.
Applications will see the XTk toolkit and a set of widgets they can be use. Widgets are little user interface objects which an application program can compose to its own needs. Widgets are typically implemented as x windows. Widgets are objects in the sense of object oriented programming.
There are actually three classes of clients of XTk
1) Applications which mix and match the user interface with XTk widgets.
2) Widget implementors. By following the XTk rules a separately implemented widget (class) can be composed with any other XTk widget.
3) Some packages provide functionality for widgets without actually implementing widget classes.
Example:
Applications: X11ViewersWorld, Slate, X11BounceDemo
Widget implementors: Sliders, TiogaWidgets
Packages: TIP table support; Resource database access
Unhappily many of the types used in XTk.mesa are supporting Widget implementors. This is a consequence of the programming language used. Ideally XTk.mesa would serve the apllication programmer. XTkFriends would serve the implementation of more widget classes. XTkWidgets.mesa is a list of Widget classes useful for applications.
Creating a hello world widget.
Hello: PROC [] ~ {
label: XTkWidgets.Widget ← XTkWidgets.CreateLabel[text: "hello world"];
shell: XTkWidgets.Widget ← XTkWidgets.CreateShell[child: label, windowHeader: "hello world widget", standardMigration: TRUE];
XTkWidgets.RealizeShell[shell];
};
This procedure creates first a label. This label is able to display the text "hello world". Then this procedure creates a shell widget. It plugs the label as a child of the shell widget. When this is done we have created some linked data structures only. The final call to RealizeShell will traverse the data structures and create the appropriate x windows in the right order.
Including your applications widget into a shell is a big deal. The shell widget class is actually the most complex widget class of the XTk toolkit. Shells do interact with window managers. Shells can be iconified, resized. They handle lots of properties for inter client communication. In our example the shell will display the header "hello world widget". Since no icon name is specified it will use this header also for icon name.
The parameter about standardMigration enables the shell to play the migration game: An external tool can tell the shell to return all x resources, access a different x server and build itself up again. In larger programs shells might access particular x servers; however in this example the shell will find out from its environment which x server should be adressed.
Extensability.
Some of the versatility of XTk is due to properties and callback mechanism.
Properties of widgets have nothing to do with x windows; they are strict key value pairs maintained on the host machine.
XTk allows to register callback procedures which are called on various occasions. It allows to register x window events with a particular widget.
XTk also allows clients to extend the number of "occasions" when callback procedures are called. XTk provides a mechanism by which applications can be excluded from initiating callback calls at inappropriate times.
Creating more interesting applications.
Please look at X11Demos.df, Slate.df or other applications.
Creating widget classes.
Read XTk.mesa, XTkFriends.mesa.
Please make your widget class in a manner it could be sub-classed further.
Shutting down X server access.
This seemingly uninteresting chore is actually one of the most elaborate area in XTk. XTk lets client applications paint into widgets without apparent locking. These painters have to be stopped on shut down, or lots of bad error messages will occur.
A widget has a field "widget.fastAccessAllowed" as long as this field has a value of "ok" this means that the client may paint (= Use X window requests) into the widget. As the painting itself runs on a particular thread, the shutdown of a widget is synchronized with a time when that particular thread is idle.
This ease and efficiency for the application is paid by elaborate process for synchronizing the shut down phase. Luckily that complication is hidden inside XTk and particular widget class implementation. Most clients will not be bothered. This whole synchronization is suspectable to a timeout mechanism. A breaking application or widget is unlikely to wedge other applications using other widgets, even from the same widget class.
Short introduction to different scrolling widgets.
XTkScrollbar.mesa
This displays a scrollbar itself. It has no knowledge what happens on scroll operations.
XTkBiScrollerFrame.mesa
This displays a pair of scrollbars (vertical and horizontal). It provides a frame and a user interface to scroll a child window, but doesn't touch the child window.
XTkXScroller.mesa
A mechanism by which to scroll an X window by means of its position. Has no user interface.
XTkXBiScroller.mesa
XTkXBiScroller = XTkBiScrollerFrame + XTkXScroller + glue
Use the XTkBiScrollerFrame UI to drive the XTkXScroller mechanism
XTkBitmapScroller.mesa
XTkBitmapScroller = XTkBiScrollerFrame + XTkBitmapWidgets + glue
Use the XTkBiScrollerFrame UI to drive scrolling within a XTkBitmapWidgets
Short list of modules.
"Generic" modules.
XTk.mesa  The basic definitions for all clients
XTkWidgets.mesa  A list of simple widget classes, sufficient for some aplications
XTkFriends.mesa  The basic mechanisms necessary to write widget classes
XTkOps.mesa   A random collection of useful operators for XTk
XTkDB.mesa   Accessing the X resource database
XTkNotification.mesa A registration scheme for global callback procedures
XTkMigration.mesa  Registry for different migration behaviour
"Widget classes"
XTkPseudoRoot.mesa
XTkScroller.mesa
XTkBiScroller.mesa
XTkBitmapWidget.mesa
XTkButtons.mesa
XTkChoiceWidgets.mesa
XTkCollections.mesa
XTkContainers.mesa
XTkFields.mesa
XTkLabels.mesa
XTkStreamWidgets.mesa
XTkSlider.mesa
"Semi private" modules.
XTkDelegation.mesa  An experiment in delegation
XTkIcon.mesa    Private to shell widgets
XTkFastAccessPrivate.mesa
XTkBlinking.mesa
Other df files will add
XTkTIPSource.mesa
XTkTIP.mesa
X11Eval.mesa
X11PopUpSelection.mesa
X11SelectionOwner.mesa
X11SelectionRequestor.mesa