public SizedLeftRight(SizedDocument left, SizedDocument right)
        {
            this.left = left; this.right = right;
            this.size = new IntVector2(left.Size.X + right.Size.X,Math.Max(left.Size.Y,right.Size.Y));

            int diff = left.Size.Y - right.Size.Y;
            if (diff > 0)
                this.right = new WhiteSpace(right.Size.X, diff) ^ right;
            else if (diff < 0)
                this.left = left ^ new WhiteSpace(left.Size.X, -diff);
        }
        public SizedTopBottom(SizedDocument top, SizedDocument bottom)
        {
            this.top = top;
            this.bottom = bottom;
            size = new IntVector2(Math.Max(top.Size.X, bottom.Size.X), bottom.Size.Y + top.Size.Y);

            var diff = top.Size.X - bottom.Size.X;
            if (diff > 0)
                this.bottom = bottom + new WhiteSpace(new IntVector2(diff, bottom.Size.Y));
            else if (diff < 0)
                this.top = top + new WhiteSpace(new IntVector2(-diff, top.Size.Y));
        }
            public SizedDocument GetSized(int preferredWidth)
            {
                var mbWrapValue = FindWrapValue(preferredWidth);
                if (mbWrapValue.HasValue)
                    return cache[mbWrapValue.Value];

                var result = document.GetSizedDocument(preferredWidth, (d, w) => sizer.GetSized(d, w.Value));
                var resultWidth = result.Size.X;

                cache[resultWidth] = result;
                sizeWithPreferredWidthRange.Get(resultWidth).Exec(
                    () => sizeWithPreferredWidthRange[resultWidth] = new IntVector2(Math.Min(resultWidth, preferredWidth), Math.Max(resultWidth, preferredWidth)),
                    range => sizeWithPreferredWidthRange[resultWidth] = new IntVector2(Math.Min(range.X, preferredWidth), Math.Max(range.Y, preferredWidth)));
                return result;
            }
 public IntVector2(IntVector2 clone)
     : this(clone.X,clone.Y)
 {
 }
 public bool Equals(IntVector2 other)
 {
     return other.X == X && other.Y == Y;
 }
 public WhiteSpace(IntVector2 size)
 {
     this.size = size;
 }