PageRenderTime 39ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

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

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