MenusPrivate.mesa; Written by S. McGregor
Edited by McGregor on July 21, 1983 10:43 am
Last Edited by: Maxwell, December 17, 1982 9:59 am
Last Edited by: Pausch, August 17, 1983 4:38 pm
Last Edited by: Wyatt, November 14, 1983 12:56 pm
DIRECTORY
Imager USING [Context],
Menus USING [Action, Entry],
Process USING [Milliseconds],
Rope USING [ROPE],
TIPUser USING [TIPScreenCoords],
ViewerClasses USING [Viewer];
MenusPrivate: CEDAR DEFINITIONS
= BEGIN
Viewer:
TYPE = ViewerClasses.Viewer;
menuHLeading: INTEGER = 5; -- white space before first entry
menuHSpace: INTEGER = 12; -- white space between entries
Action: TYPE = Menus.Action;
EntryState: TYPE = { guarded, arming, armed };
EntryInfo: TYPE = REF EntryInfoRec;
EntryInfoRec:
TYPE =
MONITORED
RECORD[
name: Rope.ROPE,
actions: LIST OF Action,
x, y: INTEGER ← 0, -- lower left corner of the entry, relative to the viewer
w: INTEGER ← 0, -- width of the entry
guarded: BOOL ← FALSE,
state: EntryState ← armed,
greyCount: CARDINAL ← 0
];
LineInfo: TYPE = REF LineInfoRec;
LineInfoRec:
TYPE =
RECORD[
name: ATOM,
entries: LIST OF EntryInfo ← NIL,
active: BOOL ← TRUE
];
MenuInfo: TYPE = REF MenuInfoRec;
MenuInfoRec:
TYPE =
RECORD[
lines: LIST OF LineInfo,
x, y: INTEGER ← 0, -- lower-left corner of menu region of viewer, relative to the viewer
w, h: INTEGER ← 0, -- width and height of menu region of viewer
inverted: EntryInfo ← NIL
];
armingTime: Process.Milliseconds = 100; -- cover removal time.
armedTime: Process.Milliseconds = 5000; -- unguarded interval.
TIPScreenCoords: TYPE = TIPUser.TIPScreenCoords;
Trigger: TYPE = [0..6);
MakeEntry:
PROC[entry: Menus.Entry]
RETURNS[EntryInfo];
ChooseAction:
PROC[entry: EntryInfo, trigger: Trigger]
RETURNS[Action];
GuardResponse:
PROC[viewer: Viewer, action: Action];
MarkMenu:
PROC[menu: MenuInfo, parent: Viewer, mousePos: TIPScreenCoords];
Called when the mouse is pressed down over a menu to do the proper inverse-video stuff.
HitMenu:
PROC[menu: MenuInfo, parent: Viewer, mousePos: TIPScreenCoords, trigger: Trigger];
Called when a mouse button is released over a menu.
ClearMenu: PROC[menu: MenuInfo, parent: Viewer, paint: BOOL ← TRUE] ;
DrawMenu:
PROC[v: Viewer, menu: MenuInfo,
context: Imager.Context, whatChanged: REF ANY ← NIL];
EstablishHeader:
PROC[v: Viewer]
RETURNS[y:
INTEGER];
Determines the space occupied by the viewer's caption and menu.
Uses the following: v.ww, v.wh, v.border, v.parent, and v.column.
Returns the distance from the bottom of the header to the bottom of the viewer.
ViewerlessAddMenu:
PROC [name:
ATOM, addBefore:
ATOM ←
NIL, paint:
BOOL ←
TRUE];
provided for convenience of BuildWindowMenus in WindowManagerImpl
ReComputeWindowMenus:
PROC [v: Viewer, guard:
BOOL, color:
BOOL];
this will reset all fields in the data structure, including position and size of each entry.
END.