DIRECTORY Menus USING [ClickProc], Rope USING [ROPE], VFonts USING [defaultFont, Font], ViewerOps USING [DestroyViewer], ViewerClasses USING [Viewer, ViewerRec]; Buttons: CEDAR DEFINITIONS IMPORTS VFonts, ViewerOps = BEGIN OPEN ViewerClasses; Button: TYPE = Viewer; -- A button is a viewer that posts a message and when clicked, invokes a procedure. Create: PROC [info: ViewerRec _ [], proc: ButtonProc, clientData: REF ANY _ NIL, fork: BOOL _ TRUE, font: VFonts.Font _ VFonts.defaultFont, documentation: REF ANY _ NIL, guarded: BOOL _ FALSE, paint: BOOL _ TRUE] RETURNS [button: Button] ; Destroy: PROC [button: Button] = INLINE {ViewerOps.DestroyViewer[button]}; ReLabel: PROC [button: Button, newName: Rope.ROPE, paint: BOOL _ TRUE] = INLINE {button.class.set[button, newName, paint]}; SetClientData: PROC [button: Button, newData: REF ANY] = INLINE {button.class.set[button, newData, FALSE, $ClientData]} ; SetDisplayStyle: PROC [button: Button, style: ATOM, paint: BOOL _ TRUE] = INLINE {button.class.set[button, style, paint, $DisplayStyle]} ; ButtonProc: TYPE = Menus.ClickProc; END. ˜Buttons.mesa; Written by S. McGregor Edited by McGregor on July 29, 1983 2:17 pm Last Edited by: Maxwell, December 17, 1982 10:06 am info.name contains the message displayed within the button. If the info.wh and info.ww are defaulted, aesthetic values will be chosen based on the height and width of the name. Defaulting the info.wx and info.wy, with parent=NIL creates a "system" button appended after the most recent system button after the message window. fork tells whether to create and detach a new process on calling. clientData is the info that will be passed to proc on invocation. guarded buttons must be confirmed by the user before invocation. documentation may either be a REF ButtonProc or a Rope.ROPE. Documentation will be posted for guarded buttons when the guard is removed on the first click. If the documentation is a Rope.ROPE then it will be posted in the MessageWindow, otherwise the client's proc will be called. Implementation guide: the proc that calls a button proc has an ! ABORT => CONTINUE catch phrase so that the client may make use of Process.Abort to cancel execution. If fork=FALSE then proc will be called at Process.priorityForeground! Change the text of a button (but alas, not the size) recognised display styles are: $BlackOnWhite - black letters on white background (default) $WhiteOnBlack - white letters on black background $BlackOnGrey - black letters on grey background Κμ– "cedar" style˜JšΟc$™$Jš+™+Jšœ3™3J™šΟk ˜ Jšœžœ ˜Jšœžœžœ˜Jšœžœ˜!Jšœ žœ˜ Jšœžœ˜(J˜—Jš œ žœžœžœžœ˜PJ˜Jšœžœ S˜kJ˜š Οnœžœ6žœžœžœ˜PJš œžœžœ9žœžœžœ˜XJš œ žœžœ žœžœžœ˜EJ˜—Jš™J˜Jšš™šJ˜Jšν™νJ˜J˜JšŸœžœžœ#˜JJ˜š Ÿœžœ žœ žœžœž˜OJ˜+Jš4™4J˜—š Ÿ œžœžœžœž˜?Jšœ#žœ˜9J˜—š Ÿœžœžœ žœžœž˜PJ˜9Jš™Jš;™;Jš1™1Jš/™/J˜—Jšœ žœ˜#J˜Jšžœ˜J˜J˜—…—T Ψ