PageRenderTime 20ms CodeModel.GetById 17ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/NUnit/UiException/Controls/ICodeRenderer.cs

#
C# | 48 lines | 14 code | 4 blank | 30 comment | 0 complexity | 4ea0ff282aa1ffb0f8e265b80d7ea4db MD5 | raw file
 1// ****************************************************************
 2// This is free software licensed under the NUnit license. You may
 3// obtain a copy of the license at http://nunit.org
 4// ****************************************************************
 5
 6using System;
 7using System.Collections.Generic;
 8using System.Text;
 9using NUnit.UiException.CodeFormatters;
10using System.Drawing;
11
12namespace NUnit.UiException.Controls
13{   
14    /// <summary>
15    /// The interface through which CodeBox interacts with a display to display itself.
16    /// 
17    /// Direct implementation is:
18    ///     - DefaultCodeRenderer
19    /// </summary>
20    public interface ICodeRenderer
21    {
22        /// <summary>
23        /// Draw the given code to be displayed in the actual viewport.
24        /// </summary>
25        /// <param name="code">The code to draw</param>
26        /// <param name="args">Encapsulate graphic information about how to display the code</param>
27        /// <param name="viewport">The portion of interest</param>
28        void DrawToGraphics(FormattedCode code, CodeRenderingContext args, Rectangle viewport);
29
30        /// <summary>
31        /// Measures the code size in pixels.
32        /// </summary>
33        /// <param name="code">The code to measure</param>
34        /// <param name="g">The target graphics object</param>
35        /// <param name="font">The font with which displaying the code</param>
36        /// <returns>The size in pixels</returns>
37        SizeF GetDocumentSize(FormattedCode code, Graphics g, Font font);
38
39        /// <summary>
40        /// Converts a line index to its matching Y client coordinate.
41        /// </summary>
42        /// <param name="lineIndex">The line index to convert</param>
43        /// <param name="g">The target graphics object</param>
44        /// <param name="font">The font with which displaying the code</param>
45        /// <returns>The Y client coordinate</returns>
46        float LineIndexToYCoordinate(int lineIndex, Graphics g, Font font);
47    }
48}