DIRECTORY Rope USING [ROPE]; PopUpMenus: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Rope.ROPE; Menu: TYPE = REF MenuRep; --handle representing a popup menu MenuRep: TYPE = PRIVATE RECORD [impl: REF]; EntryProc: TYPE = PROC [menu: Menu¬NIL, entryData: REF¬NIL, callData: REF¬NIL] RETURNS [REF¬NIL]; Create: PROC [header: ROPE¬NIL, doc: ROPE¬NIL, clientData: REF¬NIL] RETURNS [Menu]; Entry: PROC [menu: Menu, entry: ROPE¬NIL, proc: EntryProc¬NIL, entryData: REF¬NIL, doc: ROPE¬NIL] RETURNS [sameMenu: Menu]; Timeout: PROC [menu: Menu, time: INT¬0, proc: EntryProc¬NIL, entryData: REF¬NIL] RETURNS [sameMenu: Menu]; Skipped: PROC [menu: Menu, proc: EntryProc¬NIL, entryData: REF¬NIL] RETURNS [sameMenu: Menu]; ReLabel: PROC [menu: Menu, header: ROPE¬NIL, doc: ROPE¬NIL] RETURNS [sameMenu: Menu]; Call: PROC [menu: Menu, callData: REF¬NIL, position: REF¬NIL, default: REF¬NIL] RETURNS [REF]; ClientData: PROC [menu: Menu] RETURNS [REF]; END. „ PopUpMenus.mesa Copyright Σ 1986, 1991 by Xerox Corporation. All rights reserved. Created by: Christian Jacobi, August 22, 1986 11:00:59 am PDT Last Edited by: Christian Jacobi, December 23, 1986 12:02:55 pm PST Package which supports composition and invocation of popup menus. Type of procedure called on menu selection menu: popup menu used entryData: as defined for the menu entry callData: as given by call returned value is passed to caller of menu The NIL initializations are only of use for clients to call procedure directly Creates a new popup menu (class) (creates the handle, but does not invoke the created popup menu yet) header: header line of popup menu doc: documentation for header line and outside clientData: stored for the client Makes an entry line for a popup menu Replaces existing line if entry rope is already used entry: text for menu line proc: will be called on selection entryData: passed to proc on call a NIL proc and a NIL entryData: removes entry from menu a NIL proc: on call returns entryData doc: documentation for this line sameMenu: for conveniance returns menu again Defines behaviour of popup menu on timeout time: in seconds; 0 for no timeout proc: will be called on timeout when menu is called entryData: passed to proc on timeout call a NIL proc and a NIL entryData: no-op on time out (Normal case!) a NIL proc: on timeout returns entryData sameMenu: for conveniance returns menu again Defines behaviour of popup menu when called and skipped (no entry selected, no timeout) proc: will be called on timeout when menu is called entryData: passed to proc on timeout call, or returned if proc=NIL sameMenu: for conveniance returns menu again Most menus do NOT define a skipped behaviour Redefines header and doc for a menu header: header line of popup menu doc: documentation for header line and outside sameMenu: for conveniance returns menu again Calls a popup menu (draws the menu, accepts interactive selection and calls the EntryProc) returns data returned from called EntryProc or entryData if EntryProc was NIL menu: popup menu to be used callData: passed to the EntryProc position: position of popup menu (see documentation) defaults to: the current mouse position default: entry line to select at the beginning; hint only! (see documentation) defaults to: no line selected at the beginning returns clientData as given on Create Κˆ•NewlineDelimiter –(cedarcode) style™codešœ™Kšœ Οeœ6™BK™=K™C—K˜šΟk œ˜ Kšœžœžœ˜—K˜KšΟb œžœž œ˜ Kšž˜K˜KšœA™AK˜Kšžœžœžœ˜Kšœžœžœ Οc"˜=Kš œ žœžœžœžœ˜+K˜šœ žœžœ žœ žœžœ žœžœžœžœžœ˜aK™*Kšœ™Kšœ)™)Kšœ™Kšœ*™*K™N—K˜šΟnœžœ žœžœžœžœžœžœžœ˜Sšœ œ ™ Kšœ5 œ ™D—Kšœ"™"Kšœ/™/Kšœ!™!K˜—š‘œžœžœžœžœ žœžœžœžœžœ˜{Kš œ ™%Kš 8™8Kš ™Kšœ"™"Kšœ"™"Kšœ$ œ™;Kšœ)™)Kšœ!™!Kšœ,™,K˜—š‘œžœžœžœ žœžœžœ˜jKšœ*™*Kšœ#™#Kšœ4™4Kšœ*™*KšœD™DKšœ,™,Kšœ,™,K˜—š ‘œžœžœ žœžœžœ˜]KšœW™WKšœ4™4KšœC™CKšœ,™,K™,K˜—š‘œžœžœžœžœžœžœ˜UKšœ#™#Kšœ"™"Kšœ/™/Kšœ,™,K˜—š‘œžœžœžœ žœžœ žœžœžœžœ˜^Kšœ™KšœK™KK™+Kšœ%™%Kšœ™Kšœ!™!Kšœ5™5Kšœ(™(KšœN™NKšœ/™/K˜—š ‘ œžœžœžœž˜,Kšœ%™%—K˜Kšžœ˜K˜K˜K˜—…—ΎΚ