SeveralEmptyContainers.mesa; Written by S. McGregor
Last Edited by: McGregor, July 18, 1983 9:17 am
Last Edited by: Pausch, August 19, 1983 2:20 pm
DIRECTORY
Containers,
Imager,
MessageWindow,
Menus,
VFonts,
ViewerClasses;
SeveralEmptyContainers: CEDAR PROGRAM IMPORTS Containers, Imager, Menus, VFonts, MessageWindow = BEGIN
c: Containers.Container;
Mynotify: ViewerClasses.NotifyProc = {
[self: Viewer, input: LIST OF REF ANY]
FOR current:
LIST
OF
REF
ANY ← input, current.rest
UNTIL current =
NIL
DO
SELECT current.first
FROM
$A11 => MessageWindow.Append["container menu 11 hit", TRUE] ;
$A12 => MessageWindow.Append["container menu 12 hit", TRUE];
$A13 => MessageWindow.Append["container menu 13 hit", TRUE];
$A14 => MessageWindow.Append["container menu 14 hit", TRUE];
$A21 => MessageWindow.Append["container menu 21 hit", TRUE];
$A22 => MessageWindow.Append["container menu 22 hit", TRUE];
$A23 => MessageWindow.Append["container menu 23 hit", TRUE];
$A24 => MessageWindow.Append["container menu 24 hit", TRUE];
$A31 => MessageWindow.Append["container menu 31 hit", TRUE];
$A32 => MessageWindow.Append["container menu 32 hit", TRUE];
$A33 => MessageWindow.Append["container menu 33 hit", TRUE];
$A34 => MessageWindow.Append["container menu 34 hit", TRUE];
$A35 => MessageWindow.Append["container menu 35 hit", TRUE];
$A36 => MessageWindow.Append["container menu 36 hit", TRUE];
ENDCASE => ERROR;
ENDLOOP;
};
menus:
LIST
OF Menus.Menu =
LIST [
[name: "m1",
beginsActive: TRUE,
breakBefore: FALSE,
breakAfter: TRUE,
notify: Mynotify,
entries:
LIST[
["1",
FALSE,
NIL,
LIST[
[LIST[all], LIST[$A11], "DOC", "", NIL, NIL, NIL]
] ],
["2",
FALSE, "2--putupmenuThree",
LIST[
[LIST[all], LIST[$A12], "DOC", "", LIST["m3"], NIL, NIL]
] ],
["3",
FALSE, "3--putdownmenuThree",
LIST[
[LIST[all], LIST[$A13], "DOC", "", NIL, LIST["m3"], NIL]
] ],
["4",
FALSE, "4, toggles menu 2 puts up menu 3",
LIST[
[LIST[all], LIST[$A14], "DOC ", "", LIST["m3"], NIL, LIST["m2"]],
] ]
]
],
[name: "m2",
beginsActive: TRUE,
breakBefore: FALSE,
breakAfter: TRUE,
notify: Mynotify,
entries:
LIST[
["1",
FALSE,
NIL,
LIST[
[LIST[all], LIST[$A21], "DOC", "", NIL, NIL, NIL]
] ],
["2",
FALSE,
NIL,
LIST[
[LIST[all], LIST[$A22], "DOC", "", NIL, NIL, NIL]
] ],
["3",
FALSE,
NIL --NEW[Menus.DrawingRec ← myDrawingRec]--,
LIST[
[LIST[all], LIST[$A23], "DOC", "", NIL, NIL, NIL]
] ],
["4",
FALSE,
NIL,
LIST[
[LIST[all], LIST[$A24], "DOC", "", NIL, NIL, NIL]
] ]
]
],
[name: "m3",
beginsActive: TRUE,
breakBefore: FALSE,
breakAfter: TRUE,
notify: Mynotify,
entries:
LIST[
["1 for menu three IS LONG",
FALSE,
NIL,
LIST[
[LIST[all], LIST[$A31], "DOC", "", NIL, NIL, NIL]
] ],
["2 for menu three IS LONG",
FALSE,
NIL,
LIST[
[LIST[all], LIST[$A32], "DOC", "", NIL, NIL, NIL]
] ],
["3 for menu three IS LONG",
FALSE,
NIL,
LIST[
[LIST[all], LIST[$A33], "DOC", "", NIL, NIL, NIL]
] ],
["4 for menu three IS LONG",
FALSE,
NIL,
LIST[
[LIST[all], LIST[$A34], "DOC", "", NIL, NIL, NIL]
] ],
["5 for menu three IS LONG",
FALSE,
NIL,
LIST[
[LIST[all], LIST[$A35], "DOC", "", NIL, NIL, NIL]
] ],
["6 for menu three IS LONG",
FALSE,
NIL,
LIST[
[LIST[all], LIST[$A36], "DOC", "", NIL, NIL, NIL]
] ]
]
]
] ;-- end list of type ViewerMenus
myDrawingRec: Menus.DrawingRec ~ [myDrawingProc, "M23M"];
myDrawingProc: Menus.MenuDrawingProc = {
[op: ViewerClasses.MenuEntryDisplayOp, ctx: Imager.Context ← NIL, clientData: REF ANY ← NIL] RETURNS[width: INTEGER ← 64]
IF op = query THEN RETURN[100];
Imager.MaskCharacters[ctx, VFonts.defaultFont, NARROW[clientData, REF TEXT]];
Imager. MaskSegment[ctx, [512.0,808.0] ];
};
[] ← Containers.Create[[name: "#1 Empty Container #1"]];
[] ← Containers.Create[[name: "#2 Empty PROTECTED Container #2", guardDestroy: TRUE]];
[] ← Containers.Create[[name: "#3 Empty Container #3"]];
c ← Containers.Create[[name: "#4 Empty PROTECTED Container #4", guardDestroy: TRUE]];
FOR m:
LIST
OF Menus.Menu ← menus, m.rest
UNTIL m =
NIL
DO
Menus.RegisterMenu[m.first];
Menus.AddMenu[c, m.first.name, FALSE];
ENDLOOP;
c ← Containers.Create[[name: "#5 Empty PROTECTED Container #5", guardDestroy: TRUE]];
FOR m:
LIST
OF Menus.Menu ← menus, m.rest
UNTIL m =
NIL
DO
Menus.AddMenu[c, m.first.name, FALSE];
ENDLOOP;
c ← Containers.Create[[name: "#6 Empty PROTECTED Container #6", guardDestroy: TRUE]];
FOR m:
LIST
OF Menus.Menu ← menus, m.rest
UNTIL m =
NIL
DO
Menus.AddMenu[c, m.first.name, FALSE];
ENDLOOP;
END.