Buttons.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Edited by McGregor on August 30, 1982 4:05 pm
Last Edited by: Maxwell, December 17, 1982 10:06 am
Doug Wyatt, April 14, 1985 11:05:16 pm PST
DIRECTORY
Imager USING [Font],
Menus USING [ClickProc],
Rope USING [ROPE],
ViewerClasses USING [Viewer, ViewerRec];
A button is a viewer that posts a message and, when clicked, invokes a procedure.
Buttons: CEDAR DEFINITIONS
= BEGIN OPEN ViewerClasses;
Button: TYPE = Viewer;
ButtonProc: TYPE = Menus.ClickProc;
Create: PROC [info: ViewerRec ← [],
proc: ButtonProc,
clientData: REF ANYNIL,
fork: BOOLTRUE,
font: Imager.Font ← NIL,
documentation: REF ANYNIL,
guarded: BOOLFALSE,
paint: BOOLTRUE
] RETURNS [button: Button];
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. Documentation will be posted for guarded buttons when the guard is removed on the first click. If the documentation is a 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!
Destroy: PROC [button: Button];
ReLabel: PROC [button: Button, newName: Rope.ROPE, paint: BOOLTRUE];
Change the text of a button (but alas, not the size)
SetDisplayStyle: PROC [button: Button, style: ATOM, paint: BOOLTRUE];
recognised display styles are:
$BlackOnWhite - black letters on white background (default)
$WhiteOnBlack - white letters on black background
$BlackOnGrey - black letters on grey background
END.