QuickViewer.mesa
Last Edited by: Frank Crow February 7, 1986 4:08:08 pm PST
DIRECTORY
Imager    USING [Context],
Containers   USING [Container],
ViewerClasses  USING [Viewer],
Terminal    USING [Virtual],
Rope     USING [ ROPE ];
QuickViewer: CEDAR DEFINITIONS
~ BEGIN
BuildViewer: PROC[ menuLabels: LIST OF ATOM,
       ReDrawProc: PROC[Imager.Context],
       QuitProc: PROC[] ,
       ButtonProc: PROC[bttn: ATOM, x, y: REAL, ctrl, shift: BOOL],
       viewerTitle: Rope.ROPE, noScroll: BOOLEANFALSE ]
     RETURNS [context: Imager.Context];
Make a viewer with the supplied menu labels. Use the supplied ReDrawProc when the screen must be redrawn (because the viewer changes size, etc.). Use the supplied QuitProc to clean up on program termination (which occurs when the viewer is destroyed). The ButtonProc will be supplied with the button name, the mouse position and the state of the control and shift keys when called.
DrawInViewer: PROC [proc: PROC [Imager.Context]];
Callback procedure used to draw on display. QuickViewer will supply the Imager context to the supplied procedure then call it.
This is needed for getting at the viewer ( eg. for discovering which column you're on, etc.)
Reset: PROC [context: Imager.Context];
QuickView: TYPE = REF QuickViewData;
QuickViewData: TYPE = RECORD
[ outer: Containers.Container ← NIL,         -- enclosing container
 viewer: ViewerClasses.Viewer,          -- graphics area within
 terminal: Terminal.Virtual,
 xTranslation, yTranslation: REAL ← 0.,
 xLeft, xRight, yBottom, yTop: REAL,
 paint: PROC [context: Imager.Context]
];
END.