Trestle is the basic graphics library which interfaces Modula-3 programs and higher level graphics libraries to bit mapped displays. It is concerned with receiving events from the displays (mouse or keyboard events, or window redraw and reshape events), dispatching them to screen regions (sub windows, or Virtual Bitmap Terminal, or simply VBT) and receiving painting commands for VBTs and sending them to the displays. A distinctive feature of Trestle is that one or more separate threads are responsible for delivering events. Thus, a program using Trestle is not forced into executing an event waiting loop. Trestle currently runs on X windows, the Firefly experimental workstation and soon on the Win32 interface (Windows NT and Windows95 from Microsoft).
For most applications, higher level libraries such as VBTkit will offer the desired functionality (e.g. menus, editors, scrollbars...). There are cases however where Trestle should be used. Trestle is documented in the Trestle Reference Manual. Its main components are outlined below.
The Trestle object is used to establish connections with displays, install new windows (VBTs), enumerate the available screens and obtain information such as their color capabilities, the number of bits per pixel and the number of pixels per millimeter.
A number of resource objects are available for displaying on screens. They include painting operations PaintOp, cursors Cursor, bitmaps Pixmap, fonts Font and colors Palette. These resources have screen independent and screen dependent versions. Normally a screen independent specification is issued which is then resolved into the best matching screen dependent resource available for the target screen type.
Regions of the screen VBTs, receive input events from the connected display (mouse and keyboard events, and redraw and reshape events), and receive output commands (painting operations) from the program. A number of simple VBTs are already defined: TextVBT (display a text string), TextureVBT (display a regular background), HVBar (display a rectangle such as an horizontal or vertical bar) and Buttons (display a TextVBT and activate a procedure upon receiving a mouse click). Additional VBTs are easily constructed by inheriting from an existing VBT and overriding a few methods to obtain the desired functionality.
Splits are VBTs with childs. They usually divide their domain (screen region) into sub domains allocated to each child. Similarly, they dispatch the incoming input events to their childs; mouse events are usually dispatched according to the sub domain where the cursor is located and keyboard events are sent to the VBT which requested the keyboard focus.
The Splits available include ZSplit (overlapping childs such as pop up menus), HVSplit (horizontal or vertical stacking of childs such as items in a menu), PackSplit (horizontal or vertical stacking of childs on multiple lines such as buttons which may overflow on two or more lines) and TSplit (displays one of its childs at a time like a deck of cards where only the top card is visible).