NutButtons.mesa;
Last Edited by: Butler, July 15, 1984 4:09:20 pm PDT
DIRECTORY
Buttons USING [ButtonProc],
Menus USING [ClickProc, MenuEntry],
MBQueue USING [Action],
Rope USING [ROPE],
VFonts USING [Font],
ViewerClasses USING [Viewer, ViewerRec];
NutButtons: CEDAR DEFINITIONS
=
BEGIN OPEN ViewerClasses;
NutButton: TYPE = Viewer; -- A button is a viewer that posts a message and when clicked, invokes a procedure.
ButtonFontInfo: TYPE = REF ButtonFontInfoRec;
ButtonFontInfoRec: TYPE = RECORD [
twoFont: BOOL ← FALSE,
singleFont: VFonts.Font ← NIL,
attrFont: VFonts.Font ← NIL,
valFont: VFonts.Font ← NIL];
Create: PROC [info: ViewerRec ← [], proc: Buttons.ButtonProc, clientData: REF ANYNIL,
fork: BOOLFALSE, documentation: REF ANYNIL, font: ButtonFontInfo ← NIL,
guarded: BOOLFALSE, paint: BOOLTRUE]
RETURNS [button: NutButton] ;
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!
Queue: TYPE = REF QueueObj;
QueueObj: TYPE;
Action: TYPE = MBQueue.Action;
QueueButton: PROC [
q: Queue, info: ViewerClasses.ViewerRec ← [], proc: Buttons.ButtonProc,
clientData: REF ANYNIL, fork: BOOLTRUE, font: ButtonFontInfo ← NIL,
documentation: REF ANYNIL, guarded: BOOLFALSE, paint: BOOLTRUE]
RETURNS [NutButton];
CreateQueue: PROC [pushModel: BOOL] RETURNS [Queue];
CreateQMenuEntry: PROC [
q: Queue, name: Rope.ROPE, proc: Menus.ClickProc, clientData: REF ANYNIL,
documentation: REF ANYNIL, fork: BOOLTRUE, guarded: BOOLFALSE]
RETURNS [Menus.MenuEntry];
QueueClientAction: PROC [
q: Queue, proc: PROC [REF ANY], data: REF ANY];
DequeueAction: PROC [q: Queue] RETURNS [Action];
Flush: PROC [q: Queue];
END.