PageRenderTime 22ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/src/NUnit/UiException/Controls/IErrorListRenderer.cs

#
C# | 64 lines | 15 code | 6 blank | 43 comment | 0 complexity | c3efd83f8b91cc632b7a3630b1aeea99 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 System.Drawing;
10
11namespace NUnit.UiException.Controls
12{
13    /// <summary>
14    /// The interface through which ErrorList interacts with a painter to paint itself.
15    /// 
16    /// Direct implementation is:
17    ///     - DefaultErrorListRenderer
18    /// </summary>
19    public interface IErrorListRenderer
20    {
21        /// <summary>
22        /// Draws the list on the given graphics.
23        /// </summary>
24        /// <param name="items">The item collection to paint on the graphics object</param>
25        /// <param name="selected">The item to paint with selection feature</param>
26        /// <param name="g">The target graphics object</param>
27        /// <param name="viewport">The viewport location</param>
28        void DrawToGraphics(ErrorItemCollection items, ErrorItem selected, Graphics g, Rectangle viewport);
29
30        /// <summary>
31        /// Draw the given item on the given graphics object.
32        /// </summary>
33        /// <param name="item">The item to be painted</param>
34        /// <param name="index">The item's index</param>
35        /// <param name="hovered">If true, this item can display hover feature</param>
36        /// <param name="selected">If true, this item can display selection feature</param>
37        /// <param name="g">The target graphics object</param>
38        /// <param name="viewport">The current viewport</param>
39        void DrawItem(ErrorItem item, int index, bool hovered, bool selected, Graphics g, Rectangle viewport);
40
41        /// <summary>
42        /// Given a collection of items and a graphics object, this method
43        /// measures in pixels the size of the collection.
44        /// </summary>
45        /// <param name="items">The collection</param>
46        /// <param name="g">The target graphics object</param>
47        /// <returns>The size in pixels of the collection</returns>
48        Size GetDocumentSize(ErrorItemCollection items, Graphics g);
49
50        /// <summary>
51        /// Gets the Item right under point.
52        /// </summary>
53        /// <param name="items">A collection of items</param>
54        /// <param name="g">The target graphics object</param>
55        /// <param name="point">Some client coordinate values</param>
56        /// <returns>One item in the collection or null the location doesn't match any item</returns>
57        ErrorItem ItemAt(ErrorItemCollection items, Graphics g, Point point);
58
59        /// <summary>
60        /// Gets and sets the font for this renderer
61        /// </summary>
62        Font Font { get; set; }
63    }
64}