Abutters:
CEDAR
DEFINITIONS = {
Viewer: TYPE = ViewerClasses.Viewer;
AbutterClass: TYPE = REF AbutterClassPrivate;
AbutterClassPrivate:
TYPE =
RECORD [
destroy: ViewerClasses.DestroyProc ← NIL,
copy: ViewerClasses.CopyProc ← NIL,
set: ViewerClasses.SetProc ← NIL,
get: ViewerClasses.GetProc ← NIL,
init: ViewerClasses.InitProc ← NIL,
save: ViewerClasses.SaveProc ← NIL,
caption: ViewerClasses.CaptionProc ← NIL,
menu: Menus.Menu ← NIL,
icon: Icons.IconFlavor ← document
];
RegisterClass: PROC [viewerFlavor: ATOM, class: AbutterClassPrivate] RETURNS [same: ATOM];
GetClass:
PROC [viewerFlavor:
ATOM]
RETURNS [class: AbutterClass];
Returns NIL if no such class.
vanilla:
ATOM;
The flavor of a standard, bland, common, ordinary, garden-variety AbuuterClass. It differs from [] only in having a non-NIL save, which enumerates the children (but not grandchildren), calling their save's, if any.
Abutter:
TYPE =
REF AbutterRep;
Like a Container, only able to do more comprehensive alignment of children.
CoordSys = top.
AbutterRep: TYPE;
Create:
PROC [viewerFlavor:
ATOM, info: ViewerClasses.ViewerRec ← [], paint:
BOOL ←
TRUE]
RETURNS [abutter: Abutter];
Put client data in info.data; it won't stay there.
QuaViewer: PROC [Abutter] RETURNS [Viewer];
QuaAbutter: PROC [Viewer] RETURNS [Abutter];
ViewerIsAbutter: PROC [Viewer] RETURNS [BOOL];
IsAbutter: PROC [REF ANY] RETURNS [BOOL];
Narrow: PROC [REF ANY] RETURNS [Abutter];
GetClientData: PROC [Abutter] RETURNS [REF ANY];
GetClientDataFromViewer: PROC [Viewer--which is an Abutter--] RETURNS [REF ANY];
ScrollOffset:
PROC [Abutter]
RETURNS [offTop:
INTEGER];
Returns the amount of the abutter scrolled off the top.
Edge: TYPE = {left, right, top, bottom};
SeriesElement: TYPE = RECORD [viewer: Viewer, spaceBefore: INTEGER ← 0];
Parallel: TYPE = LIST OF Series;
Series:
TYPE =
RECORD [
rigid: LIST OF SeriesElement,
end:
SELECT kind: *
FROM
none => [spaceAfter: INTEGER ← 0, setParentSize: BOOL ← FALSE],
parallel => [p: Parallel],
stretch => [se: SeriesElement],
ENDCASE
];
Rules: TYPE = ARRAY Edge OF Series;
SetLayout: PROC [a: Abutter, rules: Rules, paint: BOOL ← TRUE];
Abut:
PROC [a: Abutter, child1, child2: Viewer, edge: Edge, space:
INTEGER ← 0, stretch:
BOOL ←
FALSE, paint:
BOOL ←
TRUE];
parentSide: Viewer; --pass this as child1 to abut against a side of the parent, rather than another Viewer.
SetSizeBy:
PROC [a: Abutter, child: Viewer, edge: Edge, space:
INTEGER ← 0, paint:
BOOL ←
TRUE];
When child=parentSide, this simply sets a dimension to be space.
}.