Пример #1
0
        internal void Seal(Template template, GridRange gridRange, int ordinal)
        {
            Debug.Assert(template != null && Template == null);

            VerifyNotSealed();
            Template  = template;
            GridRange = gridRange;
            Ordinal   = ordinal;
        }
Пример #2
0
 /// <summary>
 /// Determines whether this <see cref="GridRange"/> contains other <see cref="GridRange"/>.
 /// </summary>
 /// <param name="gridRange">The other <see cref="GridRange"/>.</param>
 /// <returns><see langword="true"/> if this <see cref="GridRange"/> contains other <see cref="GridRange"/>, otherwise <see langword="false"/>.</returns>
 public bool Contains(GridRange gridRange)
 {
     if (IsEmpty || Template != gridRange.Template)
     {
         return(false);
     }
     return(Left.Ordinal <= gridRange.Left.Ordinal && Right.Ordinal >= gridRange.Right.Ordinal &&
            Top.Ordinal <= gridRange.Top.Ordinal && Bottom.Ordinal >= gridRange.Bottom.Ordinal);
 }
Пример #3
0
        internal Point GetRelativePosition(GridRange innerGridRange)
        {
            Debug.Assert(Contains(innerGridRange));

            var originPosition = MeasuredPosition;
            var position       = innerGridRange.MeasuredPosition;

            return(new Point(position.X - originPosition.X, position.Y - originPosition.Y));
        }
Пример #4
0
        private GridRange CalcRowRange()
        {
            var result = new GridRange();

            foreach (var rowBinding in InternalRowBindings)
            {
                result = result.Union(rowBinding.GridRange);
            }
            return(result);
        }
Пример #5
0
 internal void AddBinding(GridRange gridRange, ScalarBinding scalarBinding)
 {
     Debug.Assert(IsValid(gridRange));
     scalarBinding.Seal(this, gridRange, InternalScalarBindings.Count);
     InternalScalarBindings.Add(gridRange, scalarBinding);
     if (!HasRowBinding)
     {
         ScalarBindingsSplit = InternalScalarBindings.Count;
     }
 }
Пример #6
0
 internal void AddBinding(GridRange gridRange, BlockBinding blockBinding)
 {
     Debug.Assert(IsValid(gridRange));
     blockBinding.Seal(this, gridRange, InternalBlockBindings.Count);
     InternalBlockBindings.Add(gridRange, blockBinding);
     if (!HasRowBinding)
     {
         BlockBindingsSplit = InternalBlockBindings.Count;
     }
 }
Пример #7
0
        /// <summary>
        /// Determines whether this <see cref="GridRange"/> intersects other <see cref="GridRange"/>.
        /// </summary>
        /// <param name="gridRange">The other <see cref="GridRange"/>.</param>
        /// <returns><see langword="true"/> if this <see cref="GridRange"/> intersects other <see cref="GridRange"/>, otherwise <see langword="false"/>.</returns>
        public bool IntersectsWith(GridRange gridRange)
        {
            if (IsEmpty || Template != gridRange.Template)
            {
                return(false);
            }

            return(gridRange.Left.Ordinal <= this.Right.Ordinal &&
                   gridRange.Right.Ordinal >= this.Left.Ordinal &&
                   gridRange.Top.Ordinal <= this.Bottom.Ordinal &&
                   gridRange.Bottom.Ordinal >= this.Top.Ordinal);
        }
Пример #8
0
 internal virtual void VerifyFrozenMargins(string bindingsName)
 {
     if (GridRange.HorizontallyIntersectsWith(Template.FrozenLeft))
     {
         throw new InvalidOperationException(DiagnosticMessages.Binding_InvalidFrozenMargin(nameof(Template.FrozenLeft), bindingsName, Ordinal));
     }
     if (GridRange.VerticallyIntersectsWith(Template.FrozenTop))
     {
         throw new InvalidOperationException(DiagnosticMessages.Binding_InvalidFrozenMargin(nameof(Template.FrozenTop), bindingsName, Ordinal));
     }
     if (GridRange.HorizontallyIntersectsWith(Template.GridColumns.Count - Template.FrozenRight))
     {
         throw new InvalidOperationException(DiagnosticMessages.Binding_InvalidFrozenMargin(nameof(Template.FrozenRight), bindingsName, Ordinal));
     }
     if (GridRange.VerticallyIntersectsWith(Template.GridRows.Count - Template.FrozenBottom))
     {
         throw new InvalidOperationException(DiagnosticMessages.Binding_InvalidFrozenMargin(nameof(Template.FrozenBottom), bindingsName, Ordinal));
     }
 }
Пример #9
0
        /// <summary>
        /// Creates a new range defined as the union of this and the specified range.
        /// </summary>
        /// <param name="gridRange">The specified range.</param>
        /// <returns>The new range.</returns>
        public GridRange Union(GridRange gridRange)
        {
            if (gridRange.IsEmpty)
            {
                return(this);
            }

            if (this.IsEmpty)
            {
                return(gridRange);
            }

            if (Template != gridRange.Template)
            {
                throw new ArgumentException(DiagnosticMessages.GridRange_InvalidOwner, nameof(gridRange));
            }

            return(new GridRange(
                       Left.Ordinal <gridRange.Left.Ordinal?Left : gridRange.Left,
                                     Top.Ordinal <gridRange.Top.Ordinal?Top : gridRange.Top,
                                                  Right.Ordinal> gridRange.Right.Ordinal?Right : gridRange.Right,
                                     Bottom.Ordinal> gridRange.Bottom.Ordinal ? Bottom : gridRange.Bottom));
        }
Пример #10
0
 protected override GridSpan <GridColumn> GetGridSpan(GridRange gridRange)
 {
     return(gridRange.ColumnSpan);
 }
Пример #11
0
 internal bool IsValid(GridRange gridRange)
 {
     return(!gridRange.IsEmpty && Range().Contains(gridRange));
 }
        private double GetEndPositionCross(GridRange gridRange, int flowIndex)
        {
            var gridTrack = GridTracksCross.GetGridSpan(gridRange).EndTrack;

            return(new LogicalCrossTrack(gridTrack, flowIndex).EndPosition);
        }
Пример #13
0
        GridSpan IGridTrackCollection.GetGridSpan(GridRange gridRange)
        {
            var result = GetGridSpan(gridRange);

            return(new GridSpan(result.StartTrack, result.EndTrack));
        }
Пример #14
0
 internal void AddBinding(GridRange gridRange, RowBinding rowBinding)
 {
     Debug.Assert(IsValid(gridRange));
     rowBinding.Seal(this, gridRange, InternalRowBindings.Count);
     InternalRowBindings.Add(gridRange, rowBinding);
 }
Пример #15
0
 public IConcatList <T> Filter(GridRange gridRange, Func <T, bool> predict, Action <T> action = null)
 {
     return(Filter(GetGridSpan(gridRange), predict, action));
 }
Пример #16
0
 internal void Add(GridRange gridRange, T item)
 {
     Debug.Assert(item != null);
     Items.Add(item);
     Range = Range.Union(gridRange);
 }
Пример #17
0
 internal abstract void VerifyRowRange(GridRange rowRange);
Пример #18
0
 protected abstract GridSpan <T> GetGridSpan(GridRange gridRange);
Пример #19
0
 protected override GridSpan <GridRow> GetGridSpan(GridRange gridRange)
 {
     return(gridRange.RowSpan);
 }
        private LogicalMainTrack GetEndLogicalMainTrack(GridRange gridRange)
        {
            var gridTrack = GridTracksMain.GetGridSpan(gridRange).EndTrack;

            return(GetEndLogicalMainTrack(gridTrack));
        }
Пример #21
0
 public double GetMeasuredLength(GridRange gridRange)
 {
     return(GetMeasuredLength(GetGridSpan(gridRange)));
 }