CDMenuSpecialsImpl.mesa (part of ChipNDale)
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, June 5, 1985 8:02:35 pm PDT
Last edited by: Christian Jacobi, August 24, 1986 8:21:47 pm PDT
DIRECTORY
CD,
CDMenuSpecials,
PopUpMenus,
Rope,
SymTab;
CDMenuSpecialsImpl: CEDAR MONITOR
IMPORTS PopUpMenus, SymTab
EXPORTS CDMenuSpecials =
BEGIN
SelectOneOf: PUBLIC PROC[ref: SymTab.Ref, label: Rope.ROPE] RETURNS [Rope.ROPENIL] = {
cnt: INT ← 0; menu, firstMenu: PopUpMenus.Menu; x: REF;
EachEntry: SymTab.EachPairAction = { --key: Rope.ROPE
quit ← FALSE;
IF cnt>10 THEN {
newMenu: PopUpMenus.Menu ← PopUpMenus.Create[header: label];
[] ← PopUpMenus.Entry[menu: menu, entry: "more ?", entryData: newMenu, doc: "more entries for this menu"];
menu ← newMenu;
cnt ← 0
};
cnt ← cnt+1;
[] ← PopUpMenus.Entry[menu: menu, entry: key, entryData: key]
};
menu ← firstMenu ← PopUpMenus.Create[header: label];
[] ← ref.Pairs[EachEntry];
IF menu#firstMenu THEN
[] ← PopUpMenus.Entry[menu: menu, entry: "again ?", entryData: firstMenu, doc: "show beginning entries again"];
x ← PopUpMenus.Call[firstMenu];
WHILE x#NIL AND ISTYPE[x, PopUpMenus.Menu] DO
x ← PopUpMenus.Call[NARROW[x]];
ENDLOOP;
RETURN [ NARROW[x] ];
};
END.