/// <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>
        /// 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);
        }
        /// <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));
                }
            }
        }
Beispiel #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)
        {
            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.
        }