DIRECTORY Abutters USING [Abutter], IO USING [STREAM], Rope USING [ROPE], ViewerClasses USING [Viewer]; GenericTool: CEDAR DEFINITIONS ~ BEGIN ROPE: TYPE ~ Rope.ROPE; STREAM: TYPE ~ IO.STREAM; Viewer: TYPE ~ ViewerClasses.Viewer; ToolHandle: TYPE ~ REF ToolObject; ToolObject: TYPE ~ RECORD[ abutter: Abutters.Abutter, controlsViewer: Viewer, logViewer: Viewer, in, out: STREAM, preDestroy: ButtonProc _ NIL, control: REF ANY, data: REF ANY]; ButtonProc: TYPE ~ PROC [tH: ToolHandle]; OptionList: TYPE ~ LIST OF Option; Option: TYPE ~ RECORD [ name: ROPE, it: SELECT kind: * FROM readonly => [], invisible => [], notify => [proc: ButtonProc] ENDCASE ]; CreateInstance: PROC [ toolName: ROPE, control: REF ANY, options: OptionList, data: REF ANY _ NIL, preDestroy: ButtonProc _ NIL] RETURNS [tH: ToolHandle]; PutMsgRope: PROC [tH: ToolHandle, rope: ROPE, clear: BOOL _ FALSE]; END. ΨGenericTool.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Demers, January 31, 1986 3:41:46 pm PST A primitive interface for generic tool construction. Generic tool info Client data structure The PROCs in the client's controls object should be ButtonProcs. CreateInstance arranges to pass the ToolHandle to each ButtonProc "invisibly"; the ButtonProc can access the controls and client data records through it. Create a tool instance. The record to be displayed by ViewRec is control^. Display of individual fields is controlled by options. Client data can go either in data^ or in invisible fields of control^. Each ButtonProc invocation provides a ToolHandle, from which control and data can be recovered. If supplied, preDestroy will be called just prior to destroying the viewer (in response to the user's clicking "destroy" in the caption bar). Print message on the ViewRec message (sub-)viewer. If clear is TRUE, clear the (sub-)viewer first. Κ%˜codešœ™Kšœ Οmœ1™