예제 #1
0
        /// <summary>
        /// Draws a cell created with this frame.
        /// </summary>
        /// <param name="drawContext">The context used to draw the cell.</param>
        /// <param name="cellView">The cell to draw.</param>
        /// <param name="origin">The location where to start drawing.</param>
        /// <param name="size">The drawing size, padding included.</param>
        /// <param name="padding">The padding to use when drawing.</param>
        public virtual void Draw(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding)
        {
            INode Node = cellView.StateView.State.Node;
            string Text = BaseNodeHelper.NodeTreeHelper.GetString(Node, PropertyName);

            Point OriginWithPadding = origin.Moved(padding.Left, padding.Top);
            drawContext.DrawNumber(Text, OriginWithPadding); // The caret is drawn separately.
        }
예제 #2
0
        /// <summary>
        /// Draws a cell created with this frame.
        /// </summary>
        /// <param name="drawContext">The context used to draw the cell.</param>
        /// <param name="cellView">The cell to draw.</param>
        /// <param name="origin">The location where to start drawing.</param>
        /// <param name="size">The drawing size, padding included.</param>
        /// <param name="padding">The padding to use when drawing.</param>
        public virtual void Draw(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding)
        {
            bool IsFocused = cellView.StateView.ControllerView.Focus.CellView == cellView;

            Point OriginWithPadding = origin.Moved(padding.Left, padding.Top);

            drawContext.DrawTextBackground(Text, OriginWithPadding, TextStyle);
            drawContext.DrawText(Text, OriginWithPadding, TextStyle, IsFocused);
        }
        /// <summary></summary>
        protected virtual void DrawSelection()
        {
            if (ControllerView.Selection is ILayoutNodeSelection AsNodeSelection && AsNodeSelection.StateView == this)
            {
                ILayoutDrawContext DrawContext = ControllerView.DrawContext;
                Debug.Assert(DrawContext != null);

                DrawContext.DrawSelectionRectangle(CellRect, SelectionStyles.Node);
            }
        }
예제 #4
0
        /// <summary>
        /// Draws a cell created with this frame.
        /// </summary>
        /// <param name="drawContext">The context used to draw the cell.</param>
        /// <param name="cellView">The cell to draw.</param>
        /// <param name="origin">The location where to start drawing.</param>
        /// <param name="size">The drawing size, padding included.</param>
        /// <param name="padding">The padding to use when drawing.</param>
        public virtual void Draw(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding)
        {
            ILayoutDiscreteContentFocusableCellView DiscreteContentFocusableCellView = cellView as ILayoutDiscreteContentFocusableCellView;

            Debug.Assert(DiscreteContentFocusableCellView != null);

            ILayoutKeywordFrame KeywordFrame = DiscreteContentFocusableCellView.KeywordFrame;

            Debug.Assert(KeywordFrame != null);

            KeywordFrame.Draw(drawContext, DiscreteContentFocusableCellView, origin, size, padding);
        }
        /// <summary>
        /// Draws a cell created with this frame.
        /// </summary>
        /// <param name="drawContext">The context used to draw the cell.</param>
        /// <param name="cellView">The cell to draw.</param>
        /// <param name="origin">The location where to start drawing.</param>
        /// <param name="size">The drawing size, padding included.</param>
        /// <param name="padding">The padding to use when drawing.</param>
        public virtual void Draw(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding)
        {
            INode  Node = cellView.StateView.State.Node;
            string Text = BaseNodeHelper.NodeTreeHelper.GetString(Node, PropertyName);

            Debug.Assert(!string.IsNullOrEmpty(Text));

            bool IsFocused = cellView.StateView.ControllerView.Focus.CellView == cellView;

            Point OriginWithPadding = origin.Moved(padding.Left, padding.Top);

            drawContext.DrawTextBackground(Text, OriginWithPadding, TextStyles.Character);
            drawContext.DrawText(Text, OriginWithPadding, TextStyles.Character, IsFocused);
        }
예제 #6
0
        /// <summary>
        /// Draws the cell.
        /// </summary>
        public virtual void Draw()
        {
            Debug.Assert(StateView != null);
            Debug.Assert(StateView.ControllerView != null);

            ILayoutDrawContext DrawContext = StateView.ControllerView.DrawContext;

            Debug.Assert(DrawContext != null);

            ILayoutDrawableFrame AsDrawableFrame = Frame as ILayoutDrawableFrame;

            Debug.Assert(AsDrawableFrame != null);

            Debug.Assert(RegionHelper.IsFixed(ActualCellSize));

            CollectionWithSeparator.DrawBeforeItem(DrawContext, ReferenceContainer, CellOrigin, ActualCellSize, CellPadding);
            AsDrawableFrame.Draw(DrawContext, this, CellOrigin, ActualCellSize, CellPadding);
            CollectionWithSeparator.DrawAfterItem(DrawContext, ReferenceContainer, CellOrigin, ActualCellSize, CellPadding);
        }
        /// <summary>
        /// Draws a cell created with this frame.
        /// </summary>
        /// <param name="drawContext">The context used to draw the cell.</param>
        /// <param name="cellView">The cell to draw.</param>
        /// <param name="origin">The location where to start drawing.</param>
        /// <param name="size">The drawing size, padding included.</param>
        /// <param name="padding">The padding to use when drawing.</param>
        public virtual void Draw(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding)
        {
            ILayoutCommentCellView CommentCellView = cellView as ILayoutCommentCellView;

            Debug.Assert(CommentCellView != null);
            string Text = CommentHelper.Get(CommentCellView.Documentation);

            CommentDisplayModes DisplayMode = cellView.StateView.ControllerView.CommentDisplayMode;

            Debug.Assert(DisplayMode == CommentDisplayModes.OnFocus || DisplayMode == CommentDisplayModes.All);

            bool IsFocused = cellView.StateView.ControllerView.Focus.CellView == cellView;

            if (IsFocused && Text == null)
            {
                Text = string.Empty;
            }

            if (Text != null)
            {
                if ((DisplayMode == CommentDisplayModes.OnFocus && IsFocused) || DisplayMode == CommentDisplayModes.All)
                {
                    Point OriginWithPadding = origin.Moved(padding.Left, padding.Top);
                    drawContext.DrawTextBackground(Text, OriginWithPadding, TextStyles.Comment);

                    LayoutControllerView ControllerView = cellView.StateView.ControllerView;
                    if (ControllerView.Selection is ILayoutCommentSelection AsCommentSelection && AsCommentSelection.StateView == cellView.StateView)
                    {
                        int Start = AsCommentSelection.Start;
                        int End   = AsCommentSelection.End;
                        Debug.Assert(Start <= End);

                        drawContext.DrawSelectionText(Text, OriginWithPadding, TextStyles.Comment, Start, End);
                    }

                    drawContext.DrawText(Text, OriginWithPadding, TextStyles.Comment, isFocused: false); // The caret is drawn separately.
                }
                else if (DisplayMode == CommentDisplayModes.OnFocus && cellView.StateView.ControllerView.ShowUnfocusedComments)
                {
                    drawContext.DrawCommentIcon(new Rect(cellView.CellOrigin, Size.Empty));
                }
            }
        }
예제 #8
0
        /// <summary>
        /// Draws a cell created with this frame.
        /// </summary>
        /// <param name="drawContext">The context used to draw the cell.</param>
        /// <param name="cellView">The cell to draw.</param>
        /// <param name="origin">The location where to start drawing.</param>
        /// <param name="size">The drawing size, padding included.</param>
        /// <param name="padding">The padding to use when drawing.</param>
        public virtual void Draw(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding)
        {
            Node   Node = cellView.StateView.State.Node;
            string Text = BaseNodeHelper.NodeTreeHelper.GetString(Node, PropertyName);

            Point OriginWithPadding = origin.Moved(padding.Left, padding.Top);

            drawContext.DrawTextBackground(Text, OriginWithPadding, TextStyle);

            LayoutControllerView ControllerView = cellView.StateView.ControllerView;

            if (ControllerView.Selection is ILayoutStringContentSelection AsStringContentSelection && AsStringContentSelection.StateView == cellView.StateView)
            {
                int Start = AsStringContentSelection.Start;
                int End   = AsStringContentSelection.End;
                Debug.Assert(Start <= End);

                drawContext.DrawSelectionText(Text, OriginWithPadding, TextStyle, Start, End);
            }

            drawContext.DrawText(Text, OriginWithPadding, TextStyle, isFocused: false); // The caret is drawn separately.
        }
예제 #9
0
 public void Draw(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding)
 {
 }
 /// <summary>
 /// Draws container or separator after an element of a collection.
 /// </summary>
 /// <param name="drawContext">The context used to draw the cell.</param>
 /// <param name="cellView">The cell to draw.</param>
 /// <param name="origin">The location where to start drawing.</param>
 /// <param name="size">The drawing size, padding included.</param>
 /// <param name="padding">The padding to use when drawing.</param>
 public abstract void DrawAfterItem(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding);
예제 #11
0
        /// <summary>
        /// Draws a cell created with this frame.
        /// </summary>
        /// <param name="drawContext">The context used to draw the cell.</param>
        /// <param name="cellView">The cell to draw.</param>
        /// <param name="origin">The location where to start drawing.</param>
        /// <param name="size">The drawing size, padding included.</param>
        /// <param name="padding">The padding to use when drawing.</param>
        public virtual void Draw(ILayoutDrawContext drawContext, ILayoutCellView cellView, Point origin, Size size, Padding padding)
        {
            bool IsFocused = cellView.StateView.ControllerView.Focus.CellView == cellView;

            drawContext.DrawSymbol(Symbols.InsertSign, origin, size, padding, IsFocused);
        }