The InterViews library contains a collection of C++ classes for implementing user interfaces. All interactive objects are derived directly or indirectly from the Interactor class. All composite interactive objects are derived directly or indirectly from the Scene class, which itself is derived from Interactor. Frequently used subclasses include Box and Glue for tiling interactors, Tray for overlapping/aligning, Frame for decorating a single interactor, Deck for paging through a list of interactors (one visible at a time), Viewport for scrolling/panning around a larger interactor, Scroller for a simple scrollbar, StringEditor for text string editing, Menu for simple pop-up menus, and Button for different styles of interactive buttons. An instance of the World subclass is used to map interactors onto a display.
A number of classes are provided for graphics input and output. These include Canvas for display regions; Painter for drawing operations; Brush, Color, Font, and Pattern for controlling graphics characteristics; Cursor for the screen appearance of a pointing device; Event for input events, and Sensor for expressing interest in a set of possible events; Rubband objects for interactive dragging and placement. These control classes (except for Event) are derived from the Resource class. The basic libInterViews library includes the above classes. The libgraphic library provides an additional set of classes for defining structured graphics and storing graphical objects in files. Graphic is the base class for structured graphics objects; prederived classes classes include simple graphical objects (Point, Ellipse, Spline, Label, etc.), a composite object (Picture), and an object that is a variation on another object (Instance). Each graphic can be manipulated and transformed independently of others. Functions are provided for computing the graphic's bounding box and whether or not it intersects a given point or rectangle. Graphics are persistent in that each defines a representation of itself that can be automatically written to and read from disk. The Graphic class is derived from Persistent, which provides this functionality in a general persistent object class. Graphics use persistent paint objects that are analogous to the paint objects used by Painters. Graphic contains all necessary functionality for drawing graphics without the persistence feature. If persistent graphics are required, features of the Persistent class are used. The libgraphic provides two additional classes for use with structured graphics objects. Damage supports incremental redraw of graphical objects whose appearance has been modified. GraphicBlock is an interactor that displays a structured graphics object. A GraphicBlock interprets a perspective to allow scrolling and zooming of the graphic it contains. All InterViews header files include the following definitions from ``<InterViews/defs.h>'': typedef int Coord;Display coordinates are represented uniformly as 32-bit integers; however, the units depend on context because of the possibility of coordinate transformations (see Painter). The predefined variables cm, inches, pixels, and points should be used as units if no transformations are present (e.g., ``Coord x = 3*inches''). This convention makes the coordinate values independent of screen resolution. The variables inch and point are also provided as synonyms for inches and points, respectively.typedef unsigned Alignment;
Alignments are used to specify the physical relationship between objects such as components in a Tray. The interpretation of an Alignment is context-specific. The constants TopLeft, TopCenter, TopRight, CenterLeft, Center, CenterRight, BottomLeft, BottomCenter, BottomRight, Left, Right, Top, Bottom, HorizCenter, and VertCenter are predefined.typedef unsigned TextStyle;
A TextStyle specifies a combination of stylistic attributes that are applied to text drawing. The style is obtained by ORing together zero or more of the predefined constants Boldface, Underlined, and Reversed. The constant Plain specifies an unadorned style.#define nil 0
The symbol nil represents a pointer to a non-existent object. Dereferencing nil is an error.int min(int, int), int max(int, int)
Return the minimum or maximum of two integers, floats, or doubles.int round(double)
Return the integer closest to its argument.A high-level class diagram of major InterViews classes is show in Figure 1
Figure 1: High-level InterViews class diagram.