Beispiel #1
0
        public void RenderToRegion(
            Span span,
            Region region)
        {
            SpanVisitor visitor;

            if (span == null)
            {
                span = Span.Empty();
            }
            else if (_resetAfterRender)
            {
                span = new ContainerSpan(
                    span,
                    ForegroundColorSpan.Reset(),
                    BackgroundColorSpan.Reset());
            }

            switch (Mode)
            {
            case OutputMode.NonAnsi:
                visitor = new NonAnsiRenderingSpanVisitor(
                    _terminal,
                    region);
                break;

            case OutputMode.Ansi:
                visitor = new AnsiRenderingSpanVisitor(
                    _console,
                    region);
                break;

            case OutputMode.File:
                visitor = new FileRenderingSpanVisitor(
                    _console.Out,
                    new Region(region.Left,
                               region.Top,
                               region.Width,
                               region.Height,
                               false));
                break;

            default:
                throw new NotSupportedException();
            }

            visitor.Visit(span);
        }
Beispiel #2
0
 internal virtual void RecalculatePositions(ContainerSpan parent, int start)
 {
     Parent = parent;
     _root  = parent.Root;
     Start  = start;
 }
Beispiel #3
0
        internal override void RecalculatePositions(ContainerSpan parent, int start)
        {
            base.RecalculatePositions(parent, start);

            RecalculateChildPositions();
        }