Example #1
0
        /// <summary>
        /// Create cells for the provided state view.
        /// </summary>
        /// <param name="context">Context used to build the cell view tree.</param>
        /// <param name="parentCellView">The parent cell view.</param>
        public virtual IFrameCellView BuildNodeCells(IFrameCellViewTreeContext context, IFrameCellViewCollection parentCellView)
        {
            IDocument Documentation = context.StateView.State.Node.Documentation;
            string    Text          = CommentHelper.Get(Documentation);

            if (IsDisplayed(context, Text))
            {
                IFrameVisibleCellView CellView = CreateCommentCellView(context.StateView, parentCellView, context.StateView.State.Node.Documentation);
                ValidateVisibleCellView(context, CellView);

                if (context.StateView.State is IFrameOptionalNodeState AsOptionalNodeState)
                {
                    Debug.Assert(AsOptionalNodeState.ParentInner.IsAssigned);
                }

                return(CellView);
            }
            else
            {
                IFrameEmptyCellView CellView = CreateEmptyCellView(context.StateView, parentCellView);
                ValidateEmptyCellView(context, CellView);

                return(CellView);
            }
        }
Example #2
0
        /// <summary>
        /// Create cells for the provided state view.
        /// </summary>
        /// <param name="context">Context used to build the cell view tree.</param>
        /// <param name="parentCellView">The parent cell view.</param>
        public override IFrameCellView BuildNodeCells(IFrameCellViewTreeContext context, IFrameCellViewCollection parentCellView)
        {
            IFrameVisibleCellView EmbeddingCellView = CreateVisibleCellView(context.StateView, parentCellView);

            ValidateVisibleCellView(context, EmbeddingCellView);

            return(EmbeddingCellView);
        }
Example #3
0
        /// <summary>
        /// Create cells for the provided state view.
        /// </summary>
        /// <param name="context">Context used to build the cell view tree.</param>
        /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param>
        public virtual IFrameCellView BuildBlockCells(IFrameCellViewTreeContext context, IFrameCellViewCollection parentCellView)
        {
            IFrameVisibleCellView CellView = CreateVisibleCellView(context.StateView, parentCellView);

            ValidateVisibleCellView(context, CellView);

            return(CellView);
        }
Example #4
0
        /// <summary>
        /// Create cells for the provided state view.
        /// </summary>
        /// <param name="context">Context used to build the cell view tree.</param>
        /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param>
        public virtual IFrameCellView BuildBlockCells(IFrameCellViewTreeContext context, IFrameCellViewCollection parentCellView)
        {
            IDocument Documentation = context.BlockStateView.BlockState.ChildBlock.Documentation;
            string    Text          = CommentHelper.Get(Documentation);

            if (IsDisplayed(context, Text))
            {
                IFrameVisibleCellView CellView = CreateCommentCellView(context.StateView, parentCellView, Documentation);
                ValidateVisibleCellView(context, CellView);

                return(CellView);
            }
            else
            {
                IFrameEmptyCellView CellView = CreateEmptyCellView(context.StateView, parentCellView);
                ValidateEmptyCellView(context, CellView);

                return(CellView);
            }
        }
        private protected virtual bool DisplayCellViewLineNumber(IFrameVisibleCellView cellView, Action <string, Point> handler, bool[] drawnLines, int maxLength)
        {
            int LineNumber = cellView.LineNumber;

            Debug.Assert(LineNumber < drawnLines.Length);

            if (!drawnLines[LineNumber])
            {
                drawnLines[LineNumber] = true;

                Point  LineOrigin = new Point(Measure.Zero, ((ILayoutVisibleCellView)cellView).CellOrigin.Y);
                string LineText   = LineNumber.ToString();
                while (LineText.Length < maxLength)
                {
                    LineText = " " + LineText;
                }

                handler(LineText, LineOrigin);
            }

            return(false);
        }
Example #6
0
 bool ICollection <IFrameVisibleCellView> .Remove(IFrameVisibleCellView item)
 {
     return(Remove((IFocusVisibleCellView)item));
 }
Example #7
0
 bool ICollection <IFrameVisibleCellView> .Contains(IFrameVisibleCellView value)
 {
     return(Contains((IFocusVisibleCellView)value));
 }
Example #8
0
 void ICollection <IFrameVisibleCellView> .Add(IFrameVisibleCellView item)
 {
     Add((IFocusVisibleCellView)item);
 }
 /// <summary>
 /// Enumerate all visible cell views. Enumeration is interrupted if <paramref name="handler"/> returns true.
 /// </summary>
 /// <param name="handler">A handler to execute for each cell view.</param>
 /// <param name="cellView">The cell view for which <paramref name="handler"/> returned true. Null if none.</param>
 /// <param name="reversed">If true, search in reverse order.</param>
 /// <returns>The last value returned by <paramref name="handler"/>.</returns>
 public override bool EnumerateVisibleCellViews(Func <IFrameVisibleCellView, bool> handler, out IFrameVisibleCellView cellView, bool reversed)
 {
     if (handler(this))
     {
         cellView = this;
         return(true);
     }
     else
     {
         cellView = null;
         return(false);
     }
 }
Example #10
0
        /// <summary>
        /// Enumerate all visible cell views. Enumeration is interrupted if <paramref name="handler"/> returns true.
        /// </summary>
        /// <param name="handler">A handler to execute for each cell view.</param>
        /// <param name="cellView">The cell view for which <paramref name="handler"/> returned true. Null if none.</param>
        /// <param name="reversed">If true, search in reverse order.</param>
        /// <returns>The last value returned by <paramref name="handler"/>.</returns>
        public virtual bool EnumerateVisibleCellViews(Func <IFrameVisibleCellView, bool> handler, out IFrameVisibleCellView cellView, bool reversed)
        {
            Debug.Assert(handler != null);

            Debug.Assert(RootCellView != null);
            return(RootCellView.EnumerateVisibleCellViews(handler, out cellView, reversed));
        }
Example #11
0
 private protected virtual void ValidateVisibleCellView(IFrameCellViewTreeContext context, IFrameVisibleCellView cellView)
 {
     Debug.Assert(cellView.StateView == context.StateView);
     Debug.Assert(cellView.Frame == this);
     IFrameCellViewCollection ParentCellView = cellView.ParentCellView;
 }
        /// <summary>
        /// Enumerate all visible cell views. Enumeration is interrupted if <paramref name="handler"/> returns true.
        /// </summary>
        /// <param name="handler">A handler to execute for each cell view.</param>
        /// <param name="cellView">The cell view for which <paramref name="handler"/> returned true. Null if none.</param>
        /// <param name="reversed">If true, search in reverse order.</param>
        /// <returns>The last value returned by <paramref name="handler"/>.</returns>
        public virtual bool EnumerateVisibleCellViews(System.Func <IFrameVisibleCellView, bool> handler, out IFrameVisibleCellView cellView, bool reversed)
        {
            Contract.RequireNotNull(handler, out System.Func <IFrameVisibleCellView, bool> Handler);

            Debug.Assert(RootCellView != null);
            return(RootCellView.EnumerateVisibleCellViews(Handler, out cellView, reversed));
        }
        /// <summary>
        /// Enumerate all visible cell views. Enumeration is interrupted if <paramref name="handler"/> returns true.
        /// </summary>
        /// <param name="handler">A handler to execute for each cell view.</param>
        /// <param name="cellView">The cell view for which <paramref name="handler"/> returned true. Null if none.</param>
        /// <param name="reversed">If true, search in reverse order.</param>
        /// <returns>The last value returned by <paramref name="handler"/>.</returns>
        public override bool EnumerateVisibleCellViews(Func <IFrameVisibleCellView, bool> handler, out IFrameVisibleCellView cellView, bool reversed)
        {
            Debug.Assert(handler != null);

            for (int i = 0; i < CellViewList.Count; i++)
            {
                IFrameCellView Item = CellViewList[reversed ? CellViewList.Count - 1 - i : i];

                if (Item.EnumerateVisibleCellViews(handler, out cellView, reversed))
                {
                    return(true);
                }
            }

            cellView = null;
            return(false);
        }
Example #14
0
 private protected virtual bool GetLastFocusable(IFrameVisibleCellView cellView)
 {
     return(cellView is IFocusFocusableCellView);
 }
Example #15
0
        /// <summary>
        /// Enumerate all visible cell views. Enumeration is interrupted if <paramref name="handler"/> returns true.
        /// </summary>
        /// <param name="handler">A handler to execute for each cell view.</param>
        /// <param name="cellView">The cell view for which <paramref name="handler"/> returned true. Null if none.</param>
        /// <param name="reversed">If true, search in reverse order.</param>
        /// <returns>The last value returned by <paramref name="handler"/>.</returns>
        public override bool EnumerateVisibleCellViews(Func <IFrameVisibleCellView, bool> handler, out IFrameVisibleCellView cellView, bool reversed)
        {
            Debug.Assert(handler != null);

            return(ChildStateView.EnumerateVisibleCellViews(handler, out cellView, reversed));
        }
 /// <summary>
 /// Enumerate all visible cell views. Enumeration is interrupted if <paramref name="handler"/> returns true.
 /// </summary>
 /// <param name="handler">A handler to execute for each cell view.</param>
 /// <param name="cellView">The cell view for which <paramref name="handler"/> returned true. Null if none.</param>
 /// <param name="reversed">If true, search in reverse order.</param>
 /// <returns>The last value returned by <paramref name="handler"/>.</returns>
 public override bool EnumerateVisibleCellViews(Func <IFrameVisibleCellView, bool> handler, out IFrameVisibleCellView cellView, bool reversed)
 {
     cellView = null;
     return(false);
 }
Example #17
0
 int IList <IFrameVisibleCellView> .IndexOf(IFrameVisibleCellView value)
 {
     return(IndexOf((IFocusVisibleCellView)value));
 }
 private protected override void ValidateVisibleCellView(IFrameCellViewTreeContext context, IFrameVisibleCellView cellView)
 {
     Debug.Assert(((IFocusVisibleCellView)cellView).StateView == ((IFocusCellViewTreeContext)context).StateView);
     Debug.Assert(((IFocusVisibleCellView)cellView).Frame == this);
     IFocusCellViewCollection ParentCellView = ((IFocusVisibleCellView)cellView).ParentCellView;
 }
Example #19
0
 void IList <IFrameVisibleCellView> .Insert(int index, IFrameVisibleCellView item)
 {
     Insert(index, (IFocusVisibleCellView)item);
 }
Example #20
0
 /// <summary>
 /// Enumerate all visible cell views. Enumeration is interrupted if <paramref name="handler"/> returns true.
 /// </summary>
 /// <param name="handler">A handler to execute for each cell view.</param>
 /// <param name="cellView">The cell view for which <paramref name="handler"/> returned true. Null if none.</param>
 /// <param name="reversed">If true, search in reverse order.</param>
 /// <returns>The last value returned by <paramref name="handler"/>.</returns>
 public abstract bool EnumerateVisibleCellViews(Func <IFrameVisibleCellView, bool> handler, out IFrameVisibleCellView cellView, bool reversed);
Example #21
0
 /// <summary>
 /// Enumerate all visible cell views. Enumeration is interrupted if <paramref name="handler"/> returns true.
 /// </summary>
 /// <param name="handler">A handler to execute for each cell view.</param>
 /// <param name="cellView">The cell view for which <paramref name="handler"/> returned true. Null if none.</param>
 /// <param name="reversed">If true, search in reverse order.</param>
 /// <returns>The last value returned by <paramref name="handler"/>.</returns>
 public override bool EnumerateVisibleCellViews(Func <IFrameVisibleCellView, bool> handler, out IFrameVisibleCellView cellView, bool reversed)
 {
     return(BlockStateView.EnumerateVisibleCellViews(handler, out cellView, reversed));
 }