Menus.mesa
Menus are collections of entries. Entries are selectable regions at the top of viewers that can cause TIP-like actions to be passed to notifyProcs.
Last Edited by:
Pausch, August 26, 1983 10:18 am
Wyatt, November 10, 1983 2:09 pm
DIRECTORY
Rope USING [ROPE],
ViewerClasses USING [Input, Viewer];
Menus: CEDAR DEFINITIONS
= BEGIN
Viewer: TYPE = ViewerClasses.Viewer;
Input: TYPE = ViewerClasses.Input;
ROPE: TYPE = Rope.ROPE;
Action: TYPE = RECORD[
name: ROPE, -- name of action (for pop-up menu)
input: Input, -- input to be passed to the notify proc
doc: ROPE-- description of the action (don't be lazy, now ...)
];
Actions may be shared, so the contents of an Action must be considered immutable.
Entry: TYPE = RECORD[
name: ROPE,
actions: LIST OF Action,
guarded: BOOLFALSE
];
Entries may be shared, so the contents of an Entry must be considered immutable.
Line: TYPE = REF LineRep; -- a line of Entries
LineRep: TYPE = RECORD[
name: ATOM,
entries: LIST OF Entry,
active: BOOLTRUE
];
Lines may be shared, so the contents of a Line must be considered immutable.
Menu: TYPE = LIST OF Line;
Parsing menu descriptions
ParseDescription: PROC[def: ROPE, errorFile: ROPENIL] RETURNS[Menu];
The rope is parsed for a menu description, as laid out in MenuBNF.tioga. Returns NIL if any errors are found. If errorFile is not NIL, it names a file to which error reports are written.
Manipulating a Viewer's menu
SetMenu: PROC[viewer: Viewer, menu: Menu, paint: BOOLTRUE];
LineInViewer: PROC[viewer: Viewer, name: ATOM] RETURNS[exists: BOOLEAN];
Change: TYPE = {show, hide, toggle};
ChangeLine: PROC[viewer: Viewer, name: ATOM, change: Change, paint: BOOLTRUE];
ShowLine: PROC[viewer: Viewer, name: ATOM, paint: BOOLTRUE]
= INLINE { ChangeLine[viewer, name, show, paint] };
HideLine: PROC[viewer: Viewer, name: ATOM, paint: BOOLTRUE]
= INLINE { ChangeLine[viewer, name, hide, paint] };
ToggleLine: PROC[viewer: Viewer, name: ATOM, paint: BOOLTRUE]
= INLINE { ChangeLine[viewer, name, toggle, paint] };
END.