DIRECTORY Process USING [Milliseconds], Rope USING [ROPE], ViewerClasses USING [ClickProc, Menu, MenuRec, MenuEntry, MenuEntryRec, MenuLine, MouseButton]; Menus: CEDAR DEFINITIONS = BEGIN Menu: TYPE = ViewerClasses.Menu; MenuRec: TYPE = ViewerClasses.MenuRec; MenuEntry: TYPE = ViewerClasses.MenuEntry; MenuEntryRec: TYPE = ViewerClasses.MenuEntryRec; MenuLine: TYPE = ViewerClasses.MenuLine; CreateMenu: PROC [lines: MenuLine ¬ 1] RETURNS [menu: Menu]; CopyMenu: PROC [old: Menu] RETURNS [new: Menu]; MouseButton: TYPE = ViewerClasses.MouseButton; ClickProc: TYPE = ViewerClasses.ClickProc; MenuProc: TYPE = ClickProc; CreateEntry: PROC [name: Rope.ROPE, proc: ClickProc, clientData: REF ANY ¬ NIL, documentation: REF ANY ¬ NIL, fork: BOOL ¬ TRUE, guarded: BOOL ¬ FALSE ] RETURNS [entry: MenuEntry]; CopyEntry: PROC [oldEntry: MenuEntry] RETURNS [newEntry: MenuEntry]; SetGuarded: PROC [entry: MenuEntry, guard: BOOL]; SetClientData: PROC [entry: MenuEntry, newData: REF ANY] RETURNS [oldData: REF ANY]; SetDocumentation: PROC [entry: MenuEntry, newDoc: REF ANY] RETURNS [oldDoc: REF ANY]; FindEntry: PROC [menu: Menu, entryName: Rope.ROPE] RETURNS [entry: MenuEntry]; AppendMenuEntry: PROC [menu: Menu, entry: MenuEntry, line: MenuLine ¬ 0]; InsertMenuEntry: PROC [menu: Menu, entry: MenuEntry, line: MenuLine ¬ 0]; ReplaceMenuEntry: PROC [menu: Menu, oldEntry: MenuEntry, newEntry: MenuEntry ¬ NIL]; MenuFromMenuEntry: PUBLIC PROC [entryList: MenuEntry] RETURNS [Menu]; MenuEntryFind: PUBLIC PROC[entryName: Rope.ROPE, entryList: MenuEntry] RETURNS [MenuEntry]; MenuEntryAppend: PUBLIC PROC[entry: MenuEntry, entryList: MenuEntry] RETURNS [MenuEntry]; MenuEntryInsert: PUBLIC PROC[entry: MenuEntry, entryList: MenuEntry] RETURNS [MenuEntry]; MenuEntryReplace: PUBLIC PROC[entryList: MenuEntry, old: MenuEntry, new: MenuEntry] RETURNS [MenuEntry]; targetNotFound: SIGNAL; ChangeNumberOfLines: PROC [menu: Menu, newLines: MenuLine]; GetNumberOfLines: PROC [menu: Menu] RETURNS [lines: MenuLine]; SetLine: PROC [menu: Menu, line: MenuLine, entryList: MenuEntry]; GetLine: PROC [menu: Menu, line: MenuLine] RETURNS [entryList: MenuEntry]; armingTime: Process.Milliseconds = 100; -- cover removal time. armedTime: Process.Milliseconds = 5000; -- unguarded interval. END. ˜ Menus.mesa Copyright Ó 1985, 1986, 1987, 1991 by Xerox Corporation. All rights reserved. Edited by McGregor on September 1, 1982 4:19 pm Last Edited by: Maxwell, December 17, 1982 9:58 am Doug Wyatt, January 20, 1987 0:02:56 am PST Willie-s, October 8, 1991 1:05 pm PDT Menus are the "button-like" commands displayed across the top of a viewer. Creating menus Create a new menu with some number of lines of entries Copy a menu and all of its entries Menu notifications For menus, parent is the parent Viewer; mouseButton indicates how the user invoked the button or menu; shift and control indicate the state of the shift and control keys when the menu was invoked. A synonym, for compatibility. Operations on MenuEntries Create an item that can be added to a menu. 'name' is the text that will be displayed to the user, 'proc' is the procedure that will get called when the user invokes the menu, 'clientData' is arbitray data that will be passed to the proc, 'documentation' may either be a Rope.ROPE or a ClickProc and will either be displayed in the message window or called respectively when a guarded entry has its cover removed. 'fork' will FORK and Detach a separate process when the proc is called, 'guarded' menu items have a diagonal cross-hatch pattern over the text that is removed when the user clicks at the menu item. Only if the user clicks at a guarded menu item while the 'cover' is off will the proc be called. Operations on Menus Search for an entry given the name. Will return NIL if target name not found. Add a new menu entry to the end of a line Add a new menu entry to the front of a line Change an existing entry in a menu. If newEntry is NIL then the oldEntry will be deleted. Will raise targetNotFound if target entry not found. Append, insert, and replace MenuEntry's to/in linked lists of MenuEntry's. Returns a Menu with line 0 begin the given entryList. Search for an entry given the name. Will return NIL if target name not found. Add the entry to the end of the list. Add the entry to the beginning of the list. Change an existing entry in a menu. If new is NIL then old will be deleted. Will raise targetNotFound if target entry not found. Êÿ•NewlineDelimiter –(cedarcode) style™codešœ ™ Kšœ ÏeœC™NKšœ/™/Kšœ2™2K™+K™%K™—šÏk ˜ Kšœžœ˜Kšœžœžœ˜KšœžœL˜_—K˜KšœJ™JK™KšÐblœžœž ˜Kšœž˜K˜Kšœžœ˜ Kšœ žœ˜&Kšœ žœ˜*Kšœžœ˜0Kšœ žœ˜(K˜Kšœ™K˜šÏn œžœžœ˜K˜—š œžœ4˜AK˜—š œžœžœ˜JK˜—K˜Kšœ(Ïc˜>Kšœ(¡˜>K˜Kšžœ˜—…—þ•