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
Last Edited by: Pausch, August 26, 1983 12:08 pm
DIRECTORY
Menus USING [Entry],
Rope USING [ROPE],
VFonts USING [defaultFont, Font],
ViewerOps USING [DestroyViewer],
ViewerClasses USING [NotifyProc, 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: ViewerClasses.NotifyProc, entry: Menus.Entry, font: VFonts.Font ← VFonts.defaultFont, paint: BOOLTRUE] RETURNS [button: Button];
entry contains all vital information for the input actions, just as if it were an entry in a real menu. Information for the button viewer is taken from info. 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.
Destroy: PROC [button: Button] = INLINE {ViewerOps.DestroyViewer[button]};
ReLabel: PROC [button: Button, newName: Rope.ROPE, paint: BOOLTRUE] = INLINE
{button.class.set[button, newName, paint]};
Change the text of a button (but alas, not the size)
SetClientData: PROC [button: Button, newData: REF ANY] = INLINE
{button.class.set[button, newData, FALSE, $ClientData]} ;
SetDisplayStyle: PROC [button: Button, style: ATOM, paint: BOOLTRUE] = INLINE
{button.class.set[button, style, paint, $DisplayStyle]} ;
recognised display styles are:
$BlackOnWhite - black letters on white background (default)
$WhiteOnBlack - white letters on black background
$BlackOnGrey - black letters on grey background
END.