Copyright (C) 1994, Digital Equipment Corp. MODULE; IMPORT DisplayList, DPS, DPSWindow, Linked2Tree, Err; PROCEDURE VContainerDLE Repaint (e: E; box: DPS.Box; only: REFANY := NIL): TEXT = BEGIN TYPECASE only OF NULL => RETURN DisplayList.Repaint (e, box, NIL); (* Paint my children. *) | E(ee)=> IF ee = e THEN RETURN DisplayList.Repaint (e, box, NIL); ELSE Err.Msg ("ee # e in VContainerDLE.Repaint"); RETURN ee.Repaint (box, only); END; ELSE RETURN NIL; END; END Repaint; PROCEDUREInit (e: E; <*UNUSED*> window: DPSWindow.T) = BEGIN IF e.initialized THEN RETURN; END; Rearrange (e); e.initialized := TRUE; END Init; PROCEDUREMouse (e: E; window: DPSWindow.T; event: DPS.MouseEvent): BOOLEAN = BEGIN Init(e, window); RETURN DisplayList.Mouse (e, window, event); END Mouse; PROCEDUREChar (t: T; window: DPSWindow.T; char: CHAR): BOOLEAN = VAR e: DisplayList.T; BEGIN e := t.childWithInputFocus; IF e # NIL THEN RETURN e.Char (window, char);END; RETURN FALSE; END Char; PROCEDUREPrepend (t: Linked2Tree.T; e: Linked2Tree.E) = BEGIN Linked2Tree.Prepend (t, e); Rearrange (t); END Prepend; PROCEDUREAppend (t: Linked2Tree.T; e: Linked2Tree.E) = BEGIN Linked2Tree.Append (t, e); Rearrange (t); END Append; PROCEDURERemove (e: Linked2Tree.E) = VAR me: T; BEGIN me := e.parent; Linked2Tree.Remove (e); Rearrange (me); END Remove; PROCEDUREMakeChildLast (t: Linked2Tree.T; <*UNUSED*> e: Linked2Tree.E): Linked2Tree.E = BEGIN (* Since our children are not overlapped, we can leave their order alone. *) (* Important, as we use the order as our bottom-to-top ordering. *) RETURN t.MoveToLast(); END MakeChildLast; PROCEDURERearrange (me: T) = VAR ee: DisplayList.E; VAR y, h, w, maxW: REAL; BEGIN maxW := 0.0; y := me.box.low.y; ee := me.First(); (* Forward, so up in Display PostScript. *) IF ee = NIL THEN me.box.high.y := y; RETURN; END; WHILE ee # NIL DO w := ee.box.high.x - ee.box.low.x; h := ee.box.high.y - ee.box.low.y; maxW := MAX (maxW, w); ee.box.low.x := me.box.low.x; ee.box.high.x := ee.box.low.x + w; ee.box.low.y := y; ee.box.high.y := y + h; y := y + h + me.separation; ee := ee.Next(); END; me.box.high.y := y - me.separation; me.box.high.x := me.box.low.x + maxW; END Rearrange; BEGIN END VContainerDLE.