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
Last Edited by: Wyatt, October 7, 1983 2:18 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, clientData: REF ANYNIL, 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 info.parent=NIL, creates a "system" button at the top of the screen.
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, clientData: REF ANY] = INLINE
{button.class.set[button, clientData, FALSE, $ClientData]} ;
GetClientData: PROC [button: Button] RETURNS[clientData: REF ANY] = INLINE
{RETURN[button.class.get[button, $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.