DIRECTORY Icons, Menus, ViewerClasses, ViewerConstraints; Constrainers: CEDAR DEFINITIONS ~ BEGIN Viewer: TYPE = ViewerClasses.Viewer; Constraint: TYPE ~ ViewerConstraints.Constraint; Constrainer: TYPE ~ Viewer; ConstrainerClass: TYPE = REF ConstrainerClassRep; ConstrainerClassRep: 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: ConstrainerClassRep] RETURNS [same: ATOM]; GetClass: PROC [viewerFlavor: ATOM] RETURNS [class: ConstrainerClass]; vanilla: ATOM; SeriesElement: TYPE ~ RECORD [viewer: Viewer, spaceBefore: INTEGER _ 0, keepSizeFixed: BOOL _ TRUE]; 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 ]; EdgeType: TYPE ~ ViewerConstraints.EdgeType; Rules: TYPE ~ ARRAY EdgeType OF Series; Create: PROC [viewerFlavor: ATOM, info: ViewerClasses.ViewerRec _ [], paint: BOOL _ TRUE] RETURNS [c: Constrainer]; ViewerIsConstrainer: PROC [Viewer] RETURNS [BOOL]; GetClientData: PROC [Constrainer] RETURNS [REF ANY]; ScrollOffset: PROC [Constrainer] RETURNS [offTop: INTEGER]; HScrollOffset: PROC [Constrainer] RETURNS [offLeft: INTEGER]; SetLayout: PROC [c: Constrainer, rules: Rules, paint, eliminateOldConstraints: BOOL _ TRUE]; Abut: PROC [c: Constrainer, child1, child2: Viewer, edge: EdgeType, 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. KeepSquare: PROC [v: Viewer, adjustEdge: EdgeType] RETURNS [c: Constraint]; Center: PROC [parent, child: Viewer, margin: INTEGER _ 0, horz: BOOL _ TRUE]; Wrap: PROC [parent: Viewer, children: LIST OF Viewer, margin: INTEGER _ 0]; END. fConstrainers.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Eric Nickell, October 17, 1986 2:01:03 pm PDT Constrainer Classes Returns NIL if no such class. Constrainers (Abutter facsimiles) The flavor of a standard, bland, common, ordinary, garden-variety ConstrainerClass. It differs from [] only in having a non-NIL save, which enumerates the children (but not grandchildren), calling their save's, if any. Put client data in info.data; it won't stay there. Returns the amount of the constrainer scrolled off the top. Returns the amount of the constrainer scrolled off the left. Constrainers (Additional capabilities) Keeps v square by adjusting the specified edge. Centers child in the parent The children are placed left to right inside parent, but wrap to the next ``line'' when they would exceed the right edge of the parent. For best results, the height of all the children should be the same. No constraint is placed on the first child. It should therefore be positioned correctly. The other children are fully constrained, and should thus not have any other constraint placed on them. Κe˜™Icodešœ Οmœ1™