HierarchicalDisplays.Mesa
Last Edited by: Spreitzer, July 8, 1985 8:03:51 pm PDT
DIRECTORY Buttons, Rope, ViewerClasses;
HierarchicalDisplays: CEDAR DEFINITIONS =
BEGIN
ROPE: TYPE = Rope.ROPE;
Viewer: TYPE = ViewerClasses.Viewer;
ViewerRec: TYPE = ViewerClasses.ViewerRec;
Button: TYPE = Buttons.Button;
Parent: TYPE = REF ParentRep;
ParentRep:
TYPE =
RECORD [
container: Viewer,
firstChild, lastChild: Child ← NIL,
asChild: Child ← NIL,
rx, ty: INTEGER ← 0,
by: INTEGER ← minH];
minH: INTEGER = 10;
Child: TYPE = REF ChildRep;
ChildRep:
TYPE =
RECORD [
container: Viewer,
forceNewline: BOOLEAN ← FALSE,
nameButton: Button ← NIL,
parent: Parent,
next, prev: Child ← NIL,
class: ChildClass, classData, instanceData: REF ANY,
variant:
SELECT type: ChildType
FROM
TypeLeaf => [value: Viewer],
TypeParent => [asParent: Parent],
ENDCASE];
ChildType: TYPE = {TypeLeaf, TypeParent};
Leaf: TYPE = REF ChildRep[TypeLeaf];
InternalNode: TYPE = REF ChildRep[TypeParent];
ChildClass: TYPE = REF ChildClassRep;
ChildClassRep:
TYPE =
RECORD [
buttonProc: Buttons.ButtonProc,
-- = Menus.MenuProc
will be called with clientData = the Child.
NotifyOnRemove: ChildNotifyProc ← NIL];
ChildNotifyProc: TYPE = PROC [child: Child];
LeafNotifyProc: TYPE = PROC [leaf: Leaf];
ValueCreater: TYPE = PROC [leaf: Leaf] RETURNS [value: Viewer];
CreateRoot: PROC [viewerInit: ViewerRec, paint: BOOLEAN ← TRUE] RETURNS [p: Parent];
AddLeaf: PROC [parent: Parent, before: Child, name: ROPE, class: ChildClass, classData, instanceData: REF ANY ← NIL, CreateValue: ValueCreater] RETURNS [leaf: Leaf];
AddInternalNode: PROC [parent: Parent, before: Child, name: ROPE, class: ChildClass, classData, instanceData: REF ANY ← NIL] RETURNS [internal: InternalNode];
Remove: PROC [child: Child];
Pack: PROC [parent: Parent, paint: BOOLEAN ← TRUE];
EnumerateChildren:
PROC [to: ChildNotifyProc, from: Parent ←
NIL, changedOnly:
BOOLEAN ←
FALSE, leaves, internals:
BOOLEAN ←
TRUE];
NIL Parent means to start from all roots.
END.