ui/src/split/RootVBT.m3


Copyright (C) 1994, Digital Equipment Corp.
 by Steve Glassman, Mark Manasse and Greg Nelson           
<*PRAGMA LL*>

MODULE RootVBT;

IMPORT VBT, Split, Filter, HighlightVBT, VBTClass, Palette, VBTRep;

TYPE
  GrandChild = HighlightVBT.T OBJECT
    proc: DeleteProc
  METHODS
    rescreen := Rescreen;
    misc := Misc;
  END;

REVEAL Child = ETAgent.T BRANDED OBJECT END;

PROCEDURE NewChild(ch: VBT.T; p: DeleteProc): Child =
  VAR grandChild := NEW(GrandChild, proc := p); res := NEW(Child); BEGIN
    EVAL HighlightVBT.T.init(grandChild, ch);
    EVAL ETAgent.T.init(res, grandChild);
    LOCK res DO
      res.props := res.props + VBTRep.Props{VBTRep.Prop.Combiner}
    END;
    RETURN res
  END NewChild;

PROCEDURE Rescreen(v: Child; READONLY cd: VBT.RescreenRec) =
  BEGIN
    Palette.Init(cd.st);
    HighlightVBT.T.rescreen(v, cd)
  END Rescreen;

PROCEDURE Misc(v: GrandChild; READONLY cd: VBT.MiscRec) =
  VAR ch := v.ch; button: VBT.Button := LAST(VBT.Button);
  CONST gone = VBT.CursorPosition{Point.Origin, NoScreen, TRUE, TRUE};
  BEGIN
    IF ch = NIL THEN RETURN END;
    IF cd.type = VBT.Deleted OR cd.type = VBT.Disconnected THEN
      VBTClass.Position(v, VBT.PositionRec{gone, 0, VBT.Modifiers{}});
      VBTClass.Mouse(v,
        VBT.MouseRec{button, 0, gone, VBT.Modifiers{},
          VBT.ClickType.LastUp, 0});
      IF v.proc # NIL THEN v.proc(ch) END;
      EVAL Filter.Replace(v, NIL)
    END;
    VBTClass.Misc(ch, cd);
  END Misc;

END RootVBT.